Table of contents
Namespace: Com\Tecnick\Pdf\Graph
abstract class Gradient extends Raw
Extends: Raw
Source: src/Gradient.php:41
Methods
getAlpha()
Set alpha for stroking (CA) and non-stroking (ca) operations.
public getAlpha(
float $stroking = 1,
string|BlendMode $bmv = 'Normal',
float|string $nonstroking = '',
bool $ais = false
): string
Parameters:
$stroking(float): Alpha value for stroking operations: real value from 0 (transparent) to 1 (opaque).$bmv(string|BlendMode): Blend mode, one of the following: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion, Hue, Saturation, Color, Luminosity.$nonstroking(float|string): Alpha value for non-stroking operations: real value from 0 (transparent) to 1 (opaque).$ais(bool): Alpha-Is-Shape flag set on the /AIS ExtGState key.
Returns: string: PDF command
Source: src/Gradient.php:828
getBasicRect()
Draws a basic rectangle
public getBasicRect(
float $posx,
float $posy,
float $width,
float $height,
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.$mode(string|PathPaintOp): Mode of rendering. @see getPathPaintOp()$style(StyleDataOpt): Style.
Returns: string: PDF command
Source: src/Gradient.php:65
getClippingRect()
Rectangular clipping area.
public getClippingRect(
float $posx,
float $posy,
float $width,
float $height,
bool $eoclip = false
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$eoclip(bool): If true, set clipping path using even-odd rule.
Returns: string: PDF command
Source: src/Gradient.php:201
getColorRegistrationBar()
Paints registration bars with color transitions
public getColorRegistrationBar(
float $posx,
float $posy,
float $width,
float $height,
bool $vertical = false,
array<int,string|string[]> $colors = [ // GRAY : black to white ['g(0%)', 'g(100%)'], // RGB : re…
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$vertical(bool): If true prints bar vertically, otherwise horizontally.$colors(array<int,string|string[]>): Array of colors to print: each entry is a color string or an array of two transition colors.
Returns: string: PDF command
Throws:
Source: src/Gradient.php:653
getCoonsPatchMesh()
Paints a coons patch mesh.
public getCoonsPatchMesh(
float $posx,
float $posy,
float $width,
float $height,
array{'f': int, 'points': float[], 'colors': array<int,array<string,float>>}[] $patch_array = [],
float $coords_min = 0.0,
float $coords_max = 1.0,
bool $antialias = false
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$patch_array(array{‘f’: int, ‘points’: float[], ‘colors’: array<int,array<string,float>>}[]): One entry for each patch: f = position of the patch (0 = first patch; 1, 2, 3 = right, top and left); points = pairs of coordinates (normally from 0 to 1) of the Bezier control points that define the patch: 12 pairs for the first patch, 8 pairs for the following ones, ignoring the coordinates already defined by the preceding patch. The first pair is the lower left edge point, the next is its right control point (control point 2), then the other points follow counter-clockwise around the patch in the order: control point 1, edge point, control point 2. The last pair is the left control point (control point 1) of the first edge point; colors = 4 colors for the first patch, 2 colors for the following ones.$coords_min(float): Minimum value used by the coordinates: smaller values are cut to coords_min.$coords_max(float): Maximum value used by the coordinates: greater values are cut to coords_max.$antialias(bool): Flag indicating whether to filter the shading function to prevent aliasing artifacts.
Returns: string: PDF command
Throws:
Source: src/Gradient.php:570
getCoonsPatchMeshWithCoords()
Paints a coons patch mesh.
public getCoonsPatchMeshWithCoords(
float $posx,
float $posy,
float $width,
float $height,
string $colll = 'yellow',
string $collr = 'blue',
string $colur = 'green',
string $colul = 'red',
float[] $coords = [0.0, 0.0, 0.33, 0.0, 0.67, 0.0, 1.0, 0.0, 1.0, 0.33, 1.0, 0…,
float $coords_min = 0.0,
float $coords_max = 1.0,
bool $antialias = false
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$colll(string): Lower-Left corner color.$collr(string): Lower-Right corner color.$colur(string): Upper-Right corner color.$colul(string): Upper-Left corner color.$coords(float[]): Coordinates of the 12 Bezier control points of the patch.$coords_min(float): Minimum value used by the coordinates: smaller values are cut to coords_min.$coords_max(float): Maximum value used by the coordinates: greater values are cut to coords_max.$antialias(bool): Flag indicating whether to filter the shading function to prevent aliasing artifacts.
Returns: string: PDF command
Throws:
Source: src/Gradient.php:441
getCropMark()
Get a crop-mark.
public getCropMark(
float $posx,
float $posy,
float $width,
float $height,
string $type = 'TBLR',
StyleDataOpt $style = []
): string
Parameters:
$posx(float): Abscissa of the crop-mark center.$posy(float): Ordinate of the crop-mark center.$width(float): Width of the crop-mark.$height(float): Height of the crop-mark.$type(string): Type of crop mark - one symbol per type: T = TOP, B = BOTTOM, L = LEFT, R = RIGHT$style(StyleDataOpt): Line style to apply.
Returns: string: PDF command
Source: src/Gradient.php:744
getGradient()
Get a color gradient PDF command.
When a stop is not fully opaque the command also selects the soft-mask ExtGState of the gradient, so the caller is responsible for wrapping it between “q” and “Q”.
public getGradient(
int $type,
float[] $coords,
array<int,array{'color': string, 'exponent'?: float, 'opacity'?: float, 'offset'?: float}> $stops,
string $bgcolor,
bool $antialias = false
): string
Parameters:
$type(int): Type of gradient: 2 = Axial shading; 3 = Radial shading.$coords(float[]): Array of coordinates: (x0, y0, x1, y1) for type 2, (fx, fy, cx, cy, r) for type 3.$stops(array<int,array{‘color’: string, ’exponent’?: float, ‘opacity’?: float, ‘offset’?: float}>): Gradient color stops (at least two entries): color = color; offset = (0 to 1) location along the gradient vector; opacity = (0 to 1) stop opacity; exponent = exponent of the exponential interpolation function (default = 1) used between the previous stop and this one, so the value set on the first stop is unused.$bgcolor(string): Background color.$antialias(bool): Flag indicating whether to filter the shading function to prevent aliasing artifacts.
Returns: string: PDF command
Throws:
Source: src/Gradient.php:259
getGradientsArray()
Returns the gradients array
public getGradientsArray(): array<int,GradientData>
Returns: array<int,GradientData>
Source: src/Gradient.php:48
getGradientTransform()
Returns the transformation command that maps a gradient onto a rectangular area.
public getGradientTransform(float $posx, float $posy, float $width, float $height): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.
Returns: string: PDF command
Source: src/Gradient.php:217
getLastGradientID()
Returns the key of the last registered gradient, to be used with XObjects.
This is the key accepted by getOutGradientResourcesByKeys(), not the PDF object number.
public getLastGradientID(): ?int
Returns: ?int
Source: src/Gradient.php:336
getLinearGradient()
Get a linear colour gradient command.
public getLinearGradient(
float $posx,
float $posy,
float $width,
float $height,
string $colorstart,
string $colorend,
float[] $coords = [0, 0, 1, 0]
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$colorstart(string): Starting color.$colorend(string): Ending color.$coords(float[]): Gradient vector (x1, y1, x2, y2).
Returns: string: PDF command
Throws:
Source: src/Gradient.php:91
getOverprint()
Get overprint mode for stroking (OP) and non-stroking (op) painting operations.
(Check the “Entries in a Graphics State Parameter Dictionary” on PDF 32000-1:2008).
public getOverprint(bool $stroking = true, bool|null $nonstroking = null, int $mode = 0): string
Parameters:
$stroking(bool): If true apply overprint for stroking operations.$nonstroking(bool|null): If true apply overprint for painting operations other than stroking.$mode(int): Overprint mode: 0 = each source colour component value replaces the value previously painted for the corresponding device colorant; 1 = a tint value of 0.0 for a source colour component leaves the corresponding component of the previously painted colour unchanged.
Returns: string: PDF command
Source: src/Gradient.php:800
getRadialGradient()
Get a radial colour gradient command.
public getRadialGradient(
float $posx,
float $posy,
float $width,
float $height,
string $colorstart,
string $colorend,
float[] $coords = [0.5, 0.5, 0.5, 0.5, 1]
): string
Parameters:
$posx(float): Abscissa of the top left corner of the rectangle.$posy(float): Ordinate of the top left corner of the rectangle.$width(float): Width of the rectangle.$height(float): Height of the rectangle.$colorstart(string): Starting color.$colorend(string): Ending color.$coords(float[]): Array of the form (fx, fy, cx, cy, r) where (fx, fy) is the starting point of the gradient with $colorstart (which should be inside the circle), (cx, cy) is the center of the circle with $colorend, and r is the radius of the circle.
Returns: string: PDF command
Throws:
Source: src/Gradient.php:123
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 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.