|
DrawImage procedure (TgtCustomDocumentEngine) |
Top |
|
Used to draw images on to the document.
procedure DrawImage(ColumnNo: Integer; Width, Height: Double; AGraphic: TGraphic); overload; procedure DrawImage(ImageRect: TgtRect; Index: Integer); overload; procedure DrawImage(ImageRect: TgtRect; AGraphic: TGraphic); overload; procedure DrawImage(X, Y: Double; AGraphic: TGraphic); overload;
Description Call DrawImage with ColumnNo, Width, Height and a graphic to draw an image within a table.
Call DrawImage with ImageRect and an Index to draw an image at a location specified by the ImageRect. Index is a value returned by AddImageAsResource.
Call DrawImage with ImageRect and a graphic to draw an image at a location specified by the ImageRect.
Call DrawImage with X, Y coordinates and a graphic to draw an image at a location specified by the coordinates.
ImageSettings property can be used to specify options for image rendering before calling DrawImage method.
Example:
Delphi:
with gtPDFEngine1 do begin FileName := 'C:\Images'; Page.PaperSize := A4; //... Set any other document properties as required BeginDoc; Brush.Color := clLtGray; //... Set any image properties through ImageSettings as required
//Use this method to draw image at a particular position DrawImage(1, 0, Image1.Picture.Graphic);
//Use this method to specify a rectangle within which the image is drawn DrawImage(gtRect(0.5, 0.5, 3, 3), Image1.Picture.Graphic);
I := AddImageAsResource(Image1.Picture.Graphic); DrawImage(gtRect(0.5, 0.5, 4, 4), I);
List1 := BeginTable(0, 0, 5); //returns a list of TgtColumns for J := 0 to 3 do//4 rows in the table begin NewRow; for I := 0 to 4 do DrawImage(1, 10, 10, Image1.Picture.Graphic); end; EndTable;
EndDoc; end;
C++Builder:
gtPDFEngine1->FileName = "C:\\Images"; gtPDFEngine1->Page->PaperSize = A4; //... Set any other document properties as required gtPDFEngine1->BeginDoc(); gtPDFEngine1->Brush->Color = clLtGray; //... Set any image properties through ImageSettings as required
//Use this method to draw image at a particular position gtPDFEngine1->DrawImage(1, 0, Image1->Picture->Graphic);
//Use this method to specify a rectangle within which the image is drawn gtPDFEngine1->DrawImage(gtRect(0.5, 0.5, 3, 3), Image1->Picture->Graphic);
I = gtPDFEngine1->AddImageAsResource(Image1->Picture->Graphic); gtPDFEngine1->DrawImage(gtRect(0.5, 0.5, 4, 4), I);
List1 = gtPDFEngine1->BeginTable(0, 0, 5); //returns a list of TgtColumns for (J = 0; J<=3; J++) //4 rows in the table { gtPDFEngine1->NewRow(); for (I = 0; I<=4; I++) gtPDFEngine1->DrawImage(1, 10, 10, Image1->Picture->Graphic); } gtPDFEngine1->EndTable(); gtPDFEngine1->EndDoc(); |