1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-17 19:26:25 +02:00

removed fill modifier for now

This commit is contained in:
Oliver Vogel
2021-11-03 18:48:58 +00:00
parent e2b9c17ba3
commit 0c3e08b46e
3 changed files with 0 additions and 85 deletions

View File

@@ -150,11 +150,4 @@ abstract class AbstractImage
$this->resolveDriverClass('Modifiers\ResizeModifier', $size)
);
}
public function fill($filling): ImageInterface
{
return $this->modify(
$this->resolveDriverClass('Modifiers\FillModifier', $filling)
);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}