[Lazarus] TLazIntfImage GetDataLineStart

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Jul 18 00:17:53 CEST 2010


On Sat, 17 Jul 2010 23:45:39 +0200
theo <xpde at theo.ch> wrote:

>  > The TLazIntfImage.Colors property converts automatically.
> 
> Thanks, I am aware of this.
> 
> />> Is it safe to assume that the pointer from IntfImg.GetDataLineStart is
> />>/ always pointing to a PRGBTripleArray ?
> /
> > No.
> 
> 
> So the wiki example is misleading?

Yes. 
I replaced the note.

 
> Is there a built in method in TLazIntfImage to convert to / ensure a 
> certain format after loading an image form file etc.?

You can use TLazIntfImage to convert to any format you like. Just
create a second TLazIntfImage, init its memory layout and copy the
Colors:

var
  Description: TRawImageDescription;
  IntfImage1: TLazIntfImage;
begin
  Description.Init_BPP24_B8G8R8_BIO_TTB(IntfImage1.Width,IntfImage1.Height);
  IntfImage2:=TLazIntfImage.Create(0,0);
  IntfImage2.DataDescription:=Description;
  IntfImage2.CopyPixels(IntfImage1);
  ...
end;

I didn't test it, but it should work like that.

Keep in mind that TBitmap only supports the formats of the widgetset.
You must convert back to the TBitmap format before calling
CreateBitmaps. It depends on your drawing operations if these
conversions pay off.


Mattias




More information about the Lazarus mailing list