Drawer
in package
implements
AlphaBlendingAwareDrawerInterface, InfoProvider
Drawer implementation using the GD PHP extension.
Table of Contents
Interfaces
- AlphaBlendingAwareDrawerInterface
- Interface for the drawers that support configuring the alpha blending.
- InfoProvider
- Interface implemented by classes that provide info about a graphics driver.
Properties
- $alphaBlending : bool
- $resource : resource|GdImage
Methods
- __construct() : mixed
- Constructs Drawer with a given gd image resource.
- arc() : $this
- Draws an arc on a starting at a given x, y coordinates under a given start and end angles.
- chord() : $this
- This function does not work properly because of a bug in GD.
- circle() : $this
- Draws and circle with center at the given x, y coordinates, and given radius.
- dot() : $this
- Places a one pixel point at specific coordinates and fills it with specified color.
- ellipse() : $this
- Draws and ellipse with center at the given x, y coordinates, and given width and height.
- getAlphaBlending() : bool
- Is the alpha blending activated?
- getDriverInfo() : Info|null
- Get the info about this driver.
- line() : $this
- Draws a line from start(x, y) to end(x, y) coordinates.
- pieSlice() : $this
- Same as arc, but connects end points and the center.
- polygon() : $this
- Draws a polygon using array of x, y coordinates. Must contain at least three coordinates.
- rectangle() : $this
- Draws a rectangle from left, top(x, y) to right, bottom(x, y) coordinates.
- setAlphaBlending() : $this
- Enable/disable the alpha blending.
- text() : $this
- Annotates image with specified text at a given position starting on the top left of the final text box.
- withAlphaBlending() : static
- Create a new instance of this drawer with the specified alpha blending value.
- applyAlphaBlending() : bool
- Apply the alpha blending value.
- revertAlphaBlending() : bool
- Revert the alpha blending value to the initial state.
- getColor() : resource
- Generates a GD color from Color instance.
Properties
$alphaBlending
private
bool
$alphaBlending
= true
$resource
private
resource|GdImage
$resource
Methods
__construct()
Constructs Drawer with a given gd image resource.
public
__construct(resource|GdImage $resource) : mixed
Parameters
- $resource : resource|GdImage
arc()
Draws an arc on a starting at a given x, y coordinates under a given start and end angles.
public
arc(PointInterface $center, BoxInterface $size, mixed $start, mixed $end, ColorInterface $color[, mixed $thickness = 1 ]) : $this
Parameters
- $center : PointInterface
- $size : BoxInterface
- $start : mixed
- $end : mixed
- $color : ColorInterface
- $thickness : mixed = 1
Tags
Return values
$thischord()
This function does not work properly because of a bug in GD.
public
chord(PointInterface $center, BoxInterface $size, mixed $start, mixed $end, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $center : PointInterface
- $size : BoxInterface
- $start : mixed
- $end : mixed
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thiscircle()
Draws and circle with center at the given x, y coordinates, and given radius.
public
circle(PointInterface $center, mixed $radius, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $center : PointInterface
- $radius : mixed
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thisdot()
Places a one pixel point at specific coordinates and fills it with specified color.
public
dot(PointInterface $position, ColorInterface $color) : $this
Parameters
- $position : PointInterface
- $color : ColorInterface
Tags
Return values
$thisellipse()
Draws and ellipse with center at the given x, y coordinates, and given width and height.
public
ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $center : PointInterface
- $size : BoxInterface
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thisgetAlphaBlending()
Is the alpha blending activated?
public
getAlphaBlending() : bool
Tags
Return values
boolgetDriverInfo()
Get the info about this driver.
public
static getDriverInfo([mixed $required = true ]) : Info|null
Parameters
- $required : mixed = true
-
when the driver is not available: if FALSE the function returns NULL, if TRUE the driver throws a \Imagine\Exception\NotSupportedException
Tags
Return values
Info|nullline()
Draws a line from start(x, y) to end(x, y) coordinates.
public
line(PointInterface $start, PointInterface $end, ColorInterface $color[, mixed $thickness = 1 ]) : $this
Parameters
- $start : PointInterface
- $end : PointInterface
- $color : ColorInterface
- $thickness : mixed = 1
Tags
Return values
$thispieSlice()
Same as arc, but connects end points and the center.
public
pieSlice(PointInterface $center, BoxInterface $size, mixed $start, mixed $end, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $center : PointInterface
- $size : BoxInterface
- $start : mixed
- $end : mixed
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thispolygon()
Draws a polygon using array of x, y coordinates. Must contain at least three coordinates.
public
polygon(array<string|int, mixed> $coordinates, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $coordinates : array<string|int, mixed>
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thisrectangle()
Draws a rectangle from left, top(x, y) to right, bottom(x, y) coordinates.
public
rectangle(PointInterface $leftTop, PointInterface $rightBottom, ColorInterface $color[, mixed $fill = false ][, mixed $thickness = 1 ]) : $this
Parameters
- $leftTop : PointInterface
- $rightBottom : PointInterface
- $color : ColorInterface
- $fill : mixed = false
- $thickness : mixed = 1
Tags
Return values
$thissetAlphaBlending()
Enable/disable the alpha blending.
public
setAlphaBlending(mixed $value) : $this
Parameters
- $value : mixed
Tags
Return values
$thistext()
Annotates image with specified text at a given position starting on the top left of the final text box.
public
text(mixed $string, AbstractFont $font, PointInterface $position[, mixed $angle = 0 ][, mixed $width = null ]) : $this
Parameters
- $string : mixed
- $font : AbstractFont
- $position : PointInterface
- $angle : mixed = 0
- $width : mixed = null
Tags
Return values
$thiswithAlphaBlending()
Create a new instance of this drawer with the specified alpha blending value.
public
withAlphaBlending(mixed $value) : static
Parameters
- $value : mixed
Tags
Return values
staticapplyAlphaBlending()
Apply the alpha blending value.
protected
applyAlphaBlending([resource|GdImage|null $to = null ]) : bool
Parameters
- $to : resource|GdImage|null = null
-
the GD image. If null we'll apply the alpha blending to the current resource.
Return values
boolrevertAlphaBlending()
Revert the alpha blending value to the initial state.
protected
revertAlphaBlending([resource|GdImage|null $to = null ]) : bool
Parameters
- $to : resource|GdImage|null = null
-
the GD image. If null we'll apply the alpha blending to the current resource.
Return values
boolgetColor()
Generates a GD color from Color instance.
private
getColor(ColorInterface $color) : resource
Parameters
- $color : ColorInterface