You could try using TLazIntfImage.GetDataLineStart() instead.
I think you can modify your code this way:
...
for y := 0 to IntfImg.DataDescription.Height-1 do
DumpMem(PCardinal(IntfImg.GetDataLineStart(y)), IntfImg.DataDescription.Width);
...
Regards!
-Marco
2008/1/24, Luiz Americo Pereira Camara <[EMAIL PROTECTED]>:
> I need to load the data of bitmap files into a buffer in the RGBA
> format, but i'm somewhat lost.
>
> Reading the wiki and the source i got to the following code:
>
> procedure DumpMem(Data: PCardinal; Size: Integer);
> var
> i: Integer;
> Color: TRGBA;
> begin
> for i := 0 to Size - 1 do
> begin
> Color := TRGBA(Data[i]);
> WriteLn('Red: ', Color.R, ' Green: ', Color.G,
> ' Blue: ',Color.B, ' Alpha: ', Color.A);
> end;
> end;
>
> var
> ImgReader: TLazReaderBMP;
> IntfImg: TLazIntfImage;
> begin
> ImgReader := TLazReaderBMP.Create;
> IntfImg := TLazIntfImage.Create(0,0);
> IntfImg.DataDescription.Init_BPP32_B8G8R8A8_M1_BIO_TTB(0, 0);
> IntfImg.LoadFromFile('red.bmp', ImgReader);
>
> DumpMem(PCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height *
> IntfImg.DataDescription.Width);
>
> ImgReader.Destroy;
> IntfImg.Destroy;
> end;
>
> red.bmp is a 2x2 bmp file filled with red. (attached)
>
> the DumpMem leads to different results if the program is run in IDE or
> outside it (Probably PixelData is not pointing to the data).
>
> What's wrong with this code? Should i pass the width, height when init
> datadescription?
>
> Luiz
>
>
>
>
>
>
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives