Most image readers don't support an alpha channel for BMP files. If you want to keep the transparency, better to use a format that has solid alpha support.
Yes, thank you for the reminder as I am/was aware.
The situation is:
- palette colors and image data is stored raw in a stream
- palette colors are stored in YCbCr format
- (indexed) pixel data is stored as RLE encoded
The process that TS follows is:
- read palette colors, convert from YCbCr to FPColor and store into an array (using custom function YCbCr2FPColor)
- 'retrieve' image from raw (RLE encoded) data-stream but in that process the color array gets converted into a TFPPalette first
- then read raw RLE encoded data into a temp buffer
- RLE decode temp buffer, using the palette and use decoded bytes as index to the palette.
- in that process the color of the pixel (TBGRAPixel) is retrieved (using the colorindex to the the palette's index) with TBGRAPixel's function FromFPColor
- that 'color' is then used to set the corresponding pixel to that color.
That all seems to work as intended.
However, the code now uses the following assignment:
{ dummy for better understanding } bmp := retrieveBGRABitmapFromRawData
image1.Picture.Assign(bmp.Bitmap);
Where image1 is a TImage component placed on the form and bmp is a TBGRABitmap. The TImage picture stays (visible) empty.
When I replace that with:
{ dummy for better understanding } bmp := retrieveBGRABitmapFromRawData
bmp.draw (Image1.canvas,0,0, true);
The picture becomes visible in the TImage component.
afaik that would indicate that something did go wrong with the alpha channel but I haven't been able to figure out yet what exactly.
PS: attached is a BGRABitmap saved as BMP that the (original) code produces.