mirror of
https://github.com/Intervention/image.git
synced 2025-08-18 11:41:17 +02:00
removed fill modifier for now
This commit is contained in:
@@ -150,11 +150,4 @@ abstract class AbstractImage
|
|||||||
$this->resolveDriverClass('Modifiers\ResizeModifier', $size)
|
$this->resolveDriverClass('Modifiers\ResizeModifier', $size)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fill($filling): ImageInterface
|
|
||||||
{
|
|
||||||
return $this->modify(
|
|
||||||
$this->resolveDriverClass('Modifiers\FillModifier', $filling)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|
||||||
|
|
||||||
use Intervention\Image\Drivers\Gd\InputHandler;
|
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Traits\CanResolveDriverClass;
|
|
||||||
|
|
||||||
class FillModifier implements ModifierInterface
|
|
||||||
{
|
|
||||||
use CanResolveDriverClass;
|
|
||||||
|
|
||||||
public function __construct($filling, ?int $x = null, ?int $y = null)
|
|
||||||
{
|
|
||||||
$this->filling = $filling;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
|
||||||
{
|
|
||||||
$width = $image->width();
|
|
||||||
$height = $image->height();
|
|
||||||
$filling = $this->getApplicableFilling();
|
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
|
||||||
imagefilledrectangle($frame->getCore(), 0, 0, $width - 1, $height - 1, $filling->toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $image;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getApplicableFilling(): ColorInterface
|
|
||||||
{
|
|
||||||
return $this->resolveDriverClass('InputHandler')->handle($this->filling);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
|
||||||
|
|
||||||
use ImagickDraw;
|
|
||||||
use Intervention\Image\Drivers\Imagick\InputHandler;
|
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Traits\CanResolveDriverClass;
|
|
||||||
|
|
||||||
class FillModifier implements ModifierInterface
|
|
||||||
{
|
|
||||||
use CanResolveDriverClass;
|
|
||||||
|
|
||||||
public function __construct($filling, ?int $x = null, ?int $y = null)
|
|
||||||
{
|
|
||||||
$this->filling = $filling;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
|
||||||
{
|
|
||||||
$filling = $this->getApplicableFilling();
|
|
||||||
|
|
||||||
$draw = new ImagickDraw();
|
|
||||||
$draw->setFillColor($filling->getPixel());
|
|
||||||
$draw->rectangle(0, 0, $image->width(), $image->height());
|
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
|
||||||
$frame->getCore()->drawImage($draw);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $image;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getApplicableFilling(): ColorInterface
|
|
||||||
{
|
|
||||||
return $this->resolveDriverClass('InputHandler')->handle($this->filling);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user