1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 04:08:14 +01:00

Improve Driver Specializing Process (#1315)

Streamline driver specializing process of analyzers, modifers, encoders and decoders.
This commit is contained in:
Oliver Vogel 2024-03-23 08:08:41 +01:00 committed by GitHub
parent 67be90e570
commit 7f4ff15d51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
207 changed files with 1073 additions and 1185 deletions

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class ColorspaceAnalyzer extends SpecializableAnalyzer
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class HeightAnalyzer extends SpecializableAnalyzer
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class PixelColorAnalyzer extends SpecializableAnalyzer
{
public function __construct(

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class PixelColorsAnalyzer extends SpecializableAnalyzer
{
public function __construct(

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class ProfileAnalyzer extends SpecializableAnalyzer
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class ResolutionAnalyzer extends SpecializableAnalyzer
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Analyzers;
use Intervention\Image\Drivers\SpecializableAnalyzer;
class WidthAnalyzer extends SpecializableAnalyzer
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class Base64ImageDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class BinaryImageDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class DataUriImageDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class FilePathImageDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class FilePointerImageDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class ImageObjectDecoder extends SpecializableDecoder
{
}

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Intervention\Image\Decoders;
use Intervention\Image\Drivers\SpecializableDecoder;
class SplFileInfoImageDecoder extends SpecializableDecoder
{
}

View File

@ -14,7 +14,7 @@ use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Traits\CanBuildFilePointer;
abstract class AbstractDecoder extends DriverSpecialized implements DecoderInterface
abstract class AbstractDecoder implements DecoderInterface
{
use CanBuildFilePointer;
@ -110,7 +110,7 @@ abstract class AbstractDecoder extends DriverSpecialized implements DecoderInter
try {
$source = match (true) {
(strlen($path_or_data) <= PHP_MAXPATHLEN && is_file($path_or_data)) => $path_or_data, // path
$this->isFile($path_or_data) => $path_or_data, // path
default => $this->buildFilePointer($path_or_data), // data
};

View File

@ -13,6 +13,7 @@ use Intervention\Image\Interfaces\DriverInterface;
use Intervention\Image\Interfaces\EncoderInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializableInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use ReflectionClass;
abstract class AbstractDriver implements DriverInterface
@ -30,26 +31,35 @@ abstract class AbstractDriver implements DriverInterface
*
* @see DriverInterface::specialize()
*/
public function specialize(object $object): ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface
{
public function specialize(
ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface $object
): ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface {
// return object directly if no specializing is possible
if (!($object instanceof SpecializableInterface)) {
return $object;
}
$driver_namespace = (new ReflectionClass($this))->getNamespaceName();
$class_path = substr($object::class, strlen("Intervention\\Image\\"));
$classname = $driver_namespace . "\\" . $class_path;
// return directly if object is already specialized
if ($object instanceof SpecializedInterface) {
return $object;
}
if (!class_exists($classname)) {
// resolve classname for specializable object
$driver_namespace = (new ReflectionClass($this))->getNamespaceName();
$object_path = substr($object::class, strlen("Intervention\\Image\\"));
$specialized_classname = $driver_namespace . "\\" . $object_path;
if (!class_exists($specialized_classname)) {
throw new NotSupportedException(
"Class '" . $class_path . "' is not supported by " . $this->id() . " driver."
"Class '" . $object_path . "' is not supported by " . $this->id() . " driver."
);
}
return forward_static_call([
$classname,
'buildSpecialized'
], $object, $this);
// create driver specialized object with specializable properties of generic object
$specialized = (new $specialized_classname(...$object->specializable()));
// attach driver
return $specialized->setDriver($this);
}
/**
@ -57,18 +67,18 @@ abstract class AbstractDriver implements DriverInterface
*
* @see DriverInterface::specializeMultiple()
*/
public function specializeMultiple(array $specializables): array
public function specializeMultiple(array $objects): array
{
return array_map(function ($specializable) {
return array_map(function ($object) {
return $this->specialize(
match (true) {
is_string($specializable) => new $specializable(),
is_object($specializable) => $specializable,
is_string($object) => new $object(),
is_object($object) => $object,
default => throw new RuntimeException(
'Specializable item must be either a class name or an object.'
)
}
);
}, $specializables);
}, $objects);
}
}

View File

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Interfaces\EncodedImageInterface;
use Intervention\Image\Interfaces\EncoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
abstract class AbstractEncoder implements EncoderInterface
{
public const DEFAULT_QUALITY = 75;
/**
* {@inheritdoc}
*
* @see EncoderInterface::encode()
*/
public function encode(ImageInterface $image): EncodedImageInterface
{
return $image->encode($this);
}
/**
* Get return value of callback through output buffer
*
* @param callable $callback
* @return string
*/
protected function buffered(callable $callback): string
{
ob_start();
$callback();
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
}

View File

@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Interfaces\FontInterface;
abstract class AbstractTextModifier extends DriverSpecialized
{
/**
* Return array of offset points to draw text stroke effect below the actual text
*
* @param FontInterface $font
* @return array
*/
protected function strokeOffsets(FontInterface $font): array
{
$offsets = [];
if ($font->strokeWidth() <= 0) {
return $offsets;
}
for ($x = $font->strokeWidth() * -1; $x <= $font->strokeWidth(); $x++) {
for ($y = $font->strokeWidth() * -1; $y <= $font->strokeWidth(); $y++) {
$offsets[] = new Point($x, $y);
}
}
return $offsets;
}
}

View File

@ -1,75 +0,0 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Interfaces\DriverInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
abstract class DriverSpecialized implements SpecializedInterface
{
protected DriverInterface $driver;
protected object $generic;
public function __construct()
{
}
/**
* {@inheritdoc}
*
* @see SpecializedInterface::buildSpecialized()
*/
public static function buildSpecialized(object $generic, DriverInterface $driver): SpecializedInterface
{
$specialized = new static();
$specialized->generic = $generic;
$specialized->driver = $driver;
return $specialized;
}
/**
* {@inheritdoc}
*
* @see SpecializedInterface::driver()
*/
public function driver(): DriverInterface
{
return $this->driver;
}
/**
* {@inheritdoc}
*
* @see SpecializedInterface::generic()
*/
public function generic(): object
{
return $this->generic;
}
/**
* Magic method to read attributes of underlying generic object
*
* @param string $name
* @return mixed
*/
public function __get(string $name): mixed
{
return $this->generic->$name;
}
/**
* Magic method to call methods of underlying generic object
*
* @param string $name
* @param array $arguments
* @return mixed
*/
public function __call(string $name, array $arguments): mixed
{
return $this->generic->$name(...$arguments);
}
}

View File

@ -1,26 +0,0 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Drivers;
use Intervention\Image\Interfaces\EncoderInterface;
abstract class DriverSpecializedEncoder extends DriverSpecialized implements EncoderInterface
{
/**
* Get return value of callback through output buffer
*
* @param callable $callback
* @return string
*/
protected function getBuffered(callable $callback): string
{
ob_start();
$callback();
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
}

View File

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Analyzers\ColorspaceAnalyzer as GenericColorspaceAnalyzer;
use Intervention\Image\Colors\Rgb\Colorspace;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class ColorspaceAnalyzer extends DriverSpecialized implements AnalyzerInterface
class ColorspaceAnalyzer extends GenericColorspaceAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\HeightAnalyzer as GenericHeightAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class HeightAnalyzer extends DriverSpecialized implements AnalyzerInterface
class HeightAnalyzer extends GenericHeightAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -5,20 +5,15 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use GdImage;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Analyzers\PixelColorAnalyzer as GenericPixelColorAnalyzer;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Exceptions\GeometryException;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ColorspaceInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $x
* @property int $y
* @property int $frame_key
*/
class PixelColorAnalyzer extends DriverSpecialized implements AnalyzerInterface
class PixelColorAnalyzer extends GenericPixelColorAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Collection;
use Intervention\Image\Interfaces\ImageInterface;
/**
* @property int $x
* @property int $y
*/
class PixelColorsAnalyzer extends PixelColorAnalyzer
{
public function analyze(ImageInterface $image): mixed

View File

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Resolution;
class ResolutionAnalyzer extends DriverSpecialized implements AnalyzerInterface
class ResolutionAnalyzer extends GenericResolutionAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\WidthAnalyzer as GenericWidthAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class WidthAnalyzer extends DriverSpecialized implements AnalyzerInterface
class WidthAnalyzer extends GenericWidthAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,10 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Decoders;
use Intervention\Image\Drivers\AbstractDecoder as GenericAbstractDecoder;
use Intervention\Image\Drivers\SpecializableDecoder;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\SpecializedInterface;
abstract class AbstractDecoder extends GenericAbstractDecoder
abstract class AbstractDecoder extends SpecializableDecoder implements SpecializedInterface
{
/**
* Return media (mime) type of the file at given file path

View File

@ -4,19 +4,17 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\AvifEncoder as GenericAvifEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class AvifEncoder extends DriverSpecializedEncoder
class AvifEncoder extends GenericAvifEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$gd = $image->core()->native();
$data = $this->getBuffered(function () use ($gd) {
$data = $this->buffered(function () use ($gd) {
imageavif($gd, null, $this->quality);
});

View File

@ -4,15 +4,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\BmpEncoder as GenericBmpEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class BmpEncoder extends DriverSpecializedEncoder
class BmpEncoder extends GenericBmpEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$data = $this->getBuffered(function () use ($image) {
$data = $this->buffered(function () use ($image) {
imagebmp($image->core()->native(), null, false);
});

View File

@ -6,13 +6,14 @@ namespace Intervention\Image\Drivers\Gd\Encoders;
use Exception;
use Intervention\Gif\Builder as GifBuilder;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\GifEncoder as GenericGifEncoder;
use Intervention\Image\Exceptions\EncoderException;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class GifEncoder extends DriverSpecializedEncoder
class GifEncoder extends GenericGifEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
@ -21,7 +22,7 @@ class GifEncoder extends DriverSpecializedEncoder
}
$gd = $image->core()->native();
$data = $this->getBuffered(function () use ($gd) {
$data = $this->buffered(function () use ($gd) {
imagegif($gd);
});

View File

@ -4,21 +4,19 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Encoders\JpegEncoder as GenericJpegEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class JpegEncoder extends DriverSpecializedEncoder
class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$output = Cloner::cloneBlended($image->core()->native(), background: $image->blendingColor());
$data = $this->getBuffered(function () use ($output) {
$data = $this->buffered(function () use ($output) {
imagejpeg($output, null, $this->quality);
});

View File

@ -4,15 +4,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\PngEncoder as GenericPngEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class PngEncoder extends DriverSpecializedEncoder
class PngEncoder extends GenericPngEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$data = $this->getBuffered(function () use ($image) {
$data = $this->buffered(function () use ($image) {
imagepng($image->core()->native(), null, -1);
});

View File

@ -4,19 +4,17 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\WebpEncoder as GenericWebpEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class WebpEncoder extends DriverSpecializedEncoder
class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
$data = $this->getBuffered(function () use ($image, $quality) {
$data = $this->buffered(function () use ($image, $quality) {
imagewebp($image->core()->native(), null, $quality);
});

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\AlignRotationModifier as GenericAlignRotationModifier;
class AlignRotationModifier extends DriverSpecialized implements ModifierInterface
class AlignRotationModifier extends GenericAlignRotationModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,15 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BlendTransparencyModifier as GenericBlendTransparencyModifier;
/**
* @property mixed $color
*/
class BlendTransparencyModifier extends DriverSpecialized implements ModifierInterface
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BlurModifier as GenericBlurModifier;
/**
* @property int $amount
*/
class BlurModifier extends DriverSpecialized implements ModifierInterface
class BlurModifier extends GenericBlurModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier;
/**
* @property int $level
*/
class BrightnessModifier extends DriverSpecialized implements ModifierInterface
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,16 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ColorizeModifier as GenericColorizeModifier;
/**
* @property int $red
* @property int $green
* @property int $blue
*/
class ColorizeModifier extends DriverSpecialized implements ModifierInterface
class ColorizeModifier extends GenericColorizeModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -5,15 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Exceptions\NotSupportedException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ColorspaceModifier as GenericColorspaceModifier;
/**
* @method ColorspaceInterface targetColorspace()
*/
class ColorspaceModifier extends DriverSpecialized implements ModifierInterface
class ColorspaceModifier extends GenericColorspaceModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -7,24 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Channels\Blue;
use Intervention\Image\Colors\Rgb\Channels\Green;
use Intervention\Image\Colors\Rgb\Channels\Red;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ContainModifier as GenericContainModifier;
/**
* @method SizeInterface getCropSize(ImageInterface $image)
* @method SizeInterface getResizeSize(ImageInterface $image)
* @property int $width
* @property int $height
* @property mixed $background
* @property string $position
*/
class ContainModifier extends DriverSpecialized implements ModifierInterface
class ContainModifier extends GenericContainModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ContrastModifier as GenericContrastModifier;
/**
* @property int $level
*/
class ContrastModifier extends DriverSpecialized implements ModifierInterface
class ContrastModifier extends GenericContrastModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Exceptions\GeometryException;
use Intervention\Image\Interfaces\SizeInterface;
/**
* @property int $width
* @property int $height
*/
class CoverDownModifier extends CoverModifier
{
/**

View File

@ -4,19 +4,15 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\CoverModifier as GenericCoverModifier;
/**
* @method SizeInterface getCropSize(ImageInterface $image)
* @method SizeInterface getResizeSize(SizeInterface $size)
*/
class CoverModifier extends DriverSpecialized implements ModifierInterface
class CoverModifier extends GenericCoverModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,21 +4,15 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\CropModifier as GenericCropModifier;
/**
* @method SizeInterface crop(ImageInterface $image)
* @property int $offset_x
* @property int $offset_y
* @property mixed $background
*/
class CropModifier extends DriverSpecialized implements ModifierInterface
class CropModifier extends GenericCropModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,15 +4,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;
use Intervention\Image\Geometry\Ellipse;
use RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\DrawEllipseModifier as GenericDrawEllipseModifier;
/**
* @property Ellipse $drawable
*/
class DrawEllipseModifier extends AbstractDrawModifier
class DrawEllipseModifier extends GenericDrawEllipseModifier implements SpecializedInterface
{
/**
* @throws RuntimeException
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($image as $frame) {
@ -23,8 +24,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
if ($this->drawable->hasBackgroundColor()) {
imagefilledellipse(
$frame->native(),
$this->position()->x(),
$this->position()->y(),
$this->drawable()->position()->x(),
$this->drawable->position()->y(),
$this->drawable->width() - 1,
$this->drawable->height() - 1,
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
@ -42,8 +43,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
imagearc(
$frame->native(),
$this->position()->x(),
$this->position()->y(),
$this->drawable()->position()->x(),
$this->drawable()->position()->y(),
$this->drawable->width(),
$this->drawable->height(),
0,
@ -56,8 +57,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
imagealphablending($frame->native(), true);
imagefilledellipse(
$frame->native(),
$this->position()->x(),
$this->position()->y(),
$this->drawable()->position()->x(),
$this->drawable()->position()->y(),
$this->drawable->width(),
$this->drawable->height(),
$this->driver()->colorProcessor($image->colorspace())->colorToNative(

View File

@ -4,19 +4,22 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;
use RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Geometry\Line;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\DrawLineModifier as GenericDrawLineModifier;
/**
* @method ColorInterface backgroundColor()
* @property Line $drawable
*/
class DrawLineModifier extends AbstractDrawModifier
class DrawLineModifier extends GenericDrawLineModifier implements SpecializedInterface
{
/**
* @throws RuntimeException
*/
public function apply(ImageInterface $image): ImageInterface
{
$color = $this->driver()->colorProcessor($image->colorspace())->colorToNative(
$this->backgroundColor()
);
foreach ($image as $frame) {
imagealphablending($frame->native(), true);
imageantialias($frame->native(), true);
@ -27,9 +30,7 @@ class DrawLineModifier extends AbstractDrawModifier
$this->drawable->start()->y(),
$this->drawable->end()->x(),
$this->drawable->end()->y(),
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
$this->backgroundColor()
)
$color
);
}

View File

@ -4,16 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\PointInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\DrawPixelModifier as GenericDrawPixelModifier;
/**
* @property PointInterface $position
* @property mixed $color
*/
class DrawPixelModifier extends DriverSpecialized implements ModifierInterface
class DrawPixelModifier extends GenericDrawPixelModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,19 +4,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;
use Intervention\Image\Geometry\Polygon;
use RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\DrawPolygonModifier as ModifiersDrawPolygonModifier;
/**
* @method Point position()
* @method ColorInterface backgroundColor()
* @method ColorInterface borderColor()
* @property Polygon $drawable
*/
class DrawPolygonModifier extends AbstractDrawModifier
class DrawPolygonModifier extends ModifiersDrawPolygonModifier implements SpecializedInterface
{
/**
* @throws RuntimeException
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($image as $frame) {

View File

@ -4,32 +4,30 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractDrawModifier;
use Intervention\Image\Geometry\Rectangle;
use Intervention\Image\Interfaces\ColorInterface;
use RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\DrawRectangleModifier as GenericDrawRectangleModifier;
/**
* @method Point position()
* @method ColorInterface backgroundColor()
* @method ColorInterface borderColor()
* @property Rectangle $drawable
*/
class DrawRectangleModifier extends AbstractDrawModifier
class DrawRectangleModifier extends GenericDrawRectangleModifier implements SpecializedInterface
{
/**
* @throws RuntimeException
*/
public function apply(ImageInterface $image): ImageInterface
{
$position = $this->drawable->position();
foreach ($image as $frame) {
// draw background
if ($this->drawable->hasBackgroundColor()) {
imagealphablending($frame->native(), true);
imagefilledrectangle(
$frame->native(),
$this->position()->x(),
$this->position()->y(),
$this->position()->x() + $this->drawable->width(),
$this->position()->y() + $this->drawable->height(),
$position->x(),
$position->y(),
$position->x() + $this->drawable->width(),
$position->y() + $this->drawable->height(),
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
$this->backgroundColor()
)
@ -42,10 +40,10 @@ class DrawRectangleModifier extends AbstractDrawModifier
imagesetthickness($frame->native(), $this->drawable->borderSize());
imagerectangle(
$frame->native(),
$this->position()->x(),
$this->position()->y(),
$this->position()->x() + $this->drawable->width(),
$this->position()->y() + $this->drawable->height(),
$position->x(),
$position->y(),
$position->x() + $this->drawable->width(),
$position->y() + $this->drawable->height(),
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
$this->borderColor()
)

View File

@ -4,19 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Frame;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\FillModifier as GenericFillModifier;
/**
* @method bool hasPosition()
* @property mixed $color
* @property null|Point $position
*/
class FillModifier extends DriverSpecialized implements ModifierInterface
class FillModifier extends GenericFillModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\FlipModifier as GenericFlipModifier;
class FlipModifier extends DriverSpecialized implements ModifierInterface
class FlipModifier extends GenericFlipModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\FlopModifier as GenericFlopModifier;
class FlopModifier extends DriverSpecialized implements ModifierInterface
class FlopModifier extends GenericFlopModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\GammaModifier as GenericGammaModifier;
/**
* @property float $gamma
*/
class GammaModifier extends DriverSpecialized implements ModifierInterface
class GammaModifier extends GenericGammaModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\GreyscaleModifier as GenericGreyscaleModifier;
class GreyscaleModifier extends DriverSpecialized implements ModifierInterface
class GreyscaleModifier extends GenericGreyscaleModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\InvertModifier as GenericInvertModifier;
class InvertModifier extends DriverSpecialized implements ModifierInterface
class InvertModifier extends GenericInvertModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\PixelateModifier as GenericPixelateModifier;
/**
* @property int $size
*/
class PixelateModifier extends DriverSpecialized implements ModifierInterface
class PixelateModifier extends GenericPixelateModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,22 +4,14 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\PointInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\PlaceModifier as GenericPlaceModifier;
/**
* @method mixed getPosition(ImageInterface $image, ImageInterface $watermark)
* @property mixed $element
* @property string $position
* @property int $offset_x
* @property int $offset_y
* @property int $opacity
*/
class PlaceModifier extends DriverSpecialized implements ModifierInterface
class PlaceModifier extends GenericPlaceModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,16 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Exceptions\NotSupportedException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\ProfileInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ProfileModifier as GenericProfileModifier;
/**
* @property ProfileInterface $profile
*/
class ProfileModifier extends DriverSpecialized implements ModifierInterface
class ProfileModifier extends GenericProfileModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ProfileRemovalModifier as GenericProfileRemovalModifier;
class ProfileRemovalModifier extends DriverSpecialized implements ModifierInterface
class ProfileRemovalModifier extends GenericProfileRemovalModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,17 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\InputException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\QuantizeColorsModifier as GenericQuantizeColorsModifier;
/**
* @property int $limit
* @property mixed $background
*/
class QuantizeColorsModifier extends DriverSpecialized implements ModifierInterface
class QuantizeColorsModifier extends GenericQuantizeColorsModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,15 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\RemoveAnimationModifier as GenericRemoveAnimationModifier;
/**
* @method mixed chosenFrame(ImageInterface $image, int|string $position)
* @property int|string $position
*/
class RemoveAnimationModifier extends DriverSpecialized implements ModifierInterface
class RemoveAnimationModifier extends GenericRemoveAnimationModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -7,20 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Channels\Blue;
use Intervention\Image\Colors\Rgb\Channels\Green;
use Intervention\Image\Colors\Rgb\Channels\Red;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ResizeCanvasModifier as GenericResizeCanvasModifier;
/**
* @method SizeInterface cropSize(ImageInterface $image)
* @property mixed $background
*/
class ResizeCanvasModifier extends DriverSpecialized implements ModifierInterface
class ResizeCanvasModifier extends GenericResizeCanvasModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{
@ -55,8 +51,7 @@ class ResizeCanvasModifier extends DriverSpecialized implements ModifierInterfac
127,
);
imagealphablending($modified, false); // do not blend / just overwrite
// imagecolortransparent($modified, $transparent);
imagealphablending($modified, false); // do not blend - just overwrite
imagefilledrectangle(
$modified,
$resize->pivot()->x() * -1,

View File

@ -7,10 +7,10 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SizeInterface;
/**
* @method SizeInterface cropSize(ImageInterface $image)
* @property mixed $background
*/
class ResizeCanvasRelativeModifier extends ResizeCanvasModifier
{
protected function cropSize(ImageInterface $image, bool $relative = false): SizeInterface
{
return parent::cropSize($image, true);
}
}

View File

@ -4,20 +4,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ResizeModifier as GenericResizeModifier;
/**
* @property null|int $width
* @property null|int $height
*/
class ResizeModifier extends DriverSpecialized implements ModifierInterface
class ResizeModifier extends GenericResizeModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,15 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ResolutionModifier as GenericResolutionModifier;
/**
* @property int $x
* @property int $y
*/
class ResolutionModifier extends DriverSpecialized implements ModifierInterface
class ResolutionModifier extends GenericResolutionModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -7,20 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Colors\Rgb\Channels\Blue;
use Intervention\Image\Colors\Rgb\Channels\Green;
use Intervention\Image\Colors\Rgb\Channels\Red;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Geometry\Rectangle;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\FrameInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\RotateModifier as GenericRotateModifier;
/**
* @method mixed rotationAngle()
* @property mixed $background
*/
class RotateModifier extends DriverSpecialized implements ModifierInterface
class RotateModifier extends GenericRotateModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SizeInterface;
/**
* @property int $width
* @property int $height
*/
class ScaleDownModifier extends ResizeModifier
{
protected function getAdjustedSize(ImageInterface $image): SizeInterface

View File

@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SizeInterface;
/**
* @property int $width
* @property int $height
*/
class ScaleModifier extends ResizeModifier
{
protected function getAdjustedSize(ImageInterface $image): SizeInterface

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\SharpenModifier as GenericSharpenModifier;
/**
* @property int $amount
*/
class SharpenModifier extends DriverSpecialized implements ModifierInterface
class SharpenModifier extends GenericSharpenModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,16 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Exceptions\AnimationException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\SliceAnimationModifier as GenericSliceAnimationModifier;
/**
* @property int $offset
* @property null|int $length
*/
class SliceAnimationModifier extends DriverSpecialized implements ModifierInterface
class SliceAnimationModifier extends GenericSliceAnimationModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,20 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Modifiers;
use Intervention\Image\Drivers\AbstractTextModifier;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Interfaces\FontInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\TextModifier as GenericTextModifier;
/**
* @property Point $position
* @property string $text
* @property FontInterface $font
*/
class TextModifier extends AbstractTextModifier implements ModifierInterface
class TextModifier extends GenericTextModifier implements SpecializedInterface
{
/**
* {@inheritdoc}
@ -30,8 +23,8 @@ class TextModifier extends AbstractTextModifier implements ModifierInterface
$lines = $fontProcessor->textBlock($this->text, $this->font, $this->position);
// decode text colors
$textColor = $this->textColor($image);
$strokeColor = $this->strokeColor($image);
$textColor = $this->gdTextColor($image);
$strokeColor = $this->gdStrokeColor($image);
foreach ($image as $frame) {
imagealphablending($frame->native(), true);
@ -90,46 +83,36 @@ class TextModifier extends AbstractTextModifier implements ModifierInterface
}
/**
* Decode text color
*
* The text outline effect is drawn with a trick by plotting additional text
* under the actual text with an offset in the color of the outline effect.
* For this reason, no colors with transparency can be used for the text
* color or the color of the stroke effect, as this would be superimposed.
* Decode text color in GD compatible format
*
* @param ImageInterface $image
* @return int
* @throws RuntimeException
* @throws ColorException
* @return int
*/
protected function textColor(ImageInterface $image): int
protected function gdTextColor(ImageInterface $image): int
{
$color = $this->driver()->handleInput($this->font->color());
if ($this->font->hasStrokeEffect() && $color->isTransparent()) {
throw new ColorException(
'The text color must be fully opaque when using the stroke effect.'
);
}
return $this->driver()->colorProcessor($image->colorspace())->colorToNative($color);
return $this
->driver()
->colorProcessor($image->colorspace())
->colorToNative(parent::textColor());
}
/**
* Decode outline stroke color
* Decode color for stroke (outline) effect in GD compatible format
*
* @param ImageInterface $image
* @return int
* @throws RuntimeException
* @throws ColorException
* @return int
*/
protected function strokeColor(ImageInterface $image): int
protected function gdStrokeColor(ImageInterface $image): int
{
if (!$this->font->hasStrokeEffect()) {
return 0;
}
$color = $this->driver()->handleInput($this->font->strokeColor());
$color = parent::strokeColor();
if ($color->isTransparent()) {
throw new ColorException(
@ -137,7 +120,10 @@ class TextModifier extends AbstractTextModifier implements ModifierInterface
);
}
return $this->driver()->colorProcessor($image->colorspace())->colorToNative($color);
return $this
->driver()
->colorProcessor($image->colorspace())
->colorToNative($color);
}
/**

View File

@ -5,13 +5,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Imagick;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Analyzers\ColorspaceAnalyzer as GenericColorspaceAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Colors\Cmyk\Colorspace as CmykColorspace;
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class ColorspaceAnalyzer extends DriverSpecialized implements AnalyzerInterface
class ColorspaceAnalyzer extends GenericColorspaceAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\HeightAnalyzer as GenericHeightAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class HeightAnalyzer extends DriverSpecialized implements AnalyzerInterface
class HeightAnalyzer extends GenericHeightAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -5,19 +5,14 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Imagick;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Analyzers\PixelColorAnalyzer as GenericPixelColorAnalyzer;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ColorspaceInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $x
* @property int $y
* @property int $frame_key
*/
class PixelColorAnalyzer extends DriverSpecialized implements AnalyzerInterface
class PixelColorAnalyzer extends GenericPixelColorAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Intervention\Image\Collection;
use Intervention\Image\Interfaces\ImageInterface;
/**
* @property int $x
* @property int $y
*/
class PixelColorsAnalyzer extends PixelColorAnalyzer
{
public function analyze(ImageInterface $image): mixed

View File

@ -4,13 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Intervention\Image\Analyzers\ProfileAnalyzer as GenericProfileAnalyzer;
use Intervention\Image\Colors\Profile;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class ProfileAnalyzer extends DriverSpecialized implements AnalyzerInterface
class ProfileAnalyzer extends GenericProfileAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Resolution;
class ResolutionAnalyzer extends DriverSpecialized implements AnalyzerInterface
class ResolutionAnalyzer extends GenericResolutionAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Analyzers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\AnalyzerInterface;
use Intervention\Image\Analyzers\WidthAnalyzer as GenericWidthAnalyzer;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class WidthAnalyzer extends DriverSpecialized implements AnalyzerInterface
class WidthAnalyzer extends GenericWidthAnalyzer implements SpecializedInterface
{
public function analyze(ImageInterface $image): mixed
{

View File

@ -6,10 +6,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class Base64ImageDecoder extends BinaryImageDecoder implements DecoderInterface
class Base64ImageDecoder extends BinaryImageDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -8,10 +8,9 @@ use Imagick;
use ImagickException;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class BinaryImageDecoder extends ImagickImageDecoder implements DecoderInterface
class BinaryImageDecoder extends ImagickImageDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -7,10 +7,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
use Intervention\Image\Drivers\AbstractDecoder;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class ColorObjectDecoder extends AbstractDecoder implements DecoderInterface
class ColorObjectDecoder extends AbstractDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -6,10 +6,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class DataUriImageDecoder extends BinaryImageDecoder implements DecoderInterface
class DataUriImageDecoder extends BinaryImageDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -8,10 +8,9 @@ use Imagick;
use ImagickException;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class FilePathImageDecoder extends ImagickImageDecoder implements DecoderInterface
class FilePathImageDecoder extends ImagickImageDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -4,13 +4,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Decoders;
use Intervention\Image\Drivers\AbstractDecoder;
use Intervention\Image\Drivers\SpecializableDecoder;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class ImageObjectDecoder extends AbstractDecoder implements DecoderInterface
class ImageObjectDecoder extends SpecializableDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -5,17 +5,16 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Decoders;
use Imagick;
use Intervention\Image\Drivers\AbstractDecoder;
use Intervention\Image\Drivers\Imagick\Core;
use Intervention\Image\Drivers\Imagick\Driver;
use Intervention\Image\Drivers\SpecializableDecoder;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Image;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Modifiers\AlignRotationModifier;
class ImagickImageDecoder extends AbstractDecoder implements DecoderInterface
class ImagickImageDecoder extends SpecializableDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -7,10 +7,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
use SplFileInfo;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
class SplFileInfoImageDecoder extends FilePathImageDecoder implements DecoderInterface
class SplFileInfoImageDecoder extends FilePathImageDecoder
{
public function decode(mixed $input): ImageInterface|ColorInterface
{

View File

@ -5,14 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\AvifEncoder as GenericAvifEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class AvifEncoder extends DriverSpecializedEncoder
class AvifEncoder extends GenericAvifEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -5,11 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\BmpEncoder as GenericBmpEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class BmpEncoder extends DriverSpecializedEncoder
class BmpEncoder extends GenericBmpEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -5,11 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\GifEncoder as GenericGifEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class GifEncoder extends DriverSpecializedEncoder
class GifEncoder extends GenericGifEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -4,15 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\HeicEncoder as GenericHeicEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\EncodedImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class HeicEncoder extends DriverSpecializedEncoder
class HeicEncoder extends GenericHeicEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImageInterface
{

View File

@ -5,15 +5,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\Jpeg2000Encoder as GenericJpeg2000Encoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\EncodedImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class Jpeg2000Encoder extends DriverSpecializedEncoder
class Jpeg2000Encoder extends GenericJpeg2000Encoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImageInterface
{

View File

@ -5,14 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\JpegEncoder as GenericJpegEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class JpegEncoder extends DriverSpecializedEncoder
class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -5,11 +5,12 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\PngEncoder as GenericPngEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
class PngEncoder extends DriverSpecializedEncoder
class PngEncoder extends GenericPngEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -4,15 +4,13 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Encoders;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\TiffEncoder as GenericTiffEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\EncodedImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class TiffEncoder extends DriverSpecializedEncoder
class TiffEncoder extends GenericTiffEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImageInterface
{

View File

@ -6,14 +6,12 @@ namespace Intervention\Image\Drivers\Imagick\Encoders;
use Imagick;
use ImagickPixel;
use Intervention\Image\Drivers\DriverSpecializedEncoder;
use Intervention\Image\EncodedImage;
use Intervention\Image\Encoders\WebpEncoder as GenericWebpEncoder;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
/**
* @property int $quality
*/
class WebpEncoder extends DriverSpecializedEncoder
class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{

View File

@ -5,11 +5,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Modifiers;
use Imagick;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\AlignRotationModifier as GenericAlignRotationModifier;
class AlignRotationModifier extends DriverSpecialized implements ModifierInterface
class AlignRotationModifier extends GenericAlignRotationModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -5,14 +5,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Modifiers;
use Imagick;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BlendTransparencyModifier as GenericBlendTransparencyModifier;
/**
* @property mixed $color
*/
class BlendTransparencyModifier extends DriverSpecialized implements ModifierInterface
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BlurModifier as GenericBlurModifier;
/**
* @property int $amount
*/
class BlurModifier extends DriverSpecialized implements ModifierInterface
class BlurModifier extends GenericBlurModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Modifiers;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier;
/**
* @property int $level
*/
class BrightnessModifier extends DriverSpecialized implements ModifierInterface
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

View File

@ -5,16 +5,11 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Imagick\Modifiers;
use Imagick;
use Intervention\Image\Drivers\DriverSpecialized;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\ModifierInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\ColorizeModifier as GenericColorizeModifier;
/**
* @property int $red
* @property int $green
* @property int $blue
*/
class ColorizeModifier extends DriverSpecialized implements ModifierInterface
class ColorizeModifier extends GenericColorizeModifier implements SpecializedInterface
{
public function apply(ImageInterface $image): ImageInterface
{

Some files were not shown because too many files have changed in this diff Show More