setasign\SetaPDF2\Core\Canvas

Path A canvas helper class for path operators

File: /SetaPDF v2/Core/Canvas/Path.php
Old class name (alias): \SetaPDF_Core_Canvas_Path

Class hierarchy

Summary

Constants

LINE_CAP_BUTT

public const int Path::LINE_CAP_BUTT = 0

Line cap style

LINE_CAP_PROJECTING_SQUARE

public const int Path::LINE_CAP_PROJECTING_SQUARE = 2

Line cap style

LINE_CAP_ROUND

public const int Path::LINE_CAP_ROUND = 1

Line cap style

LINE_JOIN_BEVEL

public const int Path::LINE_JOIN_BEVEL = 2

Line join type

LINE_JOIN_MITER

public const int Path::LINE_JOIN_MITER = 0

Line join type

LINE_JOIN_ROUND

public const int Path::LINE_JOIN_ROUND = 1

Line join type


Properties

$_canvas

The origin canvas object


Methods

__construct()

public Operators::__construct (
Canvas $canvas
)

The constructor.

Parameters
$canvas : Canvas
 

addCurrentTransformationMatrix()

public StandardOperators::addCurrentTransformationMatrix (
float|int $a,
float|int $b,
float|int $c,
float|int $d,
float|int $e,
float|int $f
): $this

Proxy method for adding a transformation matrix on the canvas.

Parameters
$a : float|int
 
$b : float|int
 
$c : float|int
 
$d : float|int
 
$e : float|int
 
$f : float|int
 
See

cleanUp()

public Operators::cleanUp (
void
): void

Release objects to free memory and cycled references.

After calling this method the instance of this object is unusable!

clip()

public Path::clip (
void
): Path

Clip the current path.

clipEvenOdd()

public Path::clipEvenOdd (
void
): Path

Clip the current path using even-odd rule.

close()

public Path::close (
void
): $this

Close the current subpath by appending a straight line segment from the current point to the starting point of the subpath.

closeAndStroke()

public Path::closeAndStroke (
void
): Path

Close and stroke the path.

closeFillAndStroke()

public Path::closeFillAndStroke (
void
): Path

Close, fill and stroke the path.

closeFillAndStrokeEvenOdd()

Close, fill and stroke the path using even-odd rule.

curveTo()

public Path::curveTo (
float $x1,
float $y1,
float $x2,
float $y2,
float|string|null $x3 = null,
?float $y3 = null
): Path

Append a cubic Bézier curve to the current path.

Parameters
$x1 : float
 
$y1 : float
 
$x2 : float
 
$y2 : float
 
$x3 : float|string|null

Also used as control parameter to define the coincide point

$y3 : ?float
 

draw()

public Operators::draw (
void
): Draw

Get the draw helper.

endPath()

public Path::endPath (
void
): Path

End the path object without filling or stroking it.

fill()

public Path::fill (
void
): Path

Fill the path.

fillAndStroke()

public Path::fillAndStroke (
void
): Path

Fill and stroke the path.

fillAndStrokeEvenOdd()

public Path::fillAndStrokeEvenOdd (
void
): Path

Fill and stroke the path using even-odd rule.

fillEvenOdd()

public Path::fillEvenOdd (
void
): Path

Fill the path using even-odd rule.

lineTo()

public Path::lineTo (
float $x,
float $y
): Path

Append a straight line segment.

Parameters
$x : float
 
$y : float
 

markedContent()

Get the marked content helper.

moveTo()

public Path::moveTo (
float $x,
float $y
): Path

Begin a new subpath at a specific position.

Parameters
$x : float
 
$y : float
 

path()

public Operators::path (
void
): Path

Get the path helper.

rect()

public Path::rect (
float $x,
float $y,
float $width,
float $height
): Path

Append a rectangle to the current path as a complete subpath.

Parameters
$x : float
 
$y : float
 
$width : float
 
$height : float
 

restoreGraphicState()

Proxy method for restoring the graphic state on the canvas.

See

rotate()

public StandardOperators::rotate (
int|float $x,
int|float $y,
int|float $angle
): $this

Proxy method for rotating the transformation matrix on the canvas.

Parameters
$x : int|float

X-coordinate of rotation point

$y : int|float

Y-coordinate of rotation point

$angle : int|float

Angle to rotate in degrees

See

saveGraphicState()

Proxy method for saving the graphic state on the canvas.

See

scale()

public StandardOperators::scale (
int|float $scaleX,
int|float $scaleY
): $this

Proxy method for scaling the transformation matrix on the canvas.

Parameters
$scaleX : int|float

Scale factor on X

$scaleY : int|float

Scale factor on Y

See

setColor()

public StandardOperators::setColor (
\setasign\SetaPDF2\Core\DataStructure\Color\AbstractColor|int[]|int|string $color,
bool $stroking = true
): $this

Proxy method for setting the color on the canvas.

Parameters
$color : \setasign\SetaPDF2\Core\DataStructure\Color\AbstractColor|int[]|int|string
 
$stroking : bool
 
See

setDashPattern()

public Path::setDashPattern (
array $dashesAndGaps = array ( ),
int $phase = 0
): Path

Set the dash pattern.

Parameters
$dashesAndGaps : array
 
$phase : int
 

setGraphicState()

Proxy method for setting a graphic state on the canvas.

Parameters
$graphicState : \setasign\SetaPDF2\Core\Resource\ExtGState
 
See

setLineCap()

public Path::setLineCap (
int $lineCap = Path::LINE_CAP_BUTT
): Path

Set the line cap style.

Parameters
$lineCap : int
 

setLineJoin()

public Path::setLineJoin (
int $lineJoin = Path::LINE_JOIN_MITER
): Path

Set the line join type.

Parameters
$lineJoin : int
 

setLineWidth()

public Path::setLineWidth (
float $lineWidth = 1.0
): Path

Set the line width.

Parameters
$lineWidth : float
 

setMiterLimit()

public Path::setMiterLimit (
float $miterLimit = 10.0
): Path

Set the miter limit.

Parameters
$miterLimit : float
 

setNonStrokingColor()

Proxy method for setting the non-stroking color on the canvas.

Parameters
$color : \setasign\SetaPDF2\Core\DataStructure\Color\AbstractColor|int[]|int|string
 
See

setStrokingColor()

Proxy method for setting the stroking color on the canvas.

Parameters
$color : \setasign\SetaPDF2\Core\DataStructure\Color\AbstractColor|int[]|int|string
 
See

skew()

public StandardOperators::skew (
int|float $angleX,
int|float $angleY,
int|float $x = 0,
int|float $y = 0
): $this

Proxy method for skewing the transformation matrix on the canvas.

Parameters
$angleX : int|float

Angle to x-axis in degrees

$angleY : int|float

Angle to y-axis in degrees

$x : int|float

Points to stretch on x-axis

$y : int|float

Point to stretch on y-axis

See

stroke()

public Path::stroke (
void
): Path

Stroke the path.

text()

public Operators::text (
void
): Text

Get the text helper.

translate()

public StandardOperators::translate (
int|float $shiftX,
int|float $shiftY
): $this

Proxy method for moving the transformation matrix on the canvas.

Parameters
$shiftX : int|float

Points to move on x-axis

$shiftY : int|float

Points to move on y-axis

See