TPDFPath

Content stream editing

Description

TPDFPath (unit Lib\PDFlibContentModel.pas, added in v3.108.0) is the editable model of one path object lifted from a parsed content stream (ISO 32000-1 8.5: construction operators, an optional W/W*, then one painting operator)

Obtain a path with LiftPath, inspect or modify its subpaths and points, then write it back with LowerPath; rectangles (re) are lifted as closed four-line subpaths, so lowering emits the equivalent m/l/l/l/h form

Syntax

Delphi

TPDFPath = Class
  Public
    PaintOp: TPDFContentOperator;                     // f, S, B, n, ...
    ClipOp: TPDFContentOperator;                      // coClip / coClipEvenOdd or coUnknown
    FirstInstruction, LastInstruction: Integer;       // lifted range, inclusive
    Function Count: Integer;
    Function AddSubPath: TPDFSubPath;
    Procedure Transform(M11, M12, M21, M22, MDX, MDY: Double);
    Property SubPath[Index: Integer]: TPDFSubPath Read GetSubPath; Default;
  End;

Key members

PaintOpThe painting operator that ends the path object (f, S, B, n, ...)
ClipOpcoClip or coClipEvenOdd when a W/W* preceded the painting operator, coUnknown otherwise
FirstInstruction, LastInstructionInclusive instruction range the path was lifted from; refreshed by LowerPath
AddSubPathAppends and returns a new empty TPDFSubPath
TransformApplies the affine matrix to every point of every subpath
SubPathThe 0-based subpath, also reachable as the default property Path[I]

Subpaths and segments

Each TPDFSubPath carries its StartX/StartY move point, a Segments array of TPDFPathSegment records, a Closed flag and a SegmentCount

A segment is one of skLine (end point), skCurve (two controls plus end point), skCurveV (second control plus end point) or skCurveY (first control plus end point); coordinates live in the fields X1, Y1, X2, Y2, X3, Y3 with unused controls undefined

See also

LiftPath, LowerPath, TPDFContentProgram, WrapRangeWithMatrix