ImageEn, unit iexPdfiumCore

TPdfObject.GetPath

TPdfObject.GetPath


Declaration

procedure GetPath(var Pts: TIEDPointArray; out PointCount: Integer; InvertOrientation: Boolean = False);


Description

Returns the points of a path object (when ObjectType is ptPath).
Values returns will be in terms of PDF points, and bottom-up (Enable InvertOrientation to reverse the direction).

Note: At present there is no method in PDFium to set a path (other than creating a new path object and removing the old one)


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.



Examples

// Display the points of an path object
ImageEnView1.PdfViewer.Objects[i].GetPath( pointArray, ptCount );
pts := '';
for p := 0 to Length( pointArray ) - 1 do
begin
  if pointArray[p].x = IE_PointArray_ClosingBreak then
    pts := pts + format( ',CLOSE', [ Round( pointArray[p].X ), Round( pointArray[p]. Y )])
  else
  if pointArray[p].Y = IE_PointArray_Break then
    pts := pts + format( ',BREAK', [ Round( pointArray[p].X ), Round( pointArray[p]. Y )])
  else
    pts := pts + format( ',(%d,%d)', [ Round( pointArray[p].X ), Round( pointArray[p]. Y )]);
end;
if pts <> '' then
  Delete(pts, 1, 1 );
Memo1.Lines.Add( 'Points: ' + pts );


// Show PDF path object as TIEPolylineLayer
ImageEnView1.PdfViewer.Objects[idx].GetPath( pointArray, ptCount, TRUE ); // Get inverted direction (because PDF values are bottom-up)
ImageEnView2.IEBitmap.Allocate( ImageEnView2.ClientWidth, ImageEnView2.ClientHeight, clWhite, 0 );

// Get a scaled rect to fit within the ImageEnView
shapeRect := GetImageRectWithinArea( r.Right - r.Left, r.Bottom - r.Top,
                                     Rect( 0, 0, ImageEnView2.ClientWidth, ImageEnView2.ClientHeight ));
ImageEnView2.LayersAdd( ielkPolyline, shapeRect );
TIEPolylineLayer( ImageEnView2.CurrentLayer ).AutoSize := False; // Scale points to fit within layer rect
TIEPolylineLayer( ImageEnView2.CurrentLayer ).SetPointsD( pointArray, ptCount, iepbRange );

if fillMode in [ pfAlternate, pfWinding ] then
  TIEPolylineLayer( ImageEnView2.CurrentLayer ).PolylineClosed := True;

if fillMode = pfNone then
  ImageEnView2.CurrentLayer.FillColor := clNone
else
  ImageEnView2.CurrentLayer.FillColor := TRGB2TColor( TRGBA2TRGB( fillColor ));
ImageEnView2.CurrentLayer.BorderColor := TRGB2TColor( TRGBA2TRGB( strokeColor ));
ImageEnView2.CurrentLayer.BorderWidth := Ceil( strokeWidth );

ImageEnView2.Update();




See Also

FillColor
GetPath
GetTextFont
LineCap
LineJoin
PathFillMode
PathStrokeWidth
StrokeColor
StrokeWidth