class Drawer implements DrawerInterface

Drawer implementation using the Imagick PHP extension.

Methods

__construct(Imagick $imagick)

No description

$this
arc(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, int $thickness = 1)

Draws an arc on a starting at a given x, y coordinates under a given start and end angles.

$this
chord(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, bool $fill = false, int $thickness = 1)

Same as arc, but also connects end points with a straight line.

$this
circle(PointInterface $center, int $radius, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws and circle with center at the given x, y coordinates, and given radius.

$this
ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws and ellipse with center at the given x, y coordinates, and given width and height.

$this
line(PointInterface $start, PointInterface $end, ColorInterface $color, int $thickness = 1)

Draws a line from start(x, y) to end(x, y) coordinates.

$this
pieSlice(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, bool $fill = false, int $thickness = 1)

Same as arc, but connects end points and the center.

$this
dot(PointInterface $position, ColorInterface $color)

Places a one pixel point at specific coordinates and fills it with specified color.

$this
rectangle(PointInterface $leftTop, PointInterface $rightBottom, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws a rectangle from left, top(x, y) to right, bottom(x, y) coordinates.

$this
polygon(array $coordinates, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws a polygon using array of x, y coordinates. Must contain at least three coordinates.

$this
text(string $string, AbstractFont $font, PointInterface $position, int $angle = 0, int $width = null)

Annotates image with specified text at a given position starting on the top left of the final text box.

Details

at line 37
__construct(Imagick $imagick)

Parameters

Imagick $imagick

at line 47
$this arc(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, int $thickness = 1)

Draws an arc on a starting at a given x, y coordinates under a given start and end angles.

Parameters

PointInterface $center
BoxInterface $size
int $start
int $end
ColorInterface $color
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::arc

at line 86
$this chord(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, bool $fill = false, int $thickness = 1)

Same as arc, but also connects end points with a straight line.

Parameters

PointInterface $center
BoxInterface $size
int $start
int $end
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::chord

at line 141
$this circle(PointInterface $center, int $radius, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws and circle with center at the given x, y coordinates, and given radius.

Parameters

PointInterface $center
int $radius
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::circle

at line 153
$this ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws and ellipse with center at the given x, y coordinates, and given width and height.

Parameters

PointInterface $center
BoxInterface $size
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::ellipse

at line 203
$this line(PointInterface $start, PointInterface $end, ColorInterface $color, int $thickness = 1)

Draws a line from start(x, y) to end(x, y) coordinates.

Parameters

PointInterface $start
PointInterface $end
ColorInterface $color
int $thickness

Return Value

$this

See also

DrawerInterface::line

at line 242
$this pieSlice(PointInterface $center, BoxInterface $size, int $start, int $end, ColorInterface $color, bool $fill = false, int $thickness = 1)

Same as arc, but connects end points and the center.

Parameters

PointInterface $center
BoxInterface $size
int $start
int $end
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::pieSlice

at line 282
$this dot(PointInterface $position, ColorInterface $color)

Places a one pixel point at specific coordinates and fills it with specified color.

Parameters

PointInterface $position
ColorInterface $color

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::dot

at line 313
$this rectangle(PointInterface $leftTop, PointInterface $rightBottom, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws a rectangle from left, top(x, y) to right, bottom(x, y) coordinates.

Parameters

PointInterface $leftTop
PointInterface $rightBottom
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::rectangle

at line 356
$this polygon(array $coordinates, ColorInterface $color, bool $fill = false, int $thickness = 1)

Draws a polygon using array of x, y coordinates. Must contain at least three coordinates.

Parameters

array $coordinates
ColorInterface $color
bool $fill
int $thickness

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::polygon

at line 403
$this text(string $string, AbstractFont $font, PointInterface $position, int $angle = 0, int $width = null)

Annotates image with specified text at a given position starting on the top left of the final text box.

The rotation is done CW

Parameters

string $string
AbstractFont $font
PointInterface $position
int $angle
int $width

Return Value

$this

Exceptions

RuntimeException

See also

DrawerInterface::text