mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 12:18:14 +01:00
Improve Driver Specializing Process (#1315)
Streamline driver specializing process of analyzers, modifers, encoders and decoders.
This commit is contained in:
parent
67be90e570
commit
7f4ff15d51
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class ColorspaceAnalyzer extends SpecializableAnalyzer
|
class ColorspaceAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class HeightAnalyzer extends SpecializableAnalyzer
|
class HeightAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class PixelColorAnalyzer extends SpecializableAnalyzer
|
class PixelColorAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class PixelColorsAnalyzer extends SpecializableAnalyzer
|
class PixelColorsAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class ProfileAnalyzer extends SpecializableAnalyzer
|
class ProfileAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class ResolutionAnalyzer extends SpecializableAnalyzer
|
class ResolutionAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Analyzers;
|
namespace Intervention\Image\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableAnalyzer;
|
||||||
|
|
||||||
class WidthAnalyzer extends SpecializableAnalyzer
|
class WidthAnalyzer extends SpecializableAnalyzer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class Base64ImageDecoder extends SpecializableDecoder
|
class Base64ImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class BinaryImageDecoder extends SpecializableDecoder
|
class BinaryImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class DataUriImageDecoder extends SpecializableDecoder
|
class DataUriImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class FilePathImageDecoder extends SpecializableDecoder
|
class FilePathImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class FilePointerImageDecoder extends SpecializableDecoder
|
class FilePointerImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class ImageObjectDecoder extends SpecializableDecoder
|
class ImageObjectDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Decoders;
|
namespace Intervention\Image\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
|
|
||||||
class SplFileInfoImageDecoder extends SpecializableDecoder
|
class SplFileInfoImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use Intervention\Image\Interfaces\DecoderInterface;
|
|||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Traits\CanBuildFilePointer;
|
use Intervention\Image\Traits\CanBuildFilePointer;
|
||||||
|
|
||||||
abstract class AbstractDecoder extends DriverSpecialized implements DecoderInterface
|
abstract class AbstractDecoder implements DecoderInterface
|
||||||
{
|
{
|
||||||
use CanBuildFilePointer;
|
use CanBuildFilePointer;
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ abstract class AbstractDecoder extends DriverSpecialized implements DecoderInter
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$source = match (true) {
|
$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
|
default => $this->buildFilePointer($path_or_data), // data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ use Intervention\Image\Interfaces\DriverInterface;
|
|||||||
use Intervention\Image\Interfaces\EncoderInterface;
|
use Intervention\Image\Interfaces\EncoderInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\ModifierInterface;
|
||||||
use Intervention\Image\Interfaces\SpecializableInterface;
|
use Intervention\Image\Interfaces\SpecializableInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
|
||||||
abstract class AbstractDriver implements DriverInterface
|
abstract class AbstractDriver implements DriverInterface
|
||||||
@ -30,26 +31,35 @@ abstract class AbstractDriver implements DriverInterface
|
|||||||
*
|
*
|
||||||
* @see DriverInterface::specialize()
|
* @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)) {
|
if (!($object instanceof SpecializableInterface)) {
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
$driver_namespace = (new ReflectionClass($this))->getNamespaceName();
|
// return directly if object is already specialized
|
||||||
$class_path = substr($object::class, strlen("Intervention\\Image\\"));
|
if ($object instanceof SpecializedInterface) {
|
||||||
$classname = $driver_namespace . "\\" . $class_path;
|
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(
|
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([
|
// create driver specialized object with specializable properties of generic object
|
||||||
$classname,
|
$specialized = (new $specialized_classname(...$object->specializable()));
|
||||||
'buildSpecialized'
|
|
||||||
], $object, $this);
|
// attach driver
|
||||||
|
return $specialized->setDriver($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,18 +67,18 @@ abstract class AbstractDriver implements DriverInterface
|
|||||||
*
|
*
|
||||||
* @see DriverInterface::specializeMultiple()
|
* @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(
|
return $this->specialize(
|
||||||
match (true) {
|
match (true) {
|
||||||
is_string($specializable) => new $specializable(),
|
is_string($object) => new $object(),
|
||||||
is_object($specializable) => $specializable,
|
is_object($object) => $object,
|
||||||
default => throw new RuntimeException(
|
default => throw new RuntimeException(
|
||||||
'Specializable item must be either a class name or an object.'
|
'Specializable item must be either a class name or an object.'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, $specializables);
|
}, $objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
src/Drivers/AbstractEncoder.php
Normal file
40
src/Drivers/AbstractEncoder.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Analyzers\ColorspaceAnalyzer as GenericColorspaceAnalyzer;
|
||||||
use Intervention\Image\Colors\Rgb\Colorspace;
|
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\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
class ColorspaceAnalyzer extends DriverSpecialized implements AnalyzerInterface
|
class ColorspaceAnalyzer extends GenericColorspaceAnalyzer implements SpecializedInterface
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\HeightAnalyzer as GenericHeightAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -5,20 +5,15 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
use GdImage;
|
use GdImage;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\PixelColorAnalyzer as GenericPixelColorAnalyzer;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Exceptions\GeometryException;
|
use Intervention\Image\Exceptions\GeometryException;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\ColorspaceInterface;
|
use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class PixelColorAnalyzer extends GenericPixelColorAnalyzer implements SpecializedInterface
|
||||||
* @property int $x
|
|
||||||
* @property int $y
|
|
||||||
* @property int $frame_key
|
|
||||||
*/
|
|
||||||
class PixelColorAnalyzer extends DriverSpecialized implements AnalyzerInterface
|
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Analyzers;
|
|||||||
use Intervention\Image\Collection;
|
use Intervention\Image\Collection;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property int $x
|
|
||||||
* @property int $y
|
|
||||||
*/
|
|
||||||
class PixelColorsAnalyzer extends PixelColorAnalyzer
|
class PixelColorsAnalyzer extends PixelColorAnalyzer
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Resolution;
|
use Intervention\Image\Resolution;
|
||||||
|
|
||||||
class ResolutionAnalyzer extends DriverSpecialized implements AnalyzerInterface
|
class ResolutionAnalyzer extends GenericResolutionAnalyzer implements SpecializedInterface
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\WidthAnalyzer as GenericWidthAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,10 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Decoders;
|
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\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
|
* Return media (mime) type of the file at given file path
|
||||||
|
@ -4,19 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Encoders;
|
namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\AvifEncoder as GenericAvifEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class AvifEncoder extends GenericAvifEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class AvifEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$gd = $image->core()->native();
|
$gd = $image->core()->native();
|
||||||
$data = $this->getBuffered(function () use ($gd) {
|
$data = $this->buffered(function () use ($gd) {
|
||||||
imageavif($gd, null, $this->quality);
|
imageavif($gd, null, $this->quality);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,15 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Encoders;
|
namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\BmpEncoder as GenericBmpEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$data = $this->getBuffered(function () use ($image) {
|
$data = $this->buffered(function () use ($image) {
|
||||||
imagebmp($image->core()->native(), null, false);
|
imagebmp($image->core()->native(), null, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,13 +6,14 @@ namespace Intervention\Image\Drivers\Gd\Encoders;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Intervention\Gif\Builder as GifBuilder;
|
use Intervention\Gif\Builder as GifBuilder;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\GifEncoder as GenericGifEncoder;
|
||||||
use Intervention\Image\Exceptions\EncoderException;
|
use Intervention\Image\Exceptions\EncoderException;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
@ -21,7 +22,7 @@ class GifEncoder extends DriverSpecializedEncoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
$gd = $image->core()->native();
|
$gd = $image->core()->native();
|
||||||
$data = $this->getBuffered(function () use ($gd) {
|
$data = $this->buffered(function () use ($gd) {
|
||||||
imagegif($gd);
|
imagegif($gd);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,21 +4,19 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Encoders;
|
namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
|
use Intervention\Image\Encoders\JpegEncoder as GenericJpegEncoder;
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class JpegEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$output = Cloner::cloneBlended($image->core()->native(), background: $image->blendingColor());
|
$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);
|
imagejpeg($output, null, $this->quality);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,15 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Encoders;
|
namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\PngEncoder as GenericPngEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$data = $this->getBuffered(function () use ($image) {
|
$data = $this->buffered(function () use ($image) {
|
||||||
imagepng($image->core()->native(), null, -1);
|
imagepng($image->core()->native(), null, -1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,19 +4,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Encoders;
|
namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\WebpEncoder as GenericWebpEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class WebpEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
|
$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);
|
imagewebp($image->core()->native(), null, $quality);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BlendTransparencyModifier as GenericBlendTransparencyModifier;
|
||||||
|
|
||||||
/**
|
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
|
||||||
* @property mixed $color
|
|
||||||
*/
|
|
||||||
class BlendTransparencyModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BlurModifier as GenericBlurModifier;
|
||||||
|
|
||||||
/**
|
class BlurModifier extends GenericBlurModifier implements SpecializedInterface
|
||||||
* @property int $amount
|
|
||||||
*/
|
|
||||||
class BlurModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier;
|
||||||
|
|
||||||
/**
|
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
|
||||||
* @property int $level
|
|
||||||
*/
|
|
||||||
class BrightnessModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,16 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ColorizeModifier as GenericColorizeModifier;
|
||||||
|
|
||||||
/**
|
class ColorizeModifier extends GenericColorizeModifier implements SpecializedInterface
|
||||||
* @property int $red
|
|
||||||
* @property int $green
|
|
||||||
* @property int $blue
|
|
||||||
*/
|
|
||||||
class ColorizeModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -5,15 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
|
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Exceptions\NotSupportedException;
|
use Intervention\Image\Exceptions\NotSupportedException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ColorspaceModifier as GenericColorspaceModifier;
|
||||||
|
|
||||||
/**
|
class ColorspaceModifier extends GenericColorspaceModifier implements SpecializedInterface
|
||||||
* @method ColorspaceInterface targetColorspace()
|
|
||||||
*/
|
|
||||||
class ColorspaceModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -7,24 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Green;
|
use Intervention\Image\Colors\Rgb\Channels\Green;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Red;
|
use Intervention\Image\Colors\Rgb\Channels\Red;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ContainModifier as GenericContainModifier;
|
||||||
|
|
||||||
/**
|
class ContainModifier extends GenericContainModifier implements SpecializedInterface
|
||||||
* @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
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ContrastModifier as GenericContrastModifier;
|
||||||
|
|
||||||
/**
|
class ContrastModifier extends GenericContrastModifier implements SpecializedInterface
|
||||||
* @property int $level
|
|
||||||
*/
|
|
||||||
class ContrastModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Exceptions\GeometryException;
|
use Intervention\Image\Exceptions\GeometryException;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property int $width
|
|
||||||
* @property int $height
|
|
||||||
*/
|
|
||||||
class CoverDownModifier extends CoverModifier
|
class CoverDownModifier extends CoverModifier
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -4,19 +4,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\CoverModifier as GenericCoverModifier;
|
||||||
|
|
||||||
/**
|
class CoverModifier extends GenericCoverModifier implements SpecializedInterface
|
||||||
* @method SizeInterface getCropSize(ImageInterface $image)
|
|
||||||
* @method SizeInterface getResizeSize(SizeInterface $size)
|
|
||||||
*/
|
|
||||||
class CoverModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,21 +4,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\CropModifier as GenericCropModifier;
|
||||||
|
|
||||||
/**
|
class CropModifier extends GenericCropModifier implements SpecializedInterface
|
||||||
* @method SizeInterface crop(ImageInterface $image)
|
|
||||||
* @property int $offset_x
|
|
||||||
* @property int $offset_y
|
|
||||||
* @property mixed $background
|
|
||||||
*/
|
|
||||||
class CropModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDrawModifier;
|
use RuntimeException;
|
||||||
use Intervention\Image\Geometry\Ellipse;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\DrawEllipseModifier as GenericDrawEllipseModifier;
|
||||||
|
|
||||||
/**
|
class DrawEllipseModifier extends GenericDrawEllipseModifier implements SpecializedInterface
|
||||||
* @property Ellipse $drawable
|
|
||||||
*/
|
|
||||||
class DrawEllipseModifier extends AbstractDrawModifier
|
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
@ -23,8 +24,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
|||||||
if ($this->drawable->hasBackgroundColor()) {
|
if ($this->drawable->hasBackgroundColor()) {
|
||||||
imagefilledellipse(
|
imagefilledellipse(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$this->drawable()->position()->x(),
|
||||||
$this->position()->y(),
|
$this->drawable->position()->y(),
|
||||||
$this->drawable->width() - 1,
|
$this->drawable->width() - 1,
|
||||||
$this->drawable->height() - 1,
|
$this->drawable->height() - 1,
|
||||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
@ -42,8 +43,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
|||||||
|
|
||||||
imagearc(
|
imagearc(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$this->drawable()->position()->x(),
|
||||||
$this->position()->y(),
|
$this->drawable()->position()->y(),
|
||||||
$this->drawable->width(),
|
$this->drawable->width(),
|
||||||
$this->drawable->height(),
|
$this->drawable->height(),
|
||||||
0,
|
0,
|
||||||
@ -56,8 +57,8 @@ class DrawEllipseModifier extends AbstractDrawModifier
|
|||||||
imagealphablending($frame->native(), true);
|
imagealphablending($frame->native(), true);
|
||||||
imagefilledellipse(
|
imagefilledellipse(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$this->drawable()->position()->x(),
|
||||||
$this->position()->y(),
|
$this->drawable()->position()->y(),
|
||||||
$this->drawable->width(),
|
$this->drawable->width(),
|
||||||
$this->drawable->height(),
|
$this->drawable->height(),
|
||||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
|
@ -4,19 +4,22 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDrawModifier;
|
use RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Geometry\Line;
|
use Intervention\Image\Modifiers\DrawLineModifier as GenericDrawLineModifier;
|
||||||
|
|
||||||
/**
|
class DrawLineModifier extends GenericDrawLineModifier implements SpecializedInterface
|
||||||
* @method ColorInterface backgroundColor()
|
|
||||||
* @property Line $drawable
|
|
||||||
*/
|
|
||||||
class DrawLineModifier extends AbstractDrawModifier
|
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
$color = $this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
|
$this->backgroundColor()
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
imagealphablending($frame->native(), true);
|
imagealphablending($frame->native(), true);
|
||||||
imageantialias($frame->native(), true);
|
imageantialias($frame->native(), true);
|
||||||
@ -27,9 +30,7 @@ class DrawLineModifier extends AbstractDrawModifier
|
|||||||
$this->drawable->start()->y(),
|
$this->drawable->start()->y(),
|
||||||
$this->drawable->end()->x(),
|
$this->drawable->end()->x(),
|
||||||
$this->drawable->end()->y(),
|
$this->drawable->end()->y(),
|
||||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
$color
|
||||||
$this->backgroundColor()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,16 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Interfaces\PointInterface;
|
use Intervention\Image\Modifiers\DrawPixelModifier as GenericDrawPixelModifier;
|
||||||
|
|
||||||
/**
|
class DrawPixelModifier extends GenericDrawPixelModifier implements SpecializedInterface
|
||||||
* @property PointInterface $position
|
|
||||||
* @property mixed $color
|
|
||||||
*/
|
|
||||||
class DrawPixelModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,19 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDrawModifier;
|
use RuntimeException;
|
||||||
use Intervention\Image\Geometry\Polygon;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\DrawPolygonModifier as ModifiersDrawPolygonModifier;
|
||||||
|
|
||||||
/**
|
class DrawPolygonModifier extends ModifiersDrawPolygonModifier implements SpecializedInterface
|
||||||
* @method Point position()
|
|
||||||
* @method ColorInterface backgroundColor()
|
|
||||||
* @method ColorInterface borderColor()
|
|
||||||
* @property Polygon $drawable
|
|
||||||
*/
|
|
||||||
class DrawPolygonModifier extends AbstractDrawModifier
|
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
|
@ -4,32 +4,30 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDrawModifier;
|
use RuntimeException;
|
||||||
use Intervention\Image\Geometry\Rectangle;
|
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Geometry\Point;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\DrawRectangleModifier as GenericDrawRectangleModifier;
|
||||||
|
|
||||||
/**
|
class DrawRectangleModifier extends GenericDrawRectangleModifier implements SpecializedInterface
|
||||||
* @method Point position()
|
|
||||||
* @method ColorInterface backgroundColor()
|
|
||||||
* @method ColorInterface borderColor()
|
|
||||||
* @property Rectangle $drawable
|
|
||||||
*/
|
|
||||||
class DrawRectangleModifier extends AbstractDrawModifier
|
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
$position = $this->drawable->position();
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
// draw background
|
// draw background
|
||||||
if ($this->drawable->hasBackgroundColor()) {
|
if ($this->drawable->hasBackgroundColor()) {
|
||||||
imagealphablending($frame->native(), true);
|
imagealphablending($frame->native(), true);
|
||||||
imagefilledrectangle(
|
imagefilledrectangle(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$position->x(),
|
||||||
$this->position()->y(),
|
$position->y(),
|
||||||
$this->position()->x() + $this->drawable->width(),
|
$position->x() + $this->drawable->width(),
|
||||||
$this->position()->y() + $this->drawable->height(),
|
$position->y() + $this->drawable->height(),
|
||||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
$this->backgroundColor()
|
$this->backgroundColor()
|
||||||
)
|
)
|
||||||
@ -42,10 +40,10 @@ class DrawRectangleModifier extends AbstractDrawModifier
|
|||||||
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
imagesetthickness($frame->native(), $this->drawable->borderSize());
|
||||||
imagerectangle(
|
imagerectangle(
|
||||||
$frame->native(),
|
$frame->native(),
|
||||||
$this->position()->x(),
|
$position->x(),
|
||||||
$this->position()->y(),
|
$position->y(),
|
||||||
$this->position()->x() + $this->drawable->width(),
|
$position->x() + $this->drawable->width(),
|
||||||
$this->position()->y() + $this->drawable->height(),
|
$position->y() + $this->drawable->height(),
|
||||||
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
$this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
$this->borderColor()
|
$this->borderColor()
|
||||||
)
|
)
|
||||||
|
@ -4,19 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Frame;
|
use Intervention\Image\Drivers\Gd\Frame;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Geometry\Point;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Modifiers\FillModifier as GenericFillModifier;
|
||||||
|
|
||||||
/**
|
class FillModifier extends GenericFillModifier implements SpecializedInterface
|
||||||
* @method bool hasPosition()
|
|
||||||
* @property mixed $color
|
|
||||||
* @property null|Point $position
|
|
||||||
*/
|
|
||||||
class FillModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\GammaModifier as GenericGammaModifier;
|
||||||
|
|
||||||
/**
|
class GammaModifier extends GenericGammaModifier implements SpecializedInterface
|
||||||
* @property float $gamma
|
|
||||||
*/
|
|
||||||
class GammaModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\PixelateModifier as GenericPixelateModifier;
|
||||||
|
|
||||||
/**
|
class PixelateModifier extends GenericPixelateModifier implements SpecializedInterface
|
||||||
* @property int $size
|
|
||||||
*/
|
|
||||||
class PixelateModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,22 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\PointInterface;
|
use Intervention\Image\Interfaces\PointInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\PlaceModifier as GenericPlaceModifier;
|
||||||
|
|
||||||
/**
|
class PlaceModifier extends GenericPlaceModifier implements SpecializedInterface
|
||||||
* @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
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,16 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Exceptions\NotSupportedException;
|
use Intervention\Image\Exceptions\NotSupportedException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Interfaces\ProfileInterface;
|
use Intervention\Image\Modifiers\ProfileModifier as GenericProfileModifier;
|
||||||
|
|
||||||
/**
|
class ProfileModifier extends GenericProfileModifier implements SpecializedInterface
|
||||||
* @property ProfileInterface $profile
|
|
||||||
*/
|
|
||||||
class ProfileModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,17 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\InputException;
|
use Intervention\Image\Exceptions\InputException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\QuantizeColorsModifier as GenericQuantizeColorsModifier;
|
||||||
|
|
||||||
/**
|
class QuantizeColorsModifier extends GenericQuantizeColorsModifier implements SpecializedInterface
|
||||||
* @property int $limit
|
|
||||||
* @property mixed $background
|
|
||||||
*/
|
|
||||||
class QuantizeColorsModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\RemoveAnimationModifier as GenericRemoveAnimationModifier;
|
||||||
|
|
||||||
/**
|
class RemoveAnimationModifier extends GenericRemoveAnimationModifier implements SpecializedInterface
|
||||||
* @method mixed chosenFrame(ImageInterface $image, int|string $position)
|
|
||||||
* @property int|string $position
|
|
||||||
*/
|
|
||||||
class RemoveAnimationModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -7,20 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Green;
|
use Intervention\Image\Colors\Rgb\Channels\Green;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Red;
|
use Intervention\Image\Colors\Rgb\Channels\Red;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ResizeCanvasModifier as GenericResizeCanvasModifier;
|
||||||
|
|
||||||
/**
|
class ResizeCanvasModifier extends GenericResizeCanvasModifier implements SpecializedInterface
|
||||||
* @method SizeInterface cropSize(ImageInterface $image)
|
|
||||||
* @property mixed $background
|
|
||||||
*/
|
|
||||||
class ResizeCanvasModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
@ -55,8 +51,7 @@ class ResizeCanvasModifier extends DriverSpecialized implements ModifierInterfac
|
|||||||
127,
|
127,
|
||||||
);
|
);
|
||||||
|
|
||||||
imagealphablending($modified, false); // do not blend / just overwrite
|
imagealphablending($modified, false); // do not blend - just overwrite
|
||||||
// imagecolortransparent($modified, $transparent);
|
|
||||||
imagefilledrectangle(
|
imagefilledrectangle(
|
||||||
$modified,
|
$modified,
|
||||||
$resize->pivot()->x() * -1,
|
$resize->pivot()->x() * -1,
|
||||||
|
@ -7,10 +7,10 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @method SizeInterface cropSize(ImageInterface $image)
|
|
||||||
* @property mixed $background
|
|
||||||
*/
|
|
||||||
class ResizeCanvasRelativeModifier extends ResizeCanvasModifier
|
class ResizeCanvasRelativeModifier extends ResizeCanvasModifier
|
||||||
{
|
{
|
||||||
|
protected function cropSize(ImageInterface $image, bool $relative = false): SizeInterface
|
||||||
|
{
|
||||||
|
return parent::cropSize($image, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,20 +4,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ResizeModifier as GenericResizeModifier;
|
||||||
|
|
||||||
/**
|
class ResizeModifier extends GenericResizeModifier implements SpecializedInterface
|
||||||
* @property null|int $width
|
|
||||||
* @property null|int $height
|
|
||||||
*/
|
|
||||||
class ResizeModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ResolutionModifier as GenericResolutionModifier;
|
||||||
|
|
||||||
/**
|
class ResolutionModifier extends GenericResolutionModifier implements SpecializedInterface
|
||||||
* @property int $x
|
|
||||||
* @property int $y
|
|
||||||
*/
|
|
||||||
class ResolutionModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -7,20 +7,16 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
use Intervention\Image\Colors\Rgb\Channels\Blue;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Green;
|
use Intervention\Image\Colors\Rgb\Channels\Green;
|
||||||
use Intervention\Image\Colors\Rgb\Channels\Red;
|
use Intervention\Image\Colors\Rgb\Channels\Red;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Drivers\Gd\Cloner;
|
use Intervention\Image\Drivers\Gd\Cloner;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Geometry\Rectangle;
|
use Intervention\Image\Geometry\Rectangle;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\FrameInterface;
|
use Intervention\Image\Interfaces\FrameInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\RotateModifier as GenericRotateModifier;
|
||||||
|
|
||||||
/**
|
class RotateModifier extends GenericRotateModifier implements SpecializedInterface
|
||||||
* @method mixed rotationAngle()
|
|
||||||
* @property mixed $background
|
|
||||||
*/
|
|
||||||
class RotateModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property int $width
|
|
||||||
* @property int $height
|
|
||||||
*/
|
|
||||||
class ScaleDownModifier extends ResizeModifier
|
class ScaleDownModifier extends ResizeModifier
|
||||||
{
|
{
|
||||||
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
||||||
|
@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SizeInterface;
|
use Intervention\Image\Interfaces\SizeInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property int $width
|
|
||||||
* @property int $height
|
|
||||||
*/
|
|
||||||
class ScaleModifier extends ResizeModifier
|
class ScaleModifier extends ResizeModifier
|
||||||
{
|
{
|
||||||
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\SharpenModifier as GenericSharpenModifier;
|
||||||
|
|
||||||
/**
|
class SharpenModifier extends GenericSharpenModifier implements SpecializedInterface
|
||||||
* @property int $amount
|
|
||||||
*/
|
|
||||||
class SharpenModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,16 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Exceptions\AnimationException;
|
use Intervention\Image\Exceptions\AnimationException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\SliceAnimationModifier as GenericSliceAnimationModifier;
|
||||||
|
|
||||||
/**
|
class SliceAnimationModifier extends GenericSliceAnimationModifier implements SpecializedInterface
|
||||||
* @property int $offset
|
|
||||||
* @property null|int $length
|
|
||||||
*/
|
|
||||||
class SliceAnimationModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,20 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractTextModifier;
|
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Geometry\Point;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Interfaces\FontInterface;
|
use Intervention\Image\Modifiers\TextModifier as GenericTextModifier;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
|
||||||
|
|
||||||
/**
|
class TextModifier extends GenericTextModifier implements SpecializedInterface
|
||||||
* @property Point $position
|
|
||||||
* @property string $text
|
|
||||||
* @property FontInterface $font
|
|
||||||
*/
|
|
||||||
class TextModifier extends AbstractTextModifier implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -30,8 +23,8 @@ class TextModifier extends AbstractTextModifier implements ModifierInterface
|
|||||||
$lines = $fontProcessor->textBlock($this->text, $this->font, $this->position);
|
$lines = $fontProcessor->textBlock($this->text, $this->font, $this->position);
|
||||||
|
|
||||||
// decode text colors
|
// decode text colors
|
||||||
$textColor = $this->textColor($image);
|
$textColor = $this->gdTextColor($image);
|
||||||
$strokeColor = $this->strokeColor($image);
|
$strokeColor = $this->gdStrokeColor($image);
|
||||||
|
|
||||||
foreach ($image as $frame) {
|
foreach ($image as $frame) {
|
||||||
imagealphablending($frame->native(), true);
|
imagealphablending($frame->native(), true);
|
||||||
@ -90,46 +83,36 @@ class TextModifier extends AbstractTextModifier implements ModifierInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode text color
|
* Decode text color in GD compatible format
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
|
* @return int
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws ColorException
|
* @throws ColorException
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
protected function textColor(ImageInterface $image): int
|
protected function gdTextColor(ImageInterface $image): int
|
||||||
{
|
{
|
||||||
$color = $this->driver()->handleInput($this->font->color());
|
return $this
|
||||||
|
->driver()
|
||||||
if ($this->font->hasStrokeEffect() && $color->isTransparent()) {
|
->colorProcessor($image->colorspace())
|
||||||
throw new ColorException(
|
->colorToNative(parent::textColor());
|
||||||
'The text color must be fully opaque when using the stroke effect.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->driver()->colorProcessor($image->colorspace())->colorToNative($color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode outline stroke color
|
* Decode color for stroke (outline) effect in GD compatible format
|
||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
|
* @return int
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws ColorException
|
* @throws ColorException
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
protected function strokeColor(ImageInterface $image): int
|
protected function gdStrokeColor(ImageInterface $image): int
|
||||||
{
|
{
|
||||||
if (!$this->font->hasStrokeEffect()) {
|
if (!$this->font->hasStrokeEffect()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $this->driver()->handleInput($this->font->strokeColor());
|
$color = parent::strokeColor();
|
||||||
|
|
||||||
if ($color->isTransparent()) {
|
if ($color->isTransparent()) {
|
||||||
throw new ColorException(
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,13 +5,13 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\ColorspaceAnalyzer as GenericColorspaceAnalyzer;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Colors\Cmyk\Colorspace as CmykColorspace;
|
use Intervention\Image\Colors\Cmyk\Colorspace as CmykColorspace;
|
||||||
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\HeightAnalyzer as GenericHeightAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -5,19 +5,14 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\PixelColorAnalyzer as GenericPixelColorAnalyzer;
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\ColorspaceInterface;
|
use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class PixelColorAnalyzer extends GenericPixelColorAnalyzer implements SpecializedInterface
|
||||||
* @property int $x
|
|
||||||
* @property int $y
|
|
||||||
* @property int $frame_key
|
|
||||||
*/
|
|
||||||
class PixelColorAnalyzer extends DriverSpecialized implements AnalyzerInterface
|
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,6 @@ namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
|||||||
use Intervention\Image\Collection;
|
use Intervention\Image\Collection;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @property int $x
|
|
||||||
* @property int $y
|
|
||||||
*/
|
|
||||||
class PixelColorsAnalyzer extends PixelColorAnalyzer
|
class PixelColorsAnalyzer extends PixelColorAnalyzer
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
|
@ -4,13 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
|
use Intervention\Image\Analyzers\ProfileAnalyzer as GenericProfileAnalyzer;
|
||||||
use Intervention\Image\Colors\Profile;
|
use Intervention\Image\Colors\Profile;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Exceptions\ColorException;
|
use Intervention\Image\Exceptions\ColorException;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,12 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Resolution;
|
use Intervention\Image\Resolution;
|
||||||
|
|
||||||
class ResolutionAnalyzer extends DriverSpecialized implements AnalyzerInterface
|
class ResolutionAnalyzer extends GenericResolutionAnalyzer implements SpecializedInterface
|
||||||
{
|
{
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
namespace Intervention\Image\Drivers\Imagick\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Analyzers\WidthAnalyzer as GenericWidthAnalyzer;
|
||||||
use Intervention\Image\Interfaces\AnalyzerInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
|
|||||||
|
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class Base64ImageDecoder extends BinaryImageDecoder implements DecoderInterface
|
class Base64ImageDecoder extends BinaryImageDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -8,10 +8,9 @@ use Imagick;
|
|||||||
use ImagickException;
|
use ImagickException;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class BinaryImageDecoder extends ImagickImageDecoder implements DecoderInterface
|
class BinaryImageDecoder extends ImagickImageDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
|
|||||||
use Intervention\Image\Drivers\AbstractDecoder;
|
use Intervention\Image\Drivers\AbstractDecoder;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class ColorObjectDecoder extends AbstractDecoder implements DecoderInterface
|
class ColorObjectDecoder extends AbstractDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
|
|||||||
|
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class DataUriImageDecoder extends BinaryImageDecoder implements DecoderInterface
|
class DataUriImageDecoder extends BinaryImageDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -8,10 +8,9 @@ use Imagick;
|
|||||||
use ImagickException;
|
use ImagickException;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class FilePathImageDecoder extends ImagickImageDecoder implements DecoderInterface
|
class FilePathImageDecoder extends ImagickImageDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Decoders;
|
namespace Intervention\Image\Drivers\Imagick\Decoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDecoder;
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class ImageObjectDecoder extends AbstractDecoder implements DecoderInterface
|
class ImageObjectDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -5,17 +5,16 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Decoders;
|
namespace Intervention\Image\Drivers\Imagick\Decoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\AbstractDecoder;
|
|
||||||
use Intervention\Image\Drivers\Imagick\Core;
|
use Intervention\Image\Drivers\Imagick\Core;
|
||||||
use Intervention\Image\Drivers\Imagick\Driver;
|
use Intervention\Image\Drivers\Imagick\Driver;
|
||||||
|
use Intervention\Image\Drivers\SpecializableDecoder;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Image;
|
use Intervention\Image\Image;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Modifiers\AlignRotationModifier;
|
use Intervention\Image\Modifiers\AlignRotationModifier;
|
||||||
|
|
||||||
class ImagickImageDecoder extends AbstractDecoder implements DecoderInterface
|
class ImagickImageDecoder extends SpecializableDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -7,10 +7,9 @@ namespace Intervention\Image\Drivers\Imagick\Decoders;
|
|||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
use Intervention\Image\Interfaces\DecoderInterface;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class SplFileInfoImageDecoder extends FilePathImageDecoder implements DecoderInterface
|
class SplFileInfoImageDecoder extends FilePathImageDecoder
|
||||||
{
|
{
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@ -5,14 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\AvifEncoder as GenericAvifEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class AvifEncoder extends GenericAvifEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class AvifEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\BmpEncoder as GenericBmpEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\GifEncoder as GenericGifEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\HeicEncoder as GenericHeicEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\EncodedImageInterface;
|
use Intervention\Image\Interfaces\EncodedImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class HeicEncoder extends GenericHeicEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class HeicEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImageInterface
|
public function encode(ImageInterface $image): EncodedImageInterface
|
||||||
{
|
{
|
||||||
|
@ -5,15 +5,13 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\Jpeg2000Encoder as GenericJpeg2000Encoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\EncodedImageInterface;
|
use Intervention\Image\Interfaces\EncodedImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class Jpeg2000Encoder extends GenericJpeg2000Encoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class Jpeg2000Encoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImageInterface
|
public function encode(ImageInterface $image): EncodedImageInterface
|
||||||
{
|
{
|
||||||
|
@ -5,14 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\JpegEncoder as GenericJpegEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class JpegEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,12 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\PngEncoder as GenericPngEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -4,15 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
namespace Intervention\Image\Drivers\Imagick\Encoders;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\TiffEncoder as GenericTiffEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\EncodedImageInterface;
|
use Intervention\Image\Interfaces\EncodedImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class TiffEncoder extends GenericTiffEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class TiffEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImageInterface
|
public function encode(ImageInterface $image): EncodedImageInterface
|
||||||
{
|
{
|
||||||
|
@ -6,14 +6,12 @@ namespace Intervention\Image\Drivers\Imagick\Encoders;
|
|||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use ImagickPixel;
|
use ImagickPixel;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Encoders\WebpEncoder as GenericWebpEncoder;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
|
||||||
/**
|
class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
|
||||||
* @property int $quality
|
|
||||||
*/
|
|
||||||
class WebpEncoder extends DriverSpecializedEncoder
|
|
||||||
{
|
{
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
|
@ -5,11 +5,11 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
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
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -5,14 +5,11 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BlendTransparencyModifier as GenericBlendTransparencyModifier;
|
||||||
|
|
||||||
/**
|
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
|
||||||
* @property mixed $color
|
|
||||||
*/
|
|
||||||
class BlendTransparencyModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BlurModifier as GenericBlurModifier;
|
||||||
|
|
||||||
/**
|
class BlurModifier extends GenericBlurModifier implements SpecializedInterface
|
||||||
* @property int $amount
|
|
||||||
*/
|
|
||||||
class BlurModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -4,14 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier;
|
||||||
|
|
||||||
/**
|
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
|
||||||
* @property int $level
|
|
||||||
*/
|
|
||||||
class BrightnessModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
@ -5,16 +5,11 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
|
use Intervention\Image\Modifiers\ColorizeModifier as GenericColorizeModifier;
|
||||||
|
|
||||||
/**
|
class ColorizeModifier extends GenericColorizeModifier implements SpecializedInterface
|
||||||
* @property int $red
|
|
||||||
* @property int $green
|
|
||||||
* @property int $blue
|
|
||||||
*/
|
|
||||||
class ColorizeModifier extends DriverSpecialized implements ModifierInterface
|
|
||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user