HumHub Documentation (unofficial)

Drawer
in package
implements AlphaBlendingAwareDrawerInterface, InfoProvider

FinalYes

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

getDriverInfo()

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
see
InfoProvider::getDriverInfo()
since
1.3.0
Return values
Info|null

polygon()

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
see
DrawerInterface::polygon()
Return values
$this

text()

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
see
DrawerInterface::text()
Return values
$this

applyAlphaBlending()

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
bool

revertAlphaBlending()

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
bool

        
On this page

Search results