SetaPDF_Core_Canvas_GraphicState A canvas helper class for graphicState operators

File: /SetaPDF v2/Core/Canvas/GraphicState.php

Class hierarchy

Summary

Static Properties

$_maxGraphicStateNestingLevel

The maximum nesting level of the graphic states (default in PDF 1.7 was 28; we increased it due to several user complaints and the fact that this limit was removed in PDF 2.0 completely).

See
  • PDF 32000-1:2008 - C.2 Architectural limits

Properties

$_stack

protected array SetaPDF_Core_Canvas_GraphicState::$_stack = array()

Stack of all opened or closed graphic states.


Static Methods

getMaxGraphicStateNestingLevel()

Get the maximum nesting level of graphic states.

setMaxGraphicStateNestingLevel()

public static SetaPDF_Core_Canvas_GraphicState::setMaxGraphicStateNestingLevel (
int $maxGraphicStateNestingLevel
): void

Set the maximum nesting level of graphic states.

Parameters
$maxGraphicStateNestingLevel : int
 

Methods

__construct()

The constructor.

Parameters
$matrix : SetaPDF_Core_Geometry_Matrix
 

__clone()

_getCurrent()

Get the current state of the stack.

addCurrentTransformationMatrix()

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

Add a transformation matrix to the stack of the current graphic state.

Parameters
$a : int|float
 
$b : int|float
 
$c : int|float
 
$d : int|float
 
$e : int|float
 
$f : int|float
 
See
  • PDF-Reference PDF 32000-1:2008 8.3.4 Transformation Matrices

getCurrentTransformationMatrix()

getUserSpaceXY()

public SetaPDF_Core_Canvas_GraphicState::getUserSpaceXY (
int|float $x, int|float $y
): array

Returns the user space coordinates.

Parameters
$x : int|float
 
$y : int|float
 
Return Values

array with ('x' => $x, 'y' => $y)

restore()

Restore the last graphic state and pop all matrices of the current graphic state out of the matrix stack.

Exceptions

Throws BadMethodCallException

rotate()

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

Rotate the graphic state by $angle degrees at the origin defined by $x and $y.

Parameters
$x : int|float

X-coordinate of rotation point

$y : int|float

Y-coordinate of rotation point

$angle : float

Angle to rotate in degrees

save()

Open a new graphic state and copy the entire graphic state onto the stack of the new graphic state.

Exceptions

Throws BadMethodCallException

scale()

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

Scale the graphic state by the factor $scaleX and $scaleY.

Parameters
$scaleX : int|float

Scale factor on X

$scaleY : int|float

Scale factor on Y

skew()

public SetaPDF_Core_Canvas_GraphicState::skew (
float $angleX, float $angleY [, int $x = 0 [, int $y = 0 ]]
): SetaPDF_Core_Canvas_GraphicState

Skew the graphic state.

Parameters
$angleX : float

Angle to x-axis in degrees

$angleY : float

Angle to y-axis in degrees

$x : int

Points to stretch on x-axis

$y : int

Point to stretch on y-axis

text()

Returns the text state helper.

toUserSpace()

Returns the user space coordinates vector.

Parameters
$vector : SetaPDF_Core_Geometry_Vector
 

translate()

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

Move the graphic state by $shiftX and $shiftY on x-axis and y-axis.

Parameters
$shiftX : int|float

Points to move on x-axis

$shiftY : int|float

Points to move on y-axis