|
AddImageAsResource function (TgtCustomDocumentEngine) |
Top |
|
Adds graphic to a list of Image resources.
function AddImageAsResource(AGraphic: TGraphic): Integer; override;
Description
Call AddImageAsResource to add a graphic item to list of resource images. Graphic could be a Bitmap, Icon, MetaFile, GIF or JPEG. The resource image once created for a document can be reused in multiple locations of the same document using the return value as an identifier.
Return: Position of the new graphic added in the Image resource list is returned. It can be used as parameter to DrawImage to draw same graphic at different locations.
Example:
Delphi:
with gtPDFEngine1 do begin FileName := 'C:\Image'; BeginDoc; I := AddImageAsResource(Image1.Picture.Graphic); //... Set any image properties as required // Draw image once DrawImage(gtRect(0.5, 0.5, 4, 4), I); NewPage; // Draw image again DrawImage(gtRect(2, 2, 6, 6), I); EndDoc; end;
C++Builder:
int I = 0; gtPDFEngine1->FileName = "C:\\Image"; gtPDFEngine1->BeginDoc(); I = gtPDFEngine1->AddImageAsResource(Image1->Picture->Graphic); //... set any image properties as required //Draw image once gtPDFEngine1->DrawImage(gtRect(0.5, 0.5, 4, 4), I); gtPDFEngine1->NewPage(); //Draw image again gtPDFEngine1->DrawImage(gtRect(2, 2, 6, 6), I); gtPDFEngine1->EndDoc();
|