TLazIntfImage class
Represents a graphical image.
Declaration
TLazIntfImage = class(TFPCustomImage)Inheritance
- TLazIntfImage
TFPCustomImage
Description
TLazIntfImage is a TFPCustomImage descendant which stores the
image data as TRawImage, and is therefore able to interchange images directly
with the LCL interfaces.
A large number of the protected methods (GetColorxxxxxx and SetColorxxxxxx) deal with direct interface to the operating system at the pixel level.
Usage examples:
1. Loading an .xpm file into a TBitmap:
var
BmpHnd,MaskHnd: HBitmap;
Bitmap1: TBitmap;
IntfImg1: TLazIntfImage;
Reader: TLazReaderXPM;
begin
// create a bitmap (or use an existing one)
Bitmap1:=TBitmap.Create;
// create the raw image
IntfImg1:=TLazIntfImage.Create(0,0);
// get the description for the current screen (bitsperpixel, depth, ...)
IntfImg1.DataDescription := GetDescriptionFromDevice(0);
// create the XPM reader
Reader:=TLazReaderXPM.Create;
// load the image
IntfImg1.LoadFromFile('filename.xpm',Reader);
// create the bitmap handles
IntfImg1.CreateBitmaps(BmpHnd,MaskHnd);
// apply handles to the Bitmap1
Bitmap1.Handle:=BmpHnd;
Bitmap1.MaskHandle:=MaskHnd;
// clean up
Reader.Free;
IntfImg1.Free;
// do something with the Bitmap1
// ...
end;
2. Saving a TBitmap to an .xpm file:
var
BmpHnd,MaskHnd: HBitmap;
Bitmap1: TBitmap;
IntfImg1: TLazIntfImage;
Writer: TLazWriterXPM;
begin
// ...
// create the raw image
IntfImg1:=TLazIntfImage.Create(0,0);
// load the raw image from the bitmap handles
IntfImg1.LoadFromBitmap(Bitmap1.Handle,Bitmap1.MaskHandle);
// create the XPM writer
Writer:=TLazWriterXPM.Create;
// save image to file
IntfImg1.SaveToFile('filename.xpm',Writer);
// clean up
Writer.Free;
IntfImg1.Free;
// ...
end;Properties
PixelData | public | PixelData - the raw image data for the image. |
MaskData | public | MaskData - the raw data for the mask in the image. |
DataDescription | public | DataDescription - the raw description record for the current image. |
GetInternalColorProc | public | |
SetInternalColorProc | public | |
TColors | public | TColors - the colors available for the specified pixel. |
Masked | public | Masked - whether the image mask applies at the specified position. |
Methods
Fields
FGetInternalColorProc | protected | |
FSetInternalColorProc | protected |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
