PDFiumVCL Docs

CreatePath method

Bu API girdisi tanımlayıcıları, imzaları, kod bloklarını ve PDF terimlerini özgün biçiminde korur.
Component: TPdf  ·  Unit: PDFium
Create a new path object at an initial position.

Syntax

procedure CreatePath(X, Y: Single; FillMode: TPdfFillMode = fmNone; FillColor: TColor = clBlack; FillAlpha: Byte = $FF; Stroke: Boolean = True; StrokeColor: TColor = clBlack; StrokeAlpha: Byte = $FF; StrokeWidth: Single = 1.0; LineCap: TPdfLineCap = lcDefault; LineJoin: TPdfLineJoin = ljDefault; BlendMode: TPdfBlendMode = bmDefault);

FillModeTPdfFillMode. Fill rule for the path interior: fmNone (no fill), fmAlternate (even-odd rule), or fmWinding (non-zero winding rule). Default is fmNone.
FillColorTColor. Fill color applied when FillMode is not fmNone. Default is clBlack.
FillAlphaByte. Opacity of the fill, where $00 is fully transparent and $FF is fully opaque. Default is $FF.
StrokeBoolean. When True, the path outline is drawn using StrokeColor, StrokeAlpha, and StrokeWidth. Default is True.
StrokeColorTColor. Color of the path outline. Default is clBlack.
StrokeAlphaByte. Opacity of the stroke, where $00 is fully transparent and $FF is fully opaque. Default is $FF.
StrokeWidthSingle. Width of the stroke line in PDF user units (points). Default is 1.0.
LineCapTPdfLineCap. Style applied to open path endpoints: lcDefault, lcButt, lcRound, or lcProjectingSquare. Default is lcDefault.
LineJoinTPdfLineJoin. Style applied at path segment joins: ljDefault, ljMiter, ljRound, or ljBevel. Default is ljDefault.
BlendModeTPdfBlendMode. Compositing blend mode for the path object. Default is bmDefault (normal).

 

procedure CreatePath(X, Y, Width, Height: Single; FillMode: TPdfFillMode = fmNone; FillColor: TColor = clBlack; FillAlpha: Byte = $FF; Stroke: Boolean = True; StrokeColor: TColor = clBlack; StrokeAlpha: Byte = $FF; StrokeWidth: Single = 1.0; LineCap: TPdfLineCap = lcDefault; LineJoin: TPdfLineJoin = ljDefault; BlendMode: TPdfBlendMode = bmDefault);

FillModeTPdfFillMode. Fill rule for the rectangle interior. Default is fmNone.
FillColorTColor. Fill color for the rectangle. Default is clBlack.
FillAlphaByte. Opacity of the fill ($00–$FF). Default is $FF.
StrokeBoolean. When True, the rectangle outline is drawn. Default is True.
StrokeColorTColor. Color of the rectangle outline. Default is clBlack.
StrokeAlphaByte. Opacity of the stroke ($00–$FF). Default is $FF.
StrokeWidthSingle. Width of the outline stroke in points. Default is 1.0.
LineCapTPdfLineCap. Line cap style for the rectangle corners. Default is lcDefault.
LineJoinTPdfLineJoin. Line join style for the rectangle corners. Default is ljDefault.
BlendModeTPdfBlendMode. Compositing blend mode. Default is bmDefault.

Description

CreatePath begins the construction of a new vector path object. It must be called before any of the path-building methods (MoveTo, LineTo, BezierTo, ClosePath), and the sequence must be completed by a call to AddPath to commit the path to the current page.

Two overloads are available. The two-coordinate form CreatePath(X, Y, ...) initialises an empty path with its current point at (X, Y); you then build the shape freely using the path-segment methods. The four-coordinate form CreatePath(X, Y, Width, Height, ...) creates a closed rectangular path directly — no additional segment calls are needed before AddPath.

All visual properties of the path — fill color and rule, stroke color, width, opacity, line cap, line join, and blend mode — are set at creation time via the optional parameters. Default values produce a 1-point black stroked outline with no fill.

Only one path may be under construction at a time. Calling CreatePath again before AddPath discards the previous pending path.

Example

// Draw a filled blue triangle with a 2-pt black outline
Pdf1.NewPage(595, 842);
Pdf1.CreatePath(100, 100, fmWinding, clBlue, $FF, True, clBlack, $FF, 2.0);
Pdf1.LineTo(200, 300);
Pdf1.LineTo(300, 100);
Pdf1.ClosePath;
Pdf1.AddPath;

// Draw a red filled rectangle using the 4-coordinate overload
Pdf1.CreatePath(50, 400, 200, 80, fmWinding, clRed);
Pdf1.AddPath;

See Also

MoveTo, LineTo, BezierTo, ClosePath, AddPath