/** * {@inheritdoc} */ public function draw(CanvasInterface $canvas, Text $text) { $x = $text->getCoordinate()->getX(); $y = $text->getCoordinate()->getY(); $width = $this->getWidth(); $outlineColor = $this->getColor()->getValue(); $result = true; for ($xc = $x - abs($width); $xc <= $x + abs($width); $xc++) { for ($yc = $y - abs($width); $yc <= $y + abs($width); $yc++) { $result = @imagefttext($canvas->getHandler(), $text->getFontSize(), $text->getAngle(), $xc, $yc + $text->getFontSize(), $outlineColor, $text->getFont(), $text->getString(), array('linespacing' => $text->getLineSpacing())); } } return (bool) ($result && @imagefttext($canvas->getHandler(), $text->getFontSize(), $text->getAngle(), $text->getCoordinate()->getX(), $text->getCoordinate()->getY() + $text->getFontSize(), $text->getColor()->getValue(), $text->getFont(), $text->getString(), array('linespacing' => $text->getLineSpacing()))); }
/** * {@inheritdoc} */ public function apply(CanvasInterface $canvas, AbstractStyledDrawable $drawable) { if (false == @imagesettile($canvas->getHandler(), $this->pattern->getHandler())) { throw new DrawableException('Could Not Apply The Fill Pattern Style'); } return new TiledColor(); }
/** * {@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} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_MEAN_REMOVAL); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_NEGATE); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_COLORIZE, $this->getColor()->getRed(), $this->getColor()->getGreen(), $this->getColor()->getBlue(), $this->getColor()->getAlpha()); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagegammacorrect($canvas->getHandler(), 1.0, $this->getLevel()); }
/** * {@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; }
/** * {@inheritdoc} */ public function draw(CanvasInterface $canvas, Text $text) { return (bool) @imagefttext($canvas->getHandler(), $text->getFontSize(), $text->getAngle(), $text->getCoordinate()->getX(), $text->getCoordinate()->getY() + $text->getFontSize(), $text->getColor()->getValue(), $text->getFont(), $text->getString(), array('linespacing' => $text->getLineSpacing())); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_SELECTIVE_BLUR); }
/** * {@inheritdoc} */ public function apply(CanvasInterface $canvas, AbstractStyledDrawable $drawable) { $interval = array_merge(array_fill(0, $this->getShowTime(), 1), $this->getHideTime() == 0 ? array() : array_fill(0, $this->getHideTime(), 0)); if (false == @imagesetstyle($canvas->getHandler(), $interval) || false == @imagesetbrush($canvas->getHandler(), $this->brush->getHandler())) { throw new DrawableException('Could Not Set The Brush And Interval'); } return new StyledBrushedColor(); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_PIXELATE, $this->getBlockSize(), false); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_BRIGHTNESS, $this->getLevel()); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { $result = imagerotate($canvas->getHandler(), $this->getDegree(), $this->getBackgroundColor()->getValue(), 0); $canvas->setHandler($result); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imagefilter($canvas->getHandler(), IMG_FILTER_CONTRAST, -$this->getLevel()); }
/** * {@inheritdoc} */ public function apply(CanvasInterface $canvas, AbstractStyledDrawable $drawable) { $fv = $drawable->getColor()->getValue(); $sv = $this->getSecondColor()->getValue(); $style = array_merge(array_fill(0, $this->getFirstColorShowTime(), $fv), array_fill(0, $this->getSecondColorShowTime(), $sv)); if (false == @imagesetstyle($canvas->getHandler(), $style)) { throw new DrawableException('Could Not Apply The DashedLine Style'); } return new StyledColor(); }
/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { imageconvolution($canvas->getHandler(), $this->getMatrix(), $this->getDivisor(), $this->getOffset()); }