Hi all,
I am trying to load an image 128x128 with an alpha channel ilbm format made with sketchblock into a piece of code using datatypes library. I have never done anything before with datatypes, and thus I am at lack of knowledge of how to make it look and work properly. The problem is, if I load an image without alpha channel, it is displayed correctly, but the alpha image I want is displayed with solid alpha and just as a black box. The image is a black to white gradient with alpha corresponding, so that could be the issue here.
I have tried following the example on amigaos wiki on picture class, and it gives the above result. Then I am trying to use the PDTM_READPIXELARRAY method, but I cannot get it to not crash. I can supply my code if anyone wants to barf at it, but I would much rather see an actual working example of how to load an 32-bit image with alpha channel into a BitMap structure using datatypes library, if anyone has it. Thanks.
@alfkil
Download the Composite3DDemo source code (http://hdrlab.org.nz/projects/amiga-os-4-projects/c3d/), and have a look in C3D/C3DTexture.cpp.
Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work
Thanks Hans, that seems to have solved it. I was trying something along the same lines but was not properly informed on the details. So, as for the comment in your code on picture class leaving out alpha if you try and just extract the bitmap, wouldn't it be a good idea to implement that comment in the autodocs or wiki? And one last thing: Why do I need to lock the bitmap during extraction with READPIXELARRAY?
Answered my own question. Thanks for the pointer.
Ok, I was not entirely done... How do I extract the alpha channel as an ALPHA8 bitmap to use as COMPTAG_SrcAlphaMask? I have tried BltBitMapTags and Compositing from the truecolor bitmap to an alpha bitmap, but I seem to be stuck.
Fixed it, but the process is rather complicated. I have to use p96Read/WritePixelArray and the alpha bitmap has to be not allocated by p96AllocBitMap for some strange reason but rather by graphics.library with a window bitmap as friend.
Don't know if this piece of source code will help:
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
@alfkil
Yes, extracting the alpha channel (or any channel) has to be done manually.
It's very strange that you have to allocate it via the graphics.library wth a window bitmap as friend. That doesn't sound right, as an RGBFB_ALPHA8 bitmap should be the same either way.
Hans
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work