ImageEn, unit iexPdfiumCore |
|
TPdfObjectList.AddPath
Declaration
// Line overloads
function AddPath(X1, Y1, X2, Y2: Single): TPdfObject; overload;
function AddPath(X1, Y1, X2, Y2: Single; LineColor: TColor; LineWidth: Single = 1.0; LineOpacity: Single = 1.0): TPdfObject; overload;
// Curve overloads
function AddPath(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single): TPdfObject;
function AddPath(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Single; LineWidth: Single = 1.0; LineOpacity: Single = 1.0): TPdfObject; overload;
// Path overloads
function AddPath(Pts: Array of TDPoint; PathClosed: Boolean): TPdfObject; overload;
function AddPath(Pts: Array of TDPoint; PathClosed: Boolean;
LineColor: TColor; LineWidth: Single = 1.0; LineOpacity: Single = 1.0; EndingCap: TIEPDFEndingCap = iepdfButtCaps;
Filled: boolean = false; FillColor: TColor = clBlack; FillOpacity: Single = 1.0): TPdfObject; overload;
// Shape overloads
function AddPath(X, Y, Width, Height: Integer; Shape: TIEShape; ClosePolyline: Boolean = True; MaintainAR: Boolean = False): TPdfObject; overload;
function AddPath(X, Y, Width, Height: Integer; Shape: TIEShape; ClosePolyline: Boolean;
LineColor: TColor; LineWidth: Single = 1.0; LineOpacity: Single = 1.0;
Filled: boolean = false; FillColor: TColor = clBlack; FillOpacity: Single = 1.0;
MaintainAR: Boolean = False): TPdfObject; overload;
Description
Add a path object to the current page at the specified position (in terms of PDF points).
Note: You must call
ApplyChanges before saving to apply object changes to the document
PDF Page Points
Objects on a PDF page are specified in points that originate at the bottom-left, i.e. when X,Y = (0,0). The top-left of the page is specified by (
PageWidth,
PageHeight).
To convert PDF points to screen values, use
PageToScr.
Line Example
const
Line_OffsetX = 120;
Line_OffsetY = 90;
Line_Color = clNavy;
Line_Width = 3;
Line_Opacity = 255;
var
obj: TPdfObject;
begin
obj := ImageEnView1.PdfViewer.Objects.AddPath( 100, 800, 100 + Line_OffsetX, 800 + Line_OffsetY );
obj.StrokeColor := TColor2TRGBA( Line_Color, Line_Opacity );
obj.PathStrokeWidth := Line_Width;
end;
Path Example
const
Path_OffsetX1 = -60;
Path_OffsetY1 = -60;
Path_OffsetX2 = 120;
Path_OffsetY2 = 0;
Path_Color = clPurple;
Path_Width = 3;
Path_Opacity = 255;
Path_Closed = True;
var
obj: TPdfObject;
var
pathPts: array of TDPoint;
begin
SetLength( pathPts, 3 );
pathPts[0] := DPoint( 100, 800);
pathPts[1] := DPoint( 100 + Path_OffsetX1, 800 + Path_OffsetY1 );
pathPts[2] := DPoint( 100 + Path_OffsetX1 + Path_OffsetX2, 800 + Path_OffsetY1 + Path_OffsetY2 );
obj := ImageEnView1.PdfViewer.Objects.AddPath( pathPts, Path_Closed );
obj.StrokeColor := TColor2TRGBA( Path_Color, Path_Opacity );
obj.PathStrokeWidth := Path_Width;
obj.FillColor := TColor2TRGBA( Path_Fill, Fill_Opacity );
obj.PathFillMode := pfAlternate;
end;
Shape Example
const
Shape_Shape = iesStar5;
Shape_Width = 200;
Shape_Height = 200;
Shape_LineColor = clYellow;
Shape_LineWidth = 0;
Shape_Opacity = 255;
Shape_Closed = True;
Shape_Fill = clYellow;
Fill_Opacity = 255;
var
obj: TPdfObject;
begin
obj := ImageEnView1.PdfViewer.Objects.AddPath( Round( 100 ), Round( 800 ), Shape_Width, Shape_Height, Shape_Shape, Shape_Closed );
obj.StrokeColor := TColor2TRGBA( Shape_LineColor, Shape_Opacity );
obj.PathStrokeWidth := Shape_LineWidth;
obj.FillColor := TColor2TRGBA( Shape_Fill, Fill_Opacity );
obj.PathFillMode := pfAlternate;
end;
Curve Example
const
Line_Pt1_X = 120;
Line_Pt1_Y = 60;
Line_Pt2_X = 160;
Line_Pt2_Y = 60;
Line_EndPt_X = 160;
Line_EndPt_Y = 160;
Line_Color = clFuchsia;
Line_Width = 3;
Line_Opacity = 255;
var
obj: TPdfObject;
begin
// Add a cubic Bezier curve to the given path, starting at the current point.
//
// x1 - Horz starting point
// y1 - Vert starting point
// x2 - the horizontal position of the first Bezier control point
// y2 - the vertical position of the first Bezier control point
// x3 - the horizontal position of the second Bezier control point
// y3 - the vertical position of the second Bezier control point
// x4 - the horizontal position of the ending point of the Bezier curve
// y4 - the vertical position of the ending point of the Bezier curve
obj := ImageEnView1.PdfViewer.Objects.AddPath( 100, 800,
100 + Line_Pt1_X, 800 + Line_Pt1_Y,
100 + Line_Pt2_X, 800 + Line_Pt2_Y,
100 + Line_EndPt_X, 800 + Line_EndPt_Y );
obj.StrokeColor := TColor2TRGBA( Line_Color, Line_Opacity );
obj.PathStrokeWidth := Line_Width;
end;