Raw extends Transform
in package
Com\Tecnick\Pdf\Graph\Raw
Tags
Table of Contents
Constants
- IDMATRIX = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]
- Identity matrix for transformations.
- MPI = 3.141592653589793
- Pi constant We use this instead of M_PI because HHVM has a different value.
Methods
- __construct() : mixed
- Initialize
- add() : string
- Add a new style
- degToRad() : float
- Converts the number in degrees to the radian equivalent.
- getCtmProduct() : TTMatrix
- Get the product of two Tranformation Matrix.
- getCurrentStyleArray() : StyleDataOpt
- Returns the last style array.
- getCurrentStyleItem() : mixed
- Returns the value of th especified item from the last inserted style.
- getDefaultStyle() : StyleData
- Returns the default style.
- getExtGState() : string
- Add transparency parameters to the current extgstate.
- getHorizMirroring() : string
- Horizontal Mirroring.
- getHorizScaling() : string
- Horizontal Scaling.
- getHorizSkewing() : string
- Skew horizontally.
- getHorizTranslation() : string
- Translate graphic object horizontally.
- getLastExtGStateID() : int|null
- Returns the last extgstate ID to be used with XOBjects.
- getLastStyleProperty() : int|float|bool|string|null
- Returns the last set value of the specified property.
- getModeWithoutClose() : string
- Remove the Close option from the specified Path paint operator.
- getModeWithoutFill() : string
- Remove the Fill option from the specified Path paint operator.
- getModeWithoutStroke() : string
- Remove the Stroke option from the specified Path paint operator.
- getObjectNumber() : int
- Returns current PDF object number
- getOutExtGState() : string
- Get the PDF output string for ExtGState
- getOutExtGStateResources() : string
- Get the PDF output string for ExtGState Resource Dictionary
- getOutExtGStateResourcesByKeys() : string
- Get the PDF output string for ExtGState Resource Dictionary for XOBjects.
- getOutGradientResources() : string
- Get the PDF output string for Gradients Resource Dictionary
- getOutGradientResourcesByKeys() : string
- Returns the PDF command to output gradient resources.
- getOutGradientShaders() : string
- Get the PDF output string for gradient shaders
- getPathPaintOp() : string
- Get the Path-Painting Operators.
- getPointMirroring() : string
- Point reflection mirroring.
- getPropScaling() : string
- Vertical and horizontal proportional Scaling.
- getRawCurve() : string
- Append a cubic Bezier curve to the current path.
- getRawCurveV() : string
- Append a cubic Bezier curve to the current path.
- getRawCurveY() : string
- Append a cubic Bezier curve to the current path.
- getRawEllipticalArc() : string
- Append an elliptical arc to the current path.
- getRawLine() : string
- Append a straight line segment from the current point to the specified one.
- getRawPoint() : string
- Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment.
- getRawRect() : string
- Append a rectangle to the current path as a complete subpath, with lower-left corner in the specified point and dimensions width and height in user units.
- getReflection() : string
- Reflection against a straight line through point (x, y) with the gradient angle (angle).
- getRotation() : string
- Rotation.
- getScaling() : string
- Vertical and horizontal non-proportional Scaling.
- getSkewing() : string
- Skew.
- getStartTransform() : string
- Starts a 2D transformation saving current graphic state.
- getStopTransform() : string
- Stops a 2D tranformation restoring previous graphic state.
- getStyle() : string
- Returns the PDF string of the last style added.
- getStyleCmd() : string
- Returns the PDF string of the specified style.
- getTransformation() : string
- Get the tranformation matrix (CTM) PDF string
- getTransformIndex() : int
- Returns the transformation stack index.
- getTransformStack() : array<int, array<int, TTMatrix>>
- Returns the transformation stack.
- getTranslation() : string
- Translate graphic object horizontally and vertically.
- getVectorsAngle() : float
- Returns the angle in radiants between two vectors with the same origin point.
- getVertMirroring() : string
- Verical Mirroring.
- getVertScaling() : string
- Vertical Scaling.
- getVertSkewing() : string
- Skew vertically.
- getVertTranslation() : string
- Translate graphic object vertically.
- initStyle() : void
- Initialize default style
- isClippingMode() : bool
- Returns true if the specified mode is of clippping type.
- isClosingMode() : bool
- Returns true if the specified mode includes "closing the path" option.
- isFillingMode() : bool
- Returns true if the specified path paint operator includes the filling option.
- isStrokingMode() : bool
- Returns true if the specified mode includes the stroking option.
- pop() : string
- Remove and return last style.
- restoreStyleStatus() : void
- Restore the saved style status.
- saveStyleStatus() : void
- Save the current style ID to be restored later.
- setKUnit() : static
- Set unit of measure conversion ratio.
- setPageHeight() : static
- Set page height
- setPageWidth() : static
- Set page width
Constants
IDMATRIX
Identity matrix for transformations.
public TTMatrix
IDMATRIX =
[1.0, 0.0,
0.0, 1.0, 0.0, 0.0]
MPI
Pi constant We use this instead of M_PI because HHVM has a different value.
public float MPI = 3.141592653589793
Methods
__construct()
Initialize
public __construct(float $kunit,
float $pagew,
float $pageh,
Pdf $pdfColor,
Encrypt $encrypt[,
bool $pdfa
= false
][,
bool $compress
= true
]) : mixed
Parameters
- $kunit : float
-
Unit of measure conversion ratio.
- $pagew : float
-
Page width.
- $pageh : float
-
Page height.
- $pdfColor : Pdf
-
Color object.
- $encrypt : Encrypt
- $pdfa : bool = false
-
True if we are in PDF/A mode.
- $compress : bool = true
-
Set to false to disable stream compression.
add()
Add a new style
public add([StyleDataOpt $style
= []
][,
bool $inheritlast
= false
]) : string
Parameters
- $style : StyleDataOpt = []
-
Style to add.
- $inheritlast : bool = false
-
If true inherit missing values from the last style.
Return values
string —PDF style string
degToRad()
Converts the number in degrees to the radian equivalent.
public degToRad(float $deg)
: float
We use this instead of $this->degToRad to avoid precision problems with hhvm.
Parameters
- $deg : float
-
Angular value in degrees.
Return values
float —Angle in radiants
getCtmProduct()
Get the product of two Tranformation Matrix.
public getCtmProduct(TTMatrix $tma,
TTMatrix $tmb)
: TTMatrix
Parameters
- $tma : TTMatrix
-
First Tranformation Matrix.
- $tmb : TTMatrix
-
Second Tranformation Matrix.
Return values
TTMatrix —CTM Transformation Matrix.
getCurrentStyleArray()
Returns the last style array.
public getCurrentStyleArray()
: StyleDataOpt
Return values
StyleDataOptgetCurrentStyleItem()
Returns the value of th especified item from the last inserted style.
public getCurrentStyleItem(string $item)
: mixed
Parameters
- $item : string
-
Item to search.
getDefaultStyle()
Returns the default style.
public getDefaultStyle([StyleDataOpt $style
= []
]) : StyleData
Parameters
- $style : StyleDataOpt = []
-
Style parameters to merge to the default ones.
Return values
StyleDatagetExtGState()
Add transparency parameters to the current extgstate.
public getExtGState(array<string,
int|float|bool|string> $parms)
: string
Parameters
- $parms : array<string, int|float|bool|string>
-
parameters.
Return values
string —PDF command.
getHorizMirroring()
Horizontal Mirroring.
public getHorizMirroring(float $posx)
: string
Parameters
- $posx : float
-
Abscissa of the mirroring line.
Return values
string —Transformation string
getHorizScaling()
Horizontal Scaling.
public getHorizScaling(float $skx,
float $posx,
float $posy)
: string
Parameters
- $skx : float
-
Horizontal scaling factor.
- $posx : float
-
Abscissa of the scaling center.
- $posy : float
-
Ordinate of the scaling center.
Return values
string —Transformation string
getHorizSkewing()
Skew horizontally.
public getHorizSkewing(float $angx,
float $posx,
float $posy)
: string
Parameters
- $angx : float
-
Angle in degrees between -90 (skew to the left) and 90 (skew to the right)
- $posx : float
-
Abscissa of the skewing center.
- $posy : float
-
Ordinate of the skewing center.
Return values
string —Transformation string
getHorizTranslation()
Translate graphic object horizontally.
public getHorizTranslation(float $trx)
: string
Parameters
- $trx : float
-
Movement to the right.
Return values
string —Transformation string
getLastExtGStateID()
Returns the last extgstate ID to be used with XOBjects.
public getLastExtGStateID()
: int|null
Return values
int|nullgetLastStyleProperty()
Returns the last set value of the specified property.
public getLastStyleProperty(string $property[,
int|float|bool|string|null $default
= null
]) : int|float|bool|string|null
Parameters
- $property : string
-
Property to search.
- $default : int|float|bool|string|null = null
-
Default value to return in case the property is not found.
Return values
int|float|bool|string|null —Property value or $default in case the property is not found.
getModeWithoutClose()
Remove the Close option from the specified Path paint operator.
public getModeWithoutClose(string $mode)
: string
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
stringgetModeWithoutFill()
Remove the Fill option from the specified Path paint operator.
public getModeWithoutFill(string $mode)
: string
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
stringgetModeWithoutStroke()
Remove the Stroke option from the specified Path paint operator.
public getModeWithoutStroke(string $mode)
: string
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
stringgetObjectNumber()
Returns current PDF object number
public getObjectNumber()
: int
Return values
intgetOutExtGState()
Get the PDF output string for ExtGState
public getOutExtGState(int $pon)
: string
Parameters
- $pon : int
-
Current PDF Object Number
Return values
string —PDF command
getOutExtGStateResources()
Get the PDF output string for ExtGState Resource Dictionary
public getOutExtGStateResources()
: string
Return values
string —PDF command
getOutExtGStateResourcesByKeys()
Get the PDF output string for ExtGState Resource Dictionary for XOBjects.
public getOutExtGStateResourcesByKeys(array<string|int,
int> $keys)
: string
Parameters
- $keys : array<string|int, int>
-
Array of extgstates keys.
Return values
string —PDF command
getOutGradientResources()
Get the PDF output string for Gradients Resource Dictionary
public getOutGradientResources()
: string
Return values
string —PDF command
getOutGradientResourcesByKeys()
Returns the PDF command to output gradient resources.
public getOutGradientResourcesByKeys(array<string|int,
int> $keys)
: string
Parameters
- $keys : array<string|int, int>
-
Array of gradient keys.
Return values
string —PDF command
getOutGradientShaders()
Get the PDF output string for gradient shaders
public getOutGradientShaders(int $pon)
: string
Parameters
- $pon : int
-
Current PDF Object Number
Return values
string —PDF command
getPathPaintOp()
Get the Path-Painting Operators.
public getPathPaintOp(string $mode[,
string $default
= 'S'
]) : string
Parameters
- $mode : string
-
Mode of rendering. Possible values are:
- S or D: Stroke the path. - s or d: Close and stroke the path. - f or F: Fill the path, using the nonzero winding number rule to determine the region to fill. - f* or F*: Fill the path, using the even-odd rule to determine the region to fill. - B or FD or DF: Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill. - B* or FD or DF: Fill and then stroke the path, using the even-odd rule to determine the region to fill. - b or fd or df: Close, fill, and then stroke the path, using the nonzero winding number rule to determine the region to fill. - b or fd or df: Close, fill, and then stroke the path, using the even-odd rule to determine the region to fill. - CNZ: Clipping mode using the even-odd rule to determine which regions lie inside the clipping path. - CEO: Clipping mode using the nonzero winding number rule to determine which regions lie inside the clipping path - n: End the path object without filling or stroking it.
- $default : string = 'S'
-
Default style
Return values
stringgetPointMirroring()
Point reflection mirroring.
public getPointMirroring(float $posx,
float $posy)
: string
Parameters
- $posx : float
-
Abscissa of the mirroring point.
- $posy : float
-
Ordinate of the mirroring point.
Return values
string —Transformation string
getPropScaling()
Vertical and horizontal proportional Scaling.
public getPropScaling(float $skf,
float $posx,
float $posy)
: string
Parameters
- $skf : float
-
Scaling factor.
- $posx : float
-
Abscissa of the scaling center.
- $posy : float
-
Ordinate of the scaling center.
Return values
string —Transformation string
getRawCurve()
Append a cubic Bezier curve to the current path.
public getRawCurve(float $posx1,
float $posy1,
float $posx2,
float $posy2,
float $posx3,
float $posy3)
: string
The curve shall extend from the current point to the point (posx3, posy3), using (posx1, posy1) and (posx2, posy2) as the Bezier control points. The new current point shall be (posx3, posy3).
Parameters
- $posx1 : float
-
Abscissa of control point 1.
- $posy1 : float
-
Ordinate of control point 1.
- $posx2 : float
-
Abscissa of control point 2.
- $posy2 : float
-
Ordinate of control point 2.
- $posx3 : float
-
Abscissa of end point.
- $posy3 : float
-
Ordinate of end point.
Return values
string —PDF command
getRawCurveV()
Append a cubic Bezier curve to the current path.
public getRawCurveV(float $posx2,
float $posy2,
float $posx3,
float $posy3)
: string
The curve shall extend from the current point to the point (posx3, posy3), using the current point and (posx2, posy2) as the Bezier control points. The new current point shall be (posx3, posy3).
Parameters
- $posx2 : float
-
Abscissa of control point 2.
- $posy2 : float
-
Ordinate of control point 2.
- $posx3 : float
-
Abscissa of end point.
- $posy3 : float
-
Ordinate of end point.
Return values
string —PDF command
getRawCurveY()
Append a cubic Bezier curve to the current path.
public getRawCurveY(float $posx1,
float $posy1,
float $posx3,
float $posy3)
: string
The curve shall extend from the current point to the point (posx3, posy3), using (posx1, posy1) and (posx3, posy3) as the Bezier control points. The new current point shall be (posx3, posy3).
Parameters
- $posx1 : float
-
Abscissa of control point 1.
- $posy1 : float
-
Ordinate of control point 1.
- $posx3 : float
-
Abscissa of end point.
- $posy3 : float
-
Ordinate of end point.
Return values
string —PDF command
getRawEllipticalArc()
Append an elliptical arc to the current path.
public getRawEllipticalArc(float $posxc,
float $posyc,
float $rdh,
float $rdv[,
float $posxang
= 0.0
][,
float $angs
= 0.0
][,
float $angf
= 360.0
][,
bool $pie
= false
][,
float $ncv
= 2
][,
bool $startpoint
= true
][,
bool $ccw
= true
][,
bool $svg
= false
][,
array<string|int,
int> &$bbox
= []
]) : string
An ellipse is formed from n Bezier curves.
Parameters
- $posxc : float
-
Abscissa of center point.
- $posyc : float
-
Ordinate of center point.
- $rdh : float
-
Horizontal radius.
- $rdv : float
-
Vertical radius (if = 0 then it is a circle).
- $posxang : float = 0.0
-
Angle between the X-axis and the major axis of the ellipse.
- $angs : float = 0.0
-
Angle in degrees at which starting drawing.
- $angf : float = 360.0
-
Angle in degrees at which stop drawing.
- $pie : bool = false
-
If true do not mark the border point (used to draw pie sectors).
- $ncv : float = 2
-
Number of curves used to draw a 90 degrees portion of ellipse.
- $startpoint : bool = true
-
If true output a starting point.
- $ccw : bool = true
-
If true draws in counter-clockwise direction.
- $svg : bool = false
-
If true the angles are in svg mode (already calculated).
- $bbox : array<string|int, int> = []
-
If provided, it will be filled with the bounding box coordinates (x min, y min, x max, y max).
Tags
Return values
string —PDF command
getRawLine()
Append a straight line segment from the current point to the specified one.
public getRawLine(float $posx,
float $posy)
: string
The new current point shall be the one specified.
Parameters
- $posx : float
-
Abscissa of end point.
- $posy : float
-
Ordinate of end point.
Return values
string —PDF command
getRawPoint()
Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment.
public getRawPoint(float $posx,
float $posy)
: string
Parameters
- $posx : float
-
Abscissa of point.
- $posy : float
-
Ordinate of point.
Return values
string —PDF command
getRawRect()
Append a rectangle to the current path as a complete subpath, with lower-left corner in the specified point and dimensions width and height in user units.
public getRawRect(float $posx,
float $posy,
float $width,
float $height)
: string
Parameters
- $posx : float
-
Abscissa of upper-left corner.
- $posy : float
-
Ordinate of upper-left corner.
- $width : float
-
Width.
- $height : float
-
Height.
Return values
string —PDF command
getReflection()
Reflection against a straight line through point (x, y) with the gradient angle (angle).
public getReflection(float $ang,
float $posx,
float $posy)
: string
Parameters
- $ang : float
-
Gradient angle in degrees of the straight line.
- $posx : float
-
Abscissa of the mirroring point.
- $posy : float
-
Ordinate of the mirroring point.
Return values
string —Transformation string
getRotation()
Rotation.
public getRotation(float $angle,
float $posx,
float $posy)
: string
Parameters
- $angle : float
-
Angle in degrees for counter-clockwise rotation.
- $posx : float
-
Abscissa of the rotation center.
- $posy : float
-
Ordinate of the rotation center.
Return values
string —Transformation string
getScaling()
Vertical and horizontal non-proportional Scaling.
public getScaling(float $skx,
float $sky,
float $posx,
float $posy)
: string
Parameters
- $skx : float
-
Horizontal scaling factor.
- $sky : float
-
vertical scaling factor.
- $posx : float
-
Abscissa of the scaling center.
- $posy : float
-
Ordinate of the scaling center.
Return values
string —Transformation string
getSkewing()
Skew.
public getSkewing(float $angx,
float $angy,
float $posx,
float $posy)
: string
Parameters
- $angx : float
-
Angle in degrees between -90 (skew to the left) and 90 (skew to the right)
- $angy : float
-
Angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
- $posx : float
-
Abscissa of the skewing center.
- $posy : float
-
Ordinate of the skewing center.
Return values
string —Transformation string
getStartTransform()
Starts a 2D transformation saving current graphic state.
public getStartTransform()
: string
This function must be called before calling transformation methods
Return values
stringgetStopTransform()
Stops a 2D tranformation restoring previous graphic state.
public getStopTransform()
: string
This function must be called after calling transformation methods.
Return values
stringgetStyle()
Returns the PDF string of the last style added.
public getStyle()
: string
Return values
stringgetStyleCmd()
Returns the PDF string of the specified style.
public getStyleCmd([StyleDataOpt $style
= []
]) : string
Parameters
- $style : StyleDataOpt = []
-
Style to represent.
Return values
stringgetTransformation()
Get the tranformation matrix (CTM) PDF string
public getTransformation(TTMatrix $ctm)
: string
Parameters
- $ctm : TTMatrix
-
Transformation matrix array.
Return values
stringgetTransformIndex()
Returns the transformation stack index.
public getTransformIndex()
: int
Return values
intgetTransformStack()
Returns the transformation stack.
public getTransformStack()
: array<int,
array<int, TTMatrix>>
Return values
array<int, array<int, TTMatrix>>getTranslation()
Translate graphic object horizontally and vertically.
public getTranslation(float $trx,
float $try)
: string
Parameters
- $trx : float
-
Movement to the right.
- $try : float
-
Movement to the bottom.
Return values
string —Transformation string
getVectorsAngle()
Returns the angle in radiants between two vectors with the same origin point.
public getVectorsAngle(float $posx1,
float $posy1,
float $posx2,
float $posy2)
: float
Angles are counted counter-clock wise.
Parameters
- $posx1 : float
-
X coordinate of first vector point.
- $posy1 : float
-
Y coordinate of first vector point.
- $posx2 : float
-
X coordinate of second vector point.
- $posy2 : float
-
Y coordinate of second vector point.
Return values
float —Angle in radiants
getVertMirroring()
Verical Mirroring.
public getVertMirroring(float $posy)
: string
Parameters
- $posy : float
-
Ordinate of the mirroring line.
Return values
string —Transformation string
getVertScaling()
Vertical Scaling.
public getVertScaling(float $sky,
float $posx,
float $posy)
: string
Parameters
- $sky : float
-
vertical scaling factor.
- $posx : float
-
Abscissa of the scaling center.
- $posy : float
-
Ordinate of the scaling center.
Return values
string —Transformation string
getVertSkewing()
Skew vertically.
public getVertSkewing(float $angy,
float $posx,
float $posy)
: string
Parameters
- $angy : float
-
Angle in degrees between -90 (skew to the bottom) and 90 (skew to the top)
- $posx : float
-
Abscissa of the skewing center.
- $posy : float
-
Ordinate of the skewing center.
Return values
string —Transformation string
getVertTranslation()
Translate graphic object vertically.
public getVertTranslation(float $try)
: string
Parameters
- $try : float
-
Movement to the bottom.
Return values
string —Transformation string
initStyle()
Initialize default style
public initStyle()
: void
isClippingMode()
Returns true if the specified mode is of clippping type.
public isClippingMode(string $mode)
: bool
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
boolisClosingMode()
Returns true if the specified mode includes "closing the path" option.
public isClosingMode(string $mode)
: bool
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
boolisFillingMode()
Returns true if the specified path paint operator includes the filling option.
public isFillingMode(string $mode)
: bool
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
boolisStrokingMode()
Returns true if the specified mode includes the stroking option.
public isStrokingMode(string $mode)
: bool
Parameters
- $mode : string
-
Path paint operator (mode of rendering).
Return values
boolpop()
Remove and return last style.
public pop()
: string
Return values
string —PDF style string.
restoreStyleStatus()
Restore the saved style status.
public restoreStyleStatus()
: void
saveStyleStatus()
Save the current style ID to be restored later.
public saveStyleStatus()
: void
setKUnit()
Set unit of measure conversion ratio.
public setKUnit(float $kunit)
: static
Parameters
- $kunit : float
-
Unit of measure conversion ratio.
Return values
staticsetPageHeight()
Set page height
public setPageHeight(float $pageh)
: static
Parameters
- $pageh : float
-
Page height
Return values
staticsetPageWidth()
Set page width
public setPageWidth(float $pagew)
: static
Parameters
- $pagew : float
-
Page width