Documentation

Path
in package

Pdf page path class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

Table of Contents

Constants

CLIPPING  = 'W'
CLIPPING_EVEN_ODD  = 'W*'
CLIPPING_EVEN_ODD_FILL  = 'W* F'
CLIPPING_EVEN_ODD_NO_STYLE  = 'W* n'
CLIPPING_FILL  = 'W F'
CLIPPING_NO_STYLE  = 'W n'
FILL  = 'F'
FILL_EVEN_ODD  = 'f*'
FILL_STROKE  = 'B'
FILL_STROKE_CLOSE  = 'b'
FILL_STROKE_CLOSE_EVEN_ODD  = 'b*'
FILL_STROKE_EVEN_ODD  = 'B*'
NO_STYLE  = 'n'
STROKE  = 'S'
Style constants
STROKE_CLOSE  = 's'

Properties

$allowedStyles  : array<string|int, mixed>
Allowed styles
$streams  : array<string|int, mixed>|null
Path streams array
$style  : string
Path style

Methods

__construct()  : mixed
Constructor
closeLayer()  : Path
Close a graphics state layer
drawArc()  : Path
Draw an arc
drawChord()  : Path
Draw a chord
drawCircle()  : Path
Draw a circle
drawClosedCubicBezierCurve()  : Path
Draw a closed cubic bezier curve
drawClosedQuadraticBezierCurve()  : Path
Draw an open quadratic bezier curve, single control point
drawEllipse()  : Path
Draw an ellipse
drawLine()  : Path
Draw a line
drawOpenCubicBezierCurve()  : Path
Draw an open cubic bezier curve
drawOpenQuadraticBezierCurve()  : Path
Draw an open quadratic bezier curve, single control point
drawPie()  : Path
Draw a pie slice
drawPolygon()  : Path
Draw a polygon
drawRectangle()  : Path
Draw a rectangle
drawRoundedRectangle()  : Path
Draw a rounded rectangle
drawRoundedSquare()  : Path
Draw a rounded square
drawSquare()  : Path
Draw a square
getStreams()  : array<string|int, mixed>|null
Get the streams
getStyle()  : string
Get the current style
openLayer()  : Path
Open a graphics state layer
setFillColor()  : Path
Set the path fill color
setStroke()  : Path
Set the stroke properties
setStrokeColor()  : Path
Set the path stroke color
setStyle()  : Path
Set the style
calculateArc()  : void
Calculate arc
calculateDegrees()  : array<string|int, mixed>
Calculate degrees

Constants

CLIPPING

public mixed CLIPPING = 'W'

CLIPPING_EVEN_ODD

public mixed CLIPPING_EVEN_ODD = 'W*'

CLIPPING_EVEN_ODD_FILL

public mixed CLIPPING_EVEN_ODD_FILL = 'W* F'

CLIPPING_EVEN_ODD_NO_STYLE

public mixed CLIPPING_EVEN_ODD_NO_STYLE = 'W* n'

CLIPPING_FILL

public mixed CLIPPING_FILL = 'W F'

CLIPPING_NO_STYLE

public mixed CLIPPING_NO_STYLE = 'W n'

FILL

public mixed FILL = 'F'

FILL_EVEN_ODD

public mixed FILL_EVEN_ODD = 'f*'

FILL_STROKE

public mixed FILL_STROKE = 'B'

FILL_STROKE_CLOSE

public mixed FILL_STROKE_CLOSE = 'b'

FILL_STROKE_CLOSE_EVEN_ODD

public mixed FILL_STROKE_CLOSE_EVEN_ODD = 'b*'

FILL_STROKE_EVEN_ODD

public mixed FILL_STROKE_EVEN_ODD = 'B*'

NO_STYLE

public mixed NO_STYLE = 'n'

STROKE

Style constants

public mixed STROKE = 'S'

STROKE_CLOSE

public mixed STROKE_CLOSE = 's'

Properties

$allowedStyles

Allowed styles

protected array<string|int, mixed> $allowedStyles = ['S', 's', 'F', 'f*', 'B', 'B*', 'b', 'b*', 'W', 'W F', 'W*', 'W* F', 'W* n', 'n']

$streams

Path streams array

protected array<string|int, mixed>|null $streams = null

$style

Path style

protected string $style = 'S'

Methods

__construct()

Constructor

public __construct([string $style = Path::STROKE ]) : mixed

Instantiate a PDF path object

Parameters
$style : string = Path::STROKE

closeLayer()

Close a graphics state layer

public closeLayer() : Path
Return values
Path

drawArc()

Draw an arc

public drawArc(int|float $x, int|float $y, int|float $start, int|float $end, int|float $w[, int|float|null $h = null ]) : Path
Parameters
$x : int|float
$y : int|float
$start : int|float
$end : int|float
$w : int|float
$h : int|float|null = null
Return values
Path

drawChord()

Draw a chord

public drawChord(int|float $x, int|float $y, int|float $start, int|float $end, int|float $w[, int|float|null $h = null ]) : Path
Parameters
$x : int|float
$y : int|float
$start : int|float
$end : int|float
$w : int|float
$h : int|float|null = null
Return values
Path

drawCircle()

Draw a circle

public drawCircle(int|float $x, int|float $y, int|float $w) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
Return values
Path

drawClosedCubicBezierCurve()

Draw a closed cubic bezier curve

public drawClosedCubicBezierCurve(int|float $x1, int|float $y1, int|float $x2, int|float $y2, int|float $bezierX1, int|float $bezierY1, int|float $bezierX2, int|float $bezierY2) : Path
Parameters
$x1 : int|float
$y1 : int|float
$x2 : int|float
$y2 : int|float
$bezierX1 : int|float
$bezierY1 : int|float
$bezierX2 : int|float
$bezierY2 : int|float
Return values
Path

drawClosedQuadraticBezierCurve()

Draw an open quadratic bezier curve, single control point

public drawClosedQuadraticBezierCurve(int|float $x1, int|float $y1, int|float $x2, int|float $y2, int|float $bezierX, int|float $bezierY[, bool $first = true ]) : Path
Parameters
$x1 : int|float
$y1 : int|float
$x2 : int|float
$y2 : int|float
$bezierX : int|float
$bezierY : int|float
$first : bool = true
Return values
Path

drawEllipse()

Draw an ellipse

public drawEllipse(int|float $x, int|float $y, int|float $w[, int|float|null $h = null ]) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
$h : int|float|null = null
Return values
Path

drawLine()

Draw a line

public drawLine(int|float $x1, int|float $y1, int|float $x2, int|float $y2) : Path
Parameters
$x1 : int|float
$y1 : int|float
$x2 : int|float
$y2 : int|float
Return values
Path

drawOpenCubicBezierCurve()

Draw an open cubic bezier curve

public drawOpenCubicBezierCurve(int|float $x1, int|float $y1, int|float $x2, int|float $y2, int|float $bezierX1, int|float $bezierY1, int|float $bezierX2, int|float $bezierY2) : Path
Parameters
$x1 : int|float
$y1 : int|float
$x2 : int|float
$y2 : int|float
$bezierX1 : int|float
$bezierY1 : int|float
$bezierX2 : int|float
$bezierY2 : int|float
Return values
Path

drawOpenQuadraticBezierCurve()

Draw an open quadratic bezier curve, single control point

public drawOpenQuadraticBezierCurve(int|float $x1, int|float $y1, int|float $x2, int|float $y2, int|float $bezierX, int|float $bezierY[, bool $first = true ]) : Path
Parameters
$x1 : int|float
$y1 : int|float
$x2 : int|float
$y2 : int|float
$bezierX : int|float
$bezierY : int|float
$first : bool = true
Return values
Path

drawPie()

Draw a pie slice

public drawPie(int|float $x, int|float $y, int|float $start, int|float $end, int|float $w[, int|float|null $h = null ]) : Path
Parameters
$x : int|float
$y : int|float
$start : int|float
$end : int|float
$w : int|float
$h : int|float|null = null
Return values
Path

drawPolygon()

Draw a polygon

public drawPolygon(array<string|int, mixed> $points) : Path
Parameters
$points : array<string|int, mixed>
Tags
throws
Exception
Return values
Path

drawRectangle()

Draw a rectangle

public drawRectangle(int|float $x, int|float $y, int|float $w[, int|float|null $h = null ]) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
$h : int|float|null = null
Return values
Path

drawRoundedRectangle()

Draw a rounded rectangle

public drawRoundedRectangle(int|float $x, int|float $y, int|float $w[, int|float|null $h = null ][, int|float $rx = 10 ][, int|float|null $ry = null ]) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
$h : int|float|null = null
$rx : int|float = 10
$ry : int|float|null = null
Return values
Path

drawRoundedSquare()

Draw a rounded square

public drawRoundedSquare(int|float $x, int|float $y, int|float $w[, int|float $rx = 10 ][, int|float|null $ry = null ]) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
$rx : int|float = 10
$ry : int|float|null = null
Return values
Path

drawSquare()

Draw a square

public drawSquare(int|float $x, int|float $y, int|float $w) : Path
Parameters
$x : int|float
$y : int|float
$w : int|float
Return values
Path

getStreams()

Get the streams

public getStreams() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getStyle()

Get the current style

public getStyle() : string
Return values
string

openLayer()

Open a graphics state layer

public openLayer() : Path
Return values
Path

setStroke()

Set the stroke properties

public setStroke(int|float $width[, int|float|null $dashLength = null ][, int|float|null $dashGap = null ]) : Path
Parameters
$width : int|float
$dashLength : int|float|null = null
$dashGap : int|float|null = null
Return values
Path

setStyle()

Set the style

public setStyle(string $style) : Path
Parameters
$style : string
Return values
Path

calculateArc()

Calculate arc

protected calculateArc(int|float $x, int|float $y, array<string|int, mixed> $degrees, int|float $w[, int|float|null $h = null ][, bool $closed = false ][, bool $pie = false ]) : void
Parameters
$x : int|float
$y : int|float
$degrees : array<string|int, mixed>
$w : int|float
$h : int|float|null = null
$closed : bool = false
$pie : bool = false

calculateDegrees()

Calculate degrees

protected calculateDegrees(int|float $start, int|float $end) : array<string|int, mixed>
Parameters
$start : int|float
$end : int|float
Tags
throws
OutOfRangeException
Return values
array<string|int, mixed>

        
On this page

Search results