Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-01

Byte-Alignment of TBitmap

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martok

Hi all,

this showed up in the Discussion around 32876 and 30509:

LCL Tbitmap supports 1,24 and 32 bit images from what I see.
That is indeed true:
  luma.PixelFormat:= pf8bit;
  luma.SetSize(100, 100);
  // now: luma.RawImage.Description.Depth == 24

That of course means that the alignment for RawImage access (using Scanline) is wrong, and code ported from Delphi doesn't is one supposed to do this? Or is that a not implemented feature?

Regards, Martok Ceterum censeo b32079 esse sanandam.

Reply by email

Marc Weustink
to Martok
Martok wrote 13 lines
Hi all, this showed up in the Discussion around 32876 and 30509: > LCL Tbitmap supports 1,24 and 32 bit images from what I see. That is indeed true: luma.PixelFormat:= pf8bit; luma.SetSize(100, 100); // now: luma.RawImage.Description.Depth == 24 That of course means that the alignment for RawImage access (using Scanline) is wrong, and code ported from Delphi doesn't work at all

Why does than mean that the alignment is wrong? Based on what did you draw that conclusion?

How is one supposed to do this? Or is that a not implemented feature?

Iirc it is compatible

Marc

Reply by email

Martok
to Marc Weustink
Marc Weustink wrote
Why does than mean that the alignment is wrong? Based on what did you draw that conclusion?

The value of PixelFormat has little relation to the actual pixel format, except for 1bpp and 32bpp.
For example, a pf8bit bitmap should have 1 Byte per pixel, so the ScanLine is effectively a PByteArray. This is not the case for LCL-bitmaps...

Regards, Martok Ceterum censeo b32079 esse sanandam.

Reply by email