/** * {@inheritdoc} */ protected function doApply(CanvasInterface $canvas) { $dimension = $this->getBox()->getDimension(); $coordinate = $this->getBox()->getCoordinate(); $new = new Canvas($dimension); $new->paste($canvas, new Box($dimension, $coordinate), new Box($dimension)); $canvas->destroy(); $canvas->setHandler($new->getHandler()); }
/** * {@inheritdoc} */ public function draw(CanvasInterface $canvas, Border $border, StyleInterface $style = null) { $size = $border->getSize(); $new = new Canvas($canvas->getDimension()); $new->paste($canvas, null, new Box($canvas->getDimension()->translate(-$size, -$size + 1), new Coordinate($size / 2, $size / 2))); $in = new BorderIn(); $in->draw($new, $border, $style); $canvas->destroy(); $canvas->setHandler($new->getHandler()); return $this; }
/** * @dataProvider canvasAndSpecialMethodsProvider * * @param \Jaguar\Canvas $canvas * @param array $data */ public function testCall(Canvas $canvas, array $data) { foreach ($data as $test) { $method = $test[0]; $arguments = $test[1]; $return = $test[2]; $this->assertTrue(is_callable(array($canvas->getActiveCanvas(), $method))); if ($return) { $this->assertEquals(call_user_func_array(array($canvas, $method), $arguments), $return); } } }
/** * Get overlay canvas * * @param string $file * * @return \Jaguar\CanvasInterface */ public function getOverlayCanvas($file) { $canvas = new Canvas(); $canvas->fromFile(Util::getResourcePath('Preset/' . $file)); return $canvas; }