/** * Writes text to an image. * * @param string $text The text to be written. * @param int $coordX The X coordinate for text placement. * @param int $coordY The Y coordinate for text placement. * @param int $size The font size. * @param int $angle The angle. * * @return $this * @throws UnsupportedMethodException */ public function annotate($text, $coordX, $coordY, $size = null, $angle = 0) { if (!$this->resource instanceof ImageWritableInterface) { throw new UnsupportedMethodException("This method is not supported by the ImageResource in use."); } $drawer = $this->getDrawer(); if ($size) { $drawer->setFontSize($size); } $this->resource->annotate($text, $coordX, $coordY, $angle, $drawer); return $this; }