/** * {@inheritdoc} */ public function apply(CanvasInterface $canvas) { if (!$canvas->isHandlerSet()) { throw new CanvasEmptyException(); } $this->doApply($canvas); return $this; }
/** * Set watermark * * @param \Jaguar\CanvasInterface $watermark * * @return \Jaguar\Action\Watermark * * @throws \Jaguar\Exception\CanvasEmptyException */ public function setWatermark(CanvasInterface $watermark) { if (!$watermark->isHandlerSet()) { throw new CanvasEmptyException(); } $this->watermark = $watermark; return $this; }
/** * {@inheritdoc} */ public final function draw(CanvasInterface $canvas, StyleInterface $style = null) { if (!$canvas->isHandlerSet()) { throw new CanvasEmptyException(sprintf('Can Not Draw Drawable (%s) - Canvas Is Empty', (string) $this)); } @imagesetthickness($canvas->getHandler(), $this->getLineThickness()); $this->doDraw($canvas, $style); return $this; }
/** * {@inheritdoc} */ public function draw(CanvasInterface $canvas) { if (!$canvas->isHandlerSet()) { throw new CanvasEmptyException(sprintf('Can Not Draw Text (%s) - Canvas Is Empty', (string) $this)); } if (false == $this->getDrawer()->draw($canvas, $this)) { throw new DrawableException(sprintf('Could Not Draw Text "%s"', (string) $this)); } return $this; }
/** * {@inheritdoc} */ public function paste(CanvasInterface $src, Box $srcBox = null, Box $destBox = null) { $this->assertEmpty(); if (!$src->isHandlerSet()) { throw new CanvasEmptyException('Could Not Execute Paste - Source Canvas Handler Is Not Set'); } $srcDimension = $src->getDimension(); $srcBox = $srcBox === null ? new Box($srcDimension) : $srcBox; $destBox = $destBox === null ? new Box($srcDimension) : $destBox; $this->preserveAlpha($this->getHandler(), $src->getHandler()); $this->preserveAlpha($src->getHandler(), $this->getHandler()); if (false == @imagecopyresampled($this->getHandler(), $src->getHandler(), $destBox->getX(), $destBox->getY(), $srcBox->getX(), $srcBox->getY(), $destBox->getWidth(), $destBox->getHeight(), $srcBox->getWidth(), $srcBox->getHeight())) { throw new CanvasException(sprintf('Could Not Paste "%s" On "%s"', (string) $src, (string) $this)); } return $this; }