public function text(&$image, $text, $size = 12, $x = 0, $y = 0, $color = null, $font = '', $angle = 0)
{
if ($image->isAnimated()) {
// Ignore animated GIF for now
return $this;
}
$y += $size;
$color = $color !== null ? $color : new Color('#000000');
$font = $font !== '' ? $font : Grafika::fontsDir() . DIRECTORY_SEPARATOR . 'LiberationSans-Regular.ttf';
list($r, $g, $b, $alpha) = $color->getRgba();
// Set up draw properties
$draw = new \ImagickDraw();
// Text color
$draw->setFillColor(new \ImagickPixel("rgba({$r}, {$g}, {$b}, {$alpha})"));
// Font properties
$draw->setFont($font);
$draw->setFontSize($size);
// Write text
$image->getCore()->annotateImage($draw, $x, $y, $angle, $text);
return $this;
}