TPDFSubPath

Content stream editing

Description

TPDFSubPath is one subpath of a TPDFPath: the StartX/StartY move point, an ordered Segments array of TPDFPathSegment records and a Closed flag. LiftPath builds subpaths from m, re and the construction operators, and LowerPath writes them back as an m followed by one operator per segment and an h when Closed is set.

The path owns its subpaths and frees them in its destructor, so a subpath obtained from AddSubPath or from the SubPath property is never freed by the caller.

Syntax

Delphi

TPDFSubPath = Class
  Public
    StartX, StartY: Double;
    Segments: Array Of TPDFPathSegment;
    Closed: Boolean;
    Function SegmentCount: Integer;
  End;

Fields

StartX, StartYCoordinates of the move point that opens the subpath; for a subpath lifted from re this is the rectangle's lower-left corner
SegmentsOrdered TPDFPathSegment records; each carries a Kind (skLine, skCurve, skCurveV, skCurveY) and the coordinates X1, Y1, X2, Y2, X3, Y3
ClosedTrue when h closed the subpath or when it was lifted from a complete re
SegmentCountReturns the number of entries in Segments

Remarks

Segment coordinates are meaningful per kind: skLine uses only the end point, skCurve both control points and the end point, skCurveV the second control point and the end point, skCurveY the first control point and the end point. Lifted paths leave the unused coordinates zero and lowering ignores them.

A rectangle is lifted as a closed four-line subpath, so a lowered program contains the equivalent m/l/l/l/h form instead of re.

TPDFPath.Transform maps StartX/StartY and every coordinate that the segment kind uses, leaving the unused zero coordinates untouched.

Coordinates are the lifted operators' user-space values; no CTM is applied during lifting, so they stay in the user space of the source layer.

See also

TPDFPath, LiftPath, LowerPath, TPDFContentProgram