Contents - Methods - Properties
Helper class for image manipulations (wrapper to PLPict23.dll)
Description
Internal representation - truecolor device-independent bitmap (DIB).Loading an image from file/stream - BMP, JPEG, TIFF, PNG, GIF, TGA, PCX, ....
Saving an image to file/stream - BMP, JPEG, TIFF, PNG.
Drawing directly into the image canvas (or HDC) - usable as offscreen bitmap.
Drawing an image into another canvas (or into HDC) - 1:1 or zoomed by factor.
Thread-safe (locking mechanism for using with unsafe VCL version).
At runtime, TPLPicture requires PLPict23.dll on search path ( Windowsetc).
Contents - TPLPicture - Properties
~TPLPicture
DestructorBeginPaint
Begin painting into image canvasCheckPaintLibDllOkDelphi declaration
function BeginPaint(bLockedPaint: Boolean): Boolean;
C++ declaration
bool __fastcall BeginPaint(bool bLockedPaint)
Description
bLockedPaint - Lock TPLPicture painting operations. Important in the case of multithreading.Set bLockedPaint to TRUE, if your VCL graphics is not thread-safe (CBuilder1, Delphi2),
Otherwise set to FALSE (starting from CBuilder 4 and Delphi 4; we have not tested CBuilder 3 yet).
Don't forget to call EndPaint after your drawing is finished!
InternalCreateDelphi declaration
function CheckPaintLibDllOk: Boolean;
C++ declaration
bool __fastcall CheckPaintLibDllOk(void)
Create a new empty image objectCreateSizeDelphi declaration
constructor Create;
Description
The size is not determined (1x1 pixels).Usage: before loading from file/stream.
Create a new empty image with determined width and heightDestroyDelphi declaration
constructor CreateSize(AWidth: Longint; AHeight: Longint);
Description
Usable before drawing into the image canvas.
DestructorDraw
Draws an image into the canvasDrawDCDelphi declaration
procedure Draw(ACanvas: TCanvas; x: Integer; y: Integer);
C++ declaration
void __fastcall Draw(Graphics::TCanvas *ACanvas, int x, int y)
Description
ACanvas - where to drawx,y - left upper corner in ACanvas
Draws an image into HDCEndPaintDelphi declaration
procedure DrawDC(dc: HDC; x: Integer; y: Integer);
C++ declaration
void __fastcall DrawDC(HDC dc, int x, int y)
Description
dc - device context, where to drawx,y - left upper corner
End painting o n the image canvasGetCanvasDelphi declaration
procedure EndPaint;
C++ declaration
void __fastcall EndPaint(void)
Description
At this point Canvas and dc are freed.If previously BeginPaint was called requiring locking (BeginPaint(TRUE)), then this will also unlock other threads.
Delphi declarationGetFileLoadFilter
function GetCanvas: TCanvas;
C++ declaration
Graphics::TCanvas *__fastcall GetCanvas(void)
Delphi declarationGetFileSaveFilter
function GetFileLoadFilter: string;
C++ declaration
System::AnsiString __fastcall GetFileLoadFilter(void)
Delphi declarationGetHandle
function GetFileSaveFilter: string;
C++ declaration
System::AnsiString __fastcall GetFileSaveFilter(void)
Delphi declarationGetHeight
function GetHandle: HBITMAP;
C++ declaration
HBITMAP __fastcall GetHandle(void)
Delphi declarationGetWidth
function GetHeight: Longint;
C++ declaration
long __fastcall GetHeight(void)
Delphi declarationLoadFromFile
function GetWidth: Longint;
C++ declaration
long __fastcall GetWidth(void)
Load (decode) image from fileLoadFromStreamDelphi declaration
function LoadFromFile(const FileName: string): Boolean;
C++ declaration
bool __fastcall LoadFromFile(const System::AnsiString FileName)
Description
Image type is detected automatically.Warning: previous content and size will be overwritten.
Load (decode) image from streamLockDelphi declaration
function LoadFromStream(InStream: TCustomMemoryStream): Boolean;
C++ declaration
bool __fastcall LoadFromStream(Classes::TCustomMemoryStream *InStream)
Description
Image type is detected automatically.Warning: previous content and size will be overwritten.
Another way to lock an image before a thread-unsafe operationSaveToBMPStreamDelphi declaration
procedure Lock;
C++ declaration
void __fastcall Lock(void)
Description
Don't forget to call UnLock, if the required operation is done!
Save (encode) an image into stream as BMPSaveToFileDelphi declaration
function SaveToBMPStream(OutStream: TStream): Boolean;
C++ declaration
bool __fastcall SaveToBMPStream(Classes::TStream *OutStream)
Save (encode) an image into a fileSaveToJPEGStreamDelphi declaration
function SaveToFile(const FileName: string): Boolean;
C++ declaration
bool __fastcall SaveToFile(const System::AnsiString FileName)
Description
Image type will b e determined from t he filename extension (default BMP)
Save (encode) an image into steam as JPEG with default qualitySaveToJPEGStreamQDelphi declaration
function SaveToJPEGStream(OutStream: TStream): Boolean;
C++ declaration
bool __fastcall SaveToJPEGStream(Classes::TStream *OutStream)
Save (encode) an image into steam as JPEG with custom qualitySaveToPNGStreamDelphi declaration
function SaveToJPEGStreamQ(OutStream: TStream; iQuality: Integer): Boolean;
C++ declaration
bool __fastcall SaveToJPEGStreamQ(Classes::TStream *OutStream, int iQuality)
Description
Parameter iQuality is t he BMP->JPEG conversion quality in percentages (0...100) - better quality means bigger size.
Save (encode) an image into steam as PNGSaveToTIFFStreamDelphi declaration
function SaveToPNGStream(OutStream: TStream): Boolean;
C++ declaration
bool __fastcall SaveToPNGStream(Classes::TStream *OutStream)
Save (encode) an image into steam as TIFFStretchDrawDelphi declaration
function SaveToTIFFStream(OutStream: TStream): Boolean;
C++ declaration
bool __fastcall SaveToTIFFStream(Classes::TStream *OutStream)
Draws a n image into t he canvas, zoomed by factorStretchDrawDCDelphi declaration
procedure StretchDraw(ACanvas: TCanvas; x: Integer; y: Integer; Factor: Double);
C++ declaration
void __fastcall StretchDraw(Graphics::TCanvas *ACanvas, int x, int y, double Factor)
Description
ACanvas - where to drawx,y - left upper corner
Draws a n image into HDC, zoomed by factorTPLPictureDelphi declaration
procedure StretchDrawDC(dc: HDC; x: Integer; y: Integer; Factor: Double);
C++ declaration
void __fastcall StretchDrawDC(HDC dc, int x, int y, double Factor)
Description
dc - where to drawx,y - left upper corner
ConstructorUnLockC++ declaration
__fastcall virtual TPLPicture(void)__fastcall virtual TPLPicture(long AWidth, long AHeight)
Description
Constructor without parameters creates a new empty image - usable before loading from file/stream.Paramet e rized constructor creates a new empty image with a determined size - usable before drawing into the image canvas.
Unlocking an image after a thread-unsafe operationDelphi declaration
procedure UnLock;
C++ declaration
void __fastcall UnLock(void)
Contents - TPLPicture - Methods
Canvas
Canvas for drawing o n the imagedcDelphi declaration
property Canvas: TCanvas read GetCanvas;
C++ declaration
__property Graphics::TCanvas *Canvas={ read=GetCanvas, nodefault }
Description
Canvas is available only between BeginPaint and EndPaint !
Image's device context (HDC) for drawingFileLoadFilterDelphi declaration
property dc: HDC read hMemDC;
C++ declaration
__property HDC dc={ read=hMemDC, nodefault }
Description
dc is available only between BeginPaint and EndPaint !
Supported imagefiles filter for OpenFile dialogFileSaveFilterDelphi declaration
property FileLoadFilter: string read GetFileLoadFilter;
C++ declaration
__property System::AnsiString FileLoadFilter={ read=GetFileLoadFilter, nodefault }
Supported imagefiles filter for SaveFile dialogHandleDelphi declaration
property FileSaveFilter: string read GetFileSaveFilter;
C++ declaration
__property System::AnsiString FileSaveFilter={ read=GetFileSaveFilter, nodefault }
Handle to image's internal representation (Windows HBITMAP)HeightDelphi declaration
property Handle: HBITMAP read GetHandle;
C++ declaration
__property HBITMAP Handle={ read=GetHandle, nodefault }
Image height in pixelsLockedDelphi declaration
property Height: Longint read GetHeight;
C++ declaration
__property long Height={ read=GetHeight, nodefault }
Description
Value is not changeable (set in t he constructor or when loaded from file/stream)
Check if image is lockedWidthDelphi declaration
property Locked: Boolean read FLocked;
C++ declaration
__property bool Locked={ read=FLocked, nodefault }
Image width in pixelsDelphi declaration
property Width: Longint read GetWidth;
C++ declaration
__property long Width={ read=GetWidth, nodefault }
Description
Value is not changeable (set in t he constructor or or when loaded from file/stream)