- Classes
- Namespaces
- Interfaces
- Index

Imagine API
Class

# Imagine\Gmagick\Drawer

class Drawer implements DrawerInterface

Drawer implementation using the Gmagick PHP extension

## Methods

| __construct(Gmagick $gmagick) |
DrawerInterface | arc(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, integer $thickness = 1) Draws an arc on a starting at a given x, y coordinates under a given start and end angles |
DrawerInterface | chord(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, Boolean $fill = false, integer $thickness = 1) Same as arc, but also connects end points with a straight line |
DrawerInterface | ellipse(PointInterface $center, BoxInterface $size, Color $color, Boolean $fill = false, integer $thickness = 1) Draws and ellipse with center at the given x, y coordinates, and given width and height |
DrawerInterface | line(PointInterface $start, PointInterface $end, Color $color, integer $thickness = 1) Draws a line from start(x, y) to end(x, y) coordinates |
DrawerInterface | pieSlice(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, Boolean $fill = false, integer $thickness = 1) Same as arc, but connects end points and the center |
DrawerInterface | dot(PointInterface $position, Color $color) Places a one pixel point at specific coordinates and fills it with specified color |
DrawerInterface | polygon(array $coordinates, Color $color, Boolean $fill = false, integer $thickness = 1) Draws a polygon using array of x, y coordinates. |
DrawerInterface | text(string $string, AbstractFont $font, PointInterface $position, integer $angle) Annotates image with specified text at a given position starting on the top left of the final text box |

## Details

###
at line 36
`public __construct(Gmagick $gmagick)`

#### Parameters

Gmagick | $gmagick |

###
at line 44
`public DrawerInterface arc(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, integer $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 |
integer | $start |
integer | $end |
Color | $color |
integer | $thickness |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 84
`public DrawerInterface chord(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, Boolean $fill = false, integer $thickness = 1)`

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

#### Parameters

PointInterface | $center |
BoxInterface | $size |
integer | $start |
integer | $end |
Color | $color |
Boolean | $fill |
integer | $thickness |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 130
`public DrawerInterface ellipse(PointInterface $center, BoxInterface $size, Color $color, Boolean $fill = false, integer $thickness = 1)`

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

#### Parameters

PointInterface | $center |
BoxInterface | $size |
Color | $color |
Boolean | $fill |
integer | $thickness |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 173
`public DrawerInterface line(PointInterface $start, PointInterface $end, Color $color, integer $thickness = 1)`

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

#### Parameters

PointInterface | $start |
PointInterface | $end |
Color | $color |
integer | $thickness |

#### Return Value

DrawerInterface |

###
at line 206
`public DrawerInterface pieSlice(PointInterface $center, BoxInterface $size, integer $start, integer $end, Color $color, Boolean $fill = false, integer $thickness = 1)`

Same as arc, but connects end points and the center

#### Parameters

PointInterface | $center |
BoxInterface | $size |
integer | $start |
integer | $end |
Color | $color |
Boolean | $fill |
integer | $thickness |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 240
`public DrawerInterface dot(PointInterface $position, Color $color)`

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

#### Parameters

PointInterface | $position |
Color | $color |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 269
`public DrawerInterface polygon(array $coordinates, Color $color, Boolean $fill = false, integer $thickness = 1)`

Draws a polygon using array of x, y coordinates.

Must contain at least
three coordinates

#### Parameters

array | $coordinates |
Color | $color |
Boolean | $fill |
integer | $thickness |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |

###
at line 314
`public DrawerInterface text(string $string, AbstractFont $font, PointInterface $position, integer $angle)`

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 |
integer | $angle |

#### Return Value

DrawerInterface |

#### Exceptions

RuntimeException |