If you create a simple bitmap as follows, you get a 32-bit image under Linux and a 24-bit image under Windows.
procedure TForm1.FormPaint(Sender: TObject);
var
bit: TBitmap;
begin
bit := TBitmap.Create;
bit.SetSize(256, 256);
bit.Canvas.Brush.Color := clRed;
bit.Canvas.Rectangle(10, 10, 50, 50);
WriteLn('OS: ', {$I %FPCTARGETOS%});
WriteLn('Pixel format: ', bit.PixelFormat);
WriteLn('bits per Pixel: ', bit.RawImage.Description.BitsPerPixel);
WriteLn('Red Shift: ', bit.RawImage.Description.RedShift);
Canvas.Draw(50, 50, bit);
bit.Free;
end;
Output:
$ wine project1.exe
OS: Win64
Pixel format: pf24bit
bits per Pixel: 24
Red Shift: 16
$ ./project1
OS: Linux
Pixel format: pf24bit
bits per Pixel: 32
Red Shift: 16
So now my question, can you force the format when creating it to be RGA, BGR, RGBA, ABGR, etc.
It has to work somehow, if you load something with TImage.LoadFromFile, it is different depending on whether it is BMP or PNG with or without alpha.
Does anyone have an idea how to do this?
I have already tried
Bit.RawImage.Description.Init_BPP32_R8G8B8A8_BIO_TTB(w,h)
And another thing, why is the PixelFormat <> bitPerPixel in my example code under Windows?