Docs: LCL/intfgraphics. Fixes errors in example code. Issue #40970.

* Discussion in  https://forum.lazarus.freepascal.org/index.php/topic,67369.msg518241.html.

(cherry picked from commit 5b84fae03d)
This commit is contained in:
dsiders 2024-05-23 18:50:33 +01:00
parent 84ac965aeb
commit dae0c545d3

View File

@ -149,7 +149,9 @@ Author: Mattias Gaertner
</element> </element>
<element name="TLazIntfImage"> <element name="TLazIntfImage">
<short>Represents a graphical image.</short> <short>
Represents a graphical image.
</short>
<descr> <descr>
<p> <p>
TLazIntfImage is a <var>TFPCustomImage</var> descendant which stores the TLazIntfImage is a <var>TFPCustomImage</var> descendant which stores the
@ -178,13 +180,13 @@ deal with direct interface to the operating system at the pixel level.
// create the raw image // create the raw image
IntfImg1:=TLazIntfImage.Create(0,0); IntfImg1:=TLazIntfImage.Create(0,0);
// get the description for the current screen (bitsperpixel, depth, ...) // get the description for the current screen (bitsperpixel, depth, ...)
IntfImg1.GetDescriptionFromDevice(0); IntfImg1.DataDescription := GetDescriptionFromDevice(0);
// create the XPM reader // create the XPM reader
Reader:=TLazReaderXPM.Create; Reader:=TLazReaderXPM.Create;
// load the image // load the image
IntfImg1.LoadFromFile('filename.xpm',Reader); IntfImg1.LoadFromFile('filename.xpm',Reader);
// create the bitmap handles // create the bitmap handles
IntfImg1.CreateBitmap(BmpHnd,MaskHnd); IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);
// apply handles to the Bitmap1 // apply handles to the Bitmap1
Bitmap1.Handle:=BmpHnd; Bitmap1.Handle:=BmpHnd;
Bitmap1.MaskHandle:=MaskHnd; Bitmap1.MaskHandle:=MaskHnd;
@ -192,7 +194,7 @@ deal with direct interface to the operating system at the pixel level.
Reader.Free; Reader.Free;
IntfImg1.Free; IntfImg1.Free;
// do something with the Bitmap1 // do something with the Bitmap1
... // ...
end; end;
</code> </code>
<p> <p>
@ -205,7 +207,7 @@ deal with direct interface to the operating system at the pixel level.
IntfImg1: TLazIntfImage; IntfImg1: TLazIntfImage;
Writer: TLazWriterXPM; Writer: TLazWriterXPM;
begin begin
... // ...
// create the raw image // create the raw image
IntfImg1:=TLazIntfImage.Create(0,0); IntfImg1:=TLazIntfImage.Create(0,0);
// load the raw image from the bitmap handles // load the raw image from the bitmap handles
@ -217,9 +219,9 @@ deal with direct interface to the operating system at the pixel level.
// clean up // clean up
Writer.Free; Writer.Free;
IntfImg1.Free; IntfImg1.Free;
... // ...
end; end;
}
</code> </code>
</descr> </descr>
<seealso/> <seealso/>