Table of contents
Namespace: Com\Tecnick\Pdf\Graph
class Draw extends Gradient
Extends: Gradient
Source: src/Draw.php:39
Methods
getArrow()
Draws an arrow.
public getArrow(
float $posx0,
float $posy0,
float $posx1,
float $posy1,
int $headmode = 0,
float $armsize = 5,
float $armangle = 15,
StyleDataOpt $style = []
): string
Parameters:
$posx0(float): Abscissa of first point.$posy0(float): Ordinate of first point.$posx1(float): Abscissa of second point (head side).$posy1(float): Ordinate of second point (head side)$headmode(int): Arrow head mode: 0 = head arms only; 1 = closed head without filling; 2 = closed and filled head; 3 = filled head.$armsize(float): Length of head arms.$armangle(float): Angle in degrees between an head arm and the arrow shaft.$style(StyleDataOpt): Line style to apply.
Returns: string: PDF command
Source: src/Draw.php:649
getBasicPolygon()
Draws a basic polygon.
public getBasicPolygon(
float[] $points,
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = []
): string
Parameters:
$points(float[]): Points - array containing 4 points for each segment: (x0, y0, x1, y1, x2, y2, …)$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.
Returns: string: PDF command
Source: src/Draw.php:263
getCircle()
Draws a circle.
A circle is formed from n Bezier curves.
public getCircle(
float $posx,
float $posy,
float $rad,
float $angs = 0,
float $angf = 360,
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = [],
int $ncv = 2
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$rad(float): Radius.$angs(float): Angle in degrees at which starting drawing.$angf(float): Angle in degrees at which stop drawing.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.$ncv(int): Number of curves used to draw a 90 degrees portion of ellipse.
Returns: string: PDF command, or an empty string if the radius describes no arc.
Source: src/Draw.php:206
getCmykRegistrationMark()
Get a CMYK registration mark.
public getCmykRegistrationMark(float $posx, float $posy, float $rad): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$rad(float): Radius.
Returns: string: PDF command
Source: src/Draw.php:773
getCurve()
Draws a Bezier curve.
The Bezier curve is a tangent to the line between the control points at either end of the curve.
public getCurve(
float $posx0,
float $posy0,
float $posx1,
float $posy1,
float $posx2,
float $posy2,
float $posx3,
float $posy3,
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = []
): string
Parameters:
$posx0(float): Abscissa of start point.$posy0(float): Ordinate of start point.$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.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.
Returns: string: PDF command
Source: src/Draw.php:81
getEllipse()
Draws an ellipse.
An ellipse is formed from n Bezier curves.
public getEllipse(
float $posx,
float $posy,
float $hrad,
float $vrad = 0,
float $angle = 0,
float $angs = 0,
float $angf = 360,
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = [],
int $ncv = 2
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$hrad(float): Horizontal radius.$vrad(float): Vertical radius (if = 0 then it is a circle).$angle(float): Angle oriented (anti-clockwise). Default value: 0.$angs(float): Angle in degrees at which starting drawing.$angf(float): Angle in degrees at which stop drawing.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.$ncv(int): Number of curves used to draw a 90 degrees portion of ellipse.
Returns: string: PDF command, or an empty string if the radii describe no arc.
Source: src/Draw.php:157
getLine()
Draws a line between two points.
public getLine(
float $posx1,
float $posy1,
float $posx2,
float $posy2,
StyleDataOpt $style = []
): string
Parameters:
$posx1(float): Abscissa of first point.$posy1(float): Ordinate of first point.$posx2(float): Abscissa of second point.$posy2(float): Ordinate of second point.$style(StyleDataOpt): Line style to apply.
Returns: string: PDF command
Source: src/Draw.php:52
getPieSector()
Draws a circle pie sector.
public getPieSector(
float $posx,
float $posy,
float $rad,
float $angs = 0,
float $angf = 360,
string|PathPaintOp $mode = 'FD',
StyleDataOpt $style = [],
int $ncv = 2
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$rad(float): Radius.$angs(float): Angle in degrees at which starting drawing.$angf(float): Angle in degrees at which stop drawing.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.$ncv(int): Number of curves used to draw a 90 degrees portion of ellipse.
Returns: string: PDF command, or an empty string if the radius describes no arc.
Source: src/Draw.php:233
getPolycurve()
Draws a poly-Bezier curve.
Each Bezier curve segment is a tangent to the line between the control points at either end of the curve.
public getPolycurve(
float $posx0,
float $posy0,
float[][] $segments,
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = []
): string
Parameters:
$posx0(float): Abscissa of start point.$posy0(float): Ordinate of start point.$segments(float[][]): An array of bezier descriptions. Format: array(x1, y1, x2, y2, x3, y3).$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.
Returns: string: PDF command
Source: src/Draw.php:113
getPolygon()
Draws a polygon with a different style for each segment.
public getPolygon(
float[] $points,
string|PathPaintOp $mode = 'S',
array<int|string,StyleDataOpt> $styles = []
): string
Parameters:
$points(float[]): Points - array with values (x0, y0, x1, y1,…, x(n-1), y(n-1))$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$styles(array<int|string,StyleDataOpt>): Array of styles - one style entry for each polygon segment and/or one global “all” entry.
Returns: string: PDF command
Source: src/Draw.php:310
getRect()
Draws a rectangle with a different style for each segment.
public getRect(
float $posx,
float $posy,
float $width,
float $height,
string|PathPaintOp $mode = 'S',
array<int|string,StyleDataOpt> $styles = []
): string
Parameters:
$posx(float): Abscissa of upper-left corner.$posy(float): Ordinate of upper-left corner.$width(float): Width.$height(float): Height.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$styles(array<int|string,StyleDataOpt>): Array of styles - one style entry for each side (T,R,B,L) and/or one global “all” entry.
Returns: string: PDF command
Source: src/Draw.php:512
getRegistrationMark()
Get a registration mark.
public getRegistrationMark(
float $posx,
float $posy,
float $rad,
bool $double = false,
string $color = 'all'
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$rad(float): Radius.$double(bool): If true prints two concentric crop marks.$color(string): Color.
Returns: string: PDF command
Throws:
Source: src/Draw.php:707
getRegularPolygon()
Draws a regular polygon.
public getRegularPolygon(
float $posx,
float $posy,
float $radius,
int $sides,
float $angle = 0,
string|PathPaintOp $mode = 'S',
array<int|string,StyleDataOpt> $styles = [],
string|PathPaintOp $cirmode = '',
StyleDataOpt $cirstyle = []
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$radius(float): Radius of inscribed circle.$sides(int): Number of sides.$angle(float): Angle of the orientation (anti-clockwise).$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$styles(array<int|string,StyleDataOpt>): Array of styles - one style entry for each polygon segment and/or one global “all” entry.$cirmode(string|PathPaintOp): Mode of rendering of the inscribed circle (if any). @see getPathPaintOp()$cirstyle(StyleDataOpt): Style of inscribed circle.
Returns: string: PDF command
Source: src/Draw.php:409
getRoundedRect()
Draws a rounded rectangle.
public getRoundedRect(
float $posx,
float $posy,
float $width,
float $height,
float $hrad,
float $vrad,
string $corner = '1111',
string|PathPaintOp $mode = 'S',
StyleDataOpt $style = []
): string
Parameters:
$posx(float): Abscissa of upper-left corner.$posy(float): Ordinate of upper-left corner.$width(float): Width.$height(float): Height.$hrad(float): X-axis radius of the ellipse used to round off the corners of the rectangle.$vrad(float): Y-axis radius of the ellipse used to round off the corners of the rectangle.$corner(string): Round corners to draw: 0 (square i-corner) or 1 (rounded i-corner) in i-position. Positions are in the following order: top right, bottom right, bottom left and top left.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.
Returns: string: PDF command
Source: src/Draw.php:555
getStarPolygon()
Draws a star polygon.
public getStarPolygon(
float $posx,
float $posy,
float $radius,
int $nvert,
int $ngaps,
float $angle = 0,
string|PathPaintOp $mode = 'S',
array<int|string,StyleDataOpt> $styles = [],
string|PathPaintOp $cirmode = '',
StyleDataOpt $cirstyle = []
): string
Parameters:
$posx(float): Abscissa of center point.$posy(float): Ordinate of center point.$radius(float): Radius of inscribed circle.$nvert(int): Number of vertices.$ngaps(int): Number of gaps (if ($ngaps % $nvert = 1) then is a regular polygon).$angle(float): Angle oriented (anti-clockwise).$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$styles(array<int|string,StyleDataOpt>): Array of styles - one style entry for each polygon segment and/or one global “all” entry.$cirmode(string|PathPaintOp): Mode of rendering of the inscribed circle (if any). @see getPathPaintOp()$cirstyle(StyleDataOpt): Style of inscribed circle.
Returns: string: PDF command
Source: src/Draw.php:460
Inherited members
From Base
- IDMATRIX: Identity matrix for transformations.
- MPI: Pi constant.
- __construct(): Initialize
- getDefaultStyle(): Returns the default style.
- getLastExtGStateID(): Returns the last extgstate ID to be used with XObjects.
- getObjectNumber(): Returns current PDF object number
- getOutExtGState(): Get the PDF output string for ExtGState
- getOutExtGStateResources(): Get the PDF output string for ExtGState Resource Dictionary
- getOutExtGStateResourcesByKeys(): Get the PDF output string for ExtGState Resource Dictionary for XObjects.
- getOutGradientResources(): Get the PDF output string for Gradients Resource Dictionary
- getOutGradientResourcesByKeys(): Returns the PDF command to output gradient resources.
- getOutGradientShaders(): Get the PDF output string for gradient shaders
- getTransparencyExtGStateNames(): Returns the resource names of the registered ExtGState objects that carry transparency: a fill or stroke alpha below 1, a blend mode other than Normal, or a soft mask.
- initStyle(): Initialize default style
- setKUnit(): Set unit of measure conversion ratio.
- setPageHeight(): Set page height and returns previous value.
- setPageWidth(): Set page width and returns previous value.
From Gradient
- getAlpha(): Set alpha for stroking (CA) and non-stroking (ca) operations.
- getBasicRect(): Draws a basic rectangle
- getClippingRect(): Rectangular clipping area.
- getColorRegistrationBar(): Paints registration bars with color transitions
- getCoonsPatchMesh(): Paints a coons patch mesh.
- getCoonsPatchMeshWithCoords(): Paints a coons patch mesh.
- getCropMark(): Get a crop-mark.
- getGradient(): Get a color gradient PDF command.
- getGradientsArray(): Returns the gradients array
- getGradientTransform(): Returns the transformation command that maps a gradient onto a rectangular area.
- getLastGradientID(): Returns the key of the last registered gradient, to be used with XObjects.
- getLinearGradient(): Get a linear colour gradient command.
- getOverprint(): Get overprint mode for stroking (OP) and non-stroking (op) painting operations.
- getRadialGradient(): Get a radial colour gradient command.
From Raw
- getRawCurve(): Append a cubic Bezier curve to the current path.
- getRawCurveV(): Append a cubic Bezier curve to the current path.
- getRawCurveY(): Append a cubic Bezier curve to the current path.
- getRawEllipticalArc(): Append an elliptical arc to the current path.
- getRawLine(): Append a straight line segment from the current point to the specified one.
- getRawPoint(): Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment.
- 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.
- getVectorsAngle(): Returns the angle in radians between two vectors with the same origin point.
From Style
- add(): Add a new style
- getCurrentStyleArray(): Returns the last style array.
- getCurrentStyleItem(): Returns the value of the specified item from the last inserted style.
- getExtGState(): Add transparency parameters to the current extgstate.
- getLastStyleProperty(): Returns the last set value of the specified property.
- getModeWithClose(): Add the Close option to the specified Path paint operator.
- getModeWithoutClose(): Remove the Close option from the specified Path paint operator.
- getModeWithoutFill(): Remove the Fill option from the specified Path paint operator.
- getModeWithoutStroke(): Remove the Stroke option from the specified Path paint operator.
- getPathPaintOp(): Get the Path-Painting Operators.
- getStyle(): Returns the PDF string of the last style added.
- getStyleCmd(): Returns the PDF string of the specified style.
- isClippingMode(): Returns true if the specified mode is of clipping type.
- isClosingMode(): Returns true if the specified mode includes “closing the path” option.
- isFillingMode(): Returns true if the specified path paint operator includes the filling option.
- isStrokingMode(): Returns true if the specified mode includes the stroking option.
- pop(): Remove and return last style.
- restoreStyleStatus(): Restore the saved style status.
- saveStyleStatus(): Save the current style ID to be restored later.
From Transform
- degToRad(): Converts the number in degrees to the radian equivalent.
- getCtmProduct(): Get the product of two Transformation Matrix.
- getHorizMirroring(): Horizontal Mirroring.
- getHorizScaling(): Horizontal Scaling.
- getHorizSkewing(): Skew horizontally.
- getHorizTranslation(): Translate graphic object horizontally.
- getPointMirroring(): Point reflection mirroring.
- getPropScaling(): Vertical and horizontal proportional Scaling.
- getReflection(): Reflection against a straight line through point (x, y) with the gradient angle (angle).
- getRotation(): Rotation.
- getScaling(): Vertical and horizontal non-proportional Scaling.
- getSkewing(): Skew.
- getStartTransform(): Starts a 2D transformation saving current graphic state.
- getStopTransform(): Stops a 2D transformation restoring previous graphic state.
- getTransformation(): Get the transformation matrix (CTM) PDF string.
- getTransformIndex(): Returns the transformation stack index.
- getTransformStack(): Returns the transformation stack.
- getTranslation(): Translate graphic object horizontally and vertically.
- getVertMirroring(): Vertical Mirroring.
- getVertScaling(): Vertical Scaling.
- getVertSkewing(): Skew vertically.
- getVertTranslation(): Translate graphic object vertically.