SetaPDF_Core_Canvas_GraphicState A canvas helper class for graphicState operators

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

Class hierarchy

Summary

Static Properties

$_maxGraphicStateNestingLevel

The maximum nesting level of the graphic states (default = 28).

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()

static public integer SetaPDF_Core_Canvas_GraphicState::getMaxGraphicStateNestingLevel ( void )

Get the maximum nesting level of graphic states.

setMaxGraphicStateNestingLevel()

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

Set the maximum nesting level of graphic states.

Parameters
$maxGraphicStateNestingLevel : integer
 

Methods

__construct()

public SetaPDF_Core_Canvas_GraphicState::__construct ( [ SetaPDF_Core_Geometry_Matrix $matrix = null ] )

The constructor.

Parameters
$matrix : SetaPDF_Core_Geometry_Matrix
 

_getCurrent()

protected mixed SetaPDF_Core_Canvas_GraphicState::_getCurrent ( void )

Get the current state of the stack.

addCurrentTransformationMatrix()

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

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()

public SetaPDF_Core_Geometry_Matrix SetaPDF_Core_Canvas_GraphicState::getCurrentTransformationMatrix ( void )

Get the current transformation matrix.

getUserSpaceXY()

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

Returns the user space coordinates.

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

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

restore()

public SetaPDF_Core_Canvas_GraphicState SetaPDF_Core_Canvas_GraphicState::restore ( void )

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 SetaPDF_Core_Canvas_GraphicState::rotate ( int|float $x, int|float $y, float $angle )

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()

public SetaPDF_Core_Canvas_GraphicState SetaPDF_Core_Canvas_GraphicState::save ( void )

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 SetaPDF_Core_Canvas_GraphicState::scale ( int|float $scaleX, int|float $scaleY )

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 SetaPDF_Core_Canvas_GraphicState::skew ( float $angleX, float $angleY [, int $x = 0 [, int $y = 0 ]] )

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()

public SetaPDF_Core_Canvas_GraphicState_Text SetaPDF_Core_Canvas_GraphicState::text ( void )

Returns the text state helper.

toUserSpace()

public SetaPDF_Core_Geometry_Vector SetaPDF_Core_Canvas_GraphicState::toUserSpace ( SetaPDF_Core_Geometry_Vector $vector )

Returns the user space coordinates vector.

Parameters
$vector : SetaPDF_Core_Geometry_Vector
 

translate()

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

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