Draw

Draw API reference

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

From Gradient

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

From Transform