mirror of
https://github.com/Intervention/image.git
synced 2025-08-19 12:11:26 +02:00
Rework
This commit is contained in:
@@ -25,8 +25,8 @@ abstract class AbstractDecoder extends DriverSpecialized implements DecoderInter
|
|||||||
* Try to decode given input to image or color object
|
* Try to decode given input to image or color object
|
||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @return ImageInterface|ColorInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface|ColorInterface
|
||||||
*/
|
*/
|
||||||
final public function handle(mixed $input): ImageInterface|ColorInterface
|
final public function handle(mixed $input): ImageInterface|ColorInterface
|
||||||
{
|
{
|
||||||
|
@@ -31,8 +31,8 @@ abstract class AbstractInputHandler implements InputHandlerInterface
|
|||||||
/**
|
/**
|
||||||
* Stack the decoder array into a nested decoder object
|
* Stack the decoder array into a nested decoder object
|
||||||
*
|
*
|
||||||
* @return AbstractDecoder
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return AbstractDecoder
|
||||||
*/
|
*/
|
||||||
protected function chain(): AbstractDecoder
|
protected function chain(): AbstractDecoder
|
||||||
{
|
{
|
||||||
|
@@ -13,8 +13,8 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
|||||||
* Return media (mime) type of the file at given file path
|
* Return media (mime) type of the file at given file path
|
||||||
*
|
*
|
||||||
* @param string $filepath
|
* @param string $filepath
|
||||||
* @return string
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getMediaTypeByFilePath(string $filepath): string
|
protected function getMediaTypeByFilePath(string $filepath): string
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,8 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
|||||||
* Return media (mime) type of the given image data
|
* Return media (mime) type of the given image data
|
||||||
*
|
*
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @return string
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getMediaTypeByBinary(string $data): string
|
protected function getMediaTypeByBinary(string $data): string
|
||||||
{
|
{
|
||||||
|
@@ -36,8 +36,8 @@ class BinaryImageDecoder extends GdImageDecoder implements DecoderInterface
|
|||||||
* Decode image from given binary data
|
* Decode image from given binary data
|
||||||
*
|
*
|
||||||
* @param string $input
|
* @param string $input
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
private function decodeBinary(string $input): ImageInterface
|
private function decodeBinary(string $input): ImageInterface
|
||||||
{
|
{
|
||||||
|
@@ -45,10 +45,10 @@ class FontProcessor extends AbstractFontProcessor
|
|||||||
*
|
*
|
||||||
* @param FontInterface $font
|
* @param FontInterface $font
|
||||||
* @param null|ImagickPixel $color
|
* @param null|ImagickPixel $color
|
||||||
* @return ImagickDraw
|
|
||||||
* @throws FontException
|
* @throws FontException
|
||||||
* @throws ImagickDrawException
|
* @throws ImagickDrawException
|
||||||
* @throws ImagickException
|
* @throws ImagickException
|
||||||
|
* @return ImagickDraw
|
||||||
*/
|
*/
|
||||||
public function toImagickDraw(FontInterface $font, ?ImagickPixel $color = null): ImagickDraw
|
public function toImagickDraw(FontInterface $font, ?ImagickPixel $color = null): ImagickDraw
|
||||||
{
|
{
|
||||||
|
@@ -41,8 +41,8 @@ class FileExtensionEncoder extends AutoEncoder
|
|||||||
* Create matching encoder for given file extension
|
* Create matching encoder for given file extension
|
||||||
*
|
*
|
||||||
* @param string $extension
|
* @param string $extension
|
||||||
* @return EncoderInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncoderInterface
|
||||||
*/
|
*/
|
||||||
protected function encoderByFileExtension(?string $extension): EncoderInterface
|
protected function encoderByFileExtension(?string $extension): EncoderInterface
|
||||||
{
|
{
|
||||||
|
@@ -34,8 +34,8 @@ class MediaTypeEncoder extends SpecializableEncoder implements EncoderInterface
|
|||||||
* Return new encoder by given media (MIME) type
|
* Return new encoder by given media (MIME) type
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return EncoderInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncoderInterface
|
||||||
*/
|
*/
|
||||||
protected function encoderByMediaType(string $type): EncoderInterface
|
protected function encoderByMediaType(string $type): EncoderInterface
|
||||||
{
|
{
|
||||||
|
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image;
|
namespace Intervention\Image;
|
||||||
|
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
|
||||||
use Traversable;
|
use Traversable;
|
||||||
use Intervention\Image\Analyzers\ColorspaceAnalyzer;
|
use Intervention\Image\Analyzers\ColorspaceAnalyzer;
|
||||||
use Intervention\Image\Analyzers\HeightAnalyzer;
|
use Intervention\Image\Analyzers\HeightAnalyzer;
|
||||||
@@ -892,8 +891,8 @@ final class Image implements ImageInterface
|
|||||||
* Alias of self::toJpeg()
|
* Alias of self::toJpeg()
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
|
* @throws EncoderException
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function toJpg(mixed ...$options): EncodedImageInterface
|
public function toJpg(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -914,8 +913,8 @@ final class Image implements ImageInterface
|
|||||||
* ALias of self::toJpeg2000()
|
* ALias of self::toJpeg2000()
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
|
* @throws EncoderException
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function toJp2(mixed ...$options): EncodedImageInterface
|
public function toJp2(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -965,8 +964,8 @@ final class Image implements ImageInterface
|
|||||||
/**
|
/**
|
||||||
* Alias if self::toBitmap()
|
* Alias if self::toBitmap()
|
||||||
*
|
*
|
||||||
|
* @throws EncoderException
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function toBmp(mixed ...$options): EncodedImageInterface
|
public function toBmp(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -997,8 +996,8 @@ final class Image implements ImageInterface
|
|||||||
* Alias of self::toTiff()
|
* Alias of self::toTiff()
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
|
* @throws EncoderException
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function toTif(mixed ...$options): EncodedImageInterface
|
public function toTif(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
|
@@ -88,8 +88,8 @@ final class ImageManager
|
|||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @param string|array|DecoderInterface $decoders
|
* @param string|array|DecoderInterface $decoders
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface
|
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface
|
||||||
{
|
{
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
|
||||||
interface ColorInterface
|
interface ColorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -11,8 +13,8 @@ interface ColorInterface
|
|||||||
* and returns a corresponding color object
|
* and returns a corresponding color object
|
||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
|
* @throws DecoderException
|
||||||
* @return ColorInterface
|
* @return ColorInterface
|
||||||
* @throws \Intervention\Image\Exceptions\DecoderException
|
|
||||||
*/
|
*/
|
||||||
public static function create(mixed $input): self;
|
public static function create(mixed $input): self;
|
||||||
|
|
||||||
|
@@ -12,8 +12,8 @@ interface DecoderInterface
|
|||||||
* Decode given input either to color or image
|
* Decode given input either to color or image
|
||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @return ImageInterface|ColorInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface|ColorInterface
|
||||||
*/
|
*/
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface;
|
public function decode(mixed $input): ImageInterface|ColorInterface;
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
use Intervention\Image\Exceptions\DecoderException;
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
|
|
||||||
interface DriverInterface
|
interface DriverInterface
|
||||||
{
|
{
|
||||||
@@ -53,8 +54,8 @@ interface DriverInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @param array $decoders
|
* @param array $decoders
|
||||||
* @return ImageInterface|ColorInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface|ColorInterface
|
||||||
*/
|
*/
|
||||||
public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface;
|
public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface;
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ interface DriverInterface
|
|||||||
* Check whether all requirements for operating the driver are met and
|
* Check whether all requirements for operating the driver are met and
|
||||||
* throw exception if the check fails.
|
* throw exception if the check fails.
|
||||||
*
|
*
|
||||||
* @throws \Intervention\Image\Exceptions\RuntimeException
|
* @throws RuntimeException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkHealth(): void;
|
public function checkHealth(): void;
|
||||||
|
@@ -12,8 +12,8 @@ interface EncoderInterface
|
|||||||
* Encode given image
|
* Encode given image
|
||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function encode(ImageInterface $image): EncodedImageInterface;
|
public function encode(ImageInterface $image): EncodedImageInterface;
|
||||||
}
|
}
|
||||||
|
@@ -67,8 +67,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image with given encoder
|
* Encode image with given encoder
|
||||||
*
|
*
|
||||||
* @param EncoderInterface $encoder
|
* @param EncoderInterface $encoder
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface;
|
public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -77,8 +77,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* given, the image will be saved at its original location.
|
* given, the image will be saved at its original location.
|
||||||
*
|
*
|
||||||
* @param null|string $path
|
* @param null|string $path
|
||||||
* @return ImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function save(?string $path = null, ...$options): self;
|
public function save(?string $path = null, ...$options): self;
|
||||||
|
|
||||||
@@ -86,8 +86,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Apply given modifier to current image
|
* Apply given modifier to current image
|
||||||
*
|
*
|
||||||
* @param ModifierInterface $modifier
|
* @param ModifierInterface $modifier
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function modify(ModifierInterface $modifier): self;
|
public function modify(ModifierInterface $modifier): self;
|
||||||
|
|
||||||
@@ -115,8 +115,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* and the respective frame position is only determined approximately.
|
* and the respective frame position is only determined approximately.
|
||||||
*
|
*
|
||||||
* @param int|string $position
|
* @param int|string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function removeAnimation(int|string $position = 0): self;
|
public function removeAnimation(int|string $position = 0): self;
|
||||||
|
|
||||||
@@ -125,8 +125,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @param null|int $length
|
* @param null|int $length
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
|
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
|
||||||
|
|
||||||
@@ -172,8 +172,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param float $x
|
* @param float $x
|
||||||
* @param float $y
|
* @param float $y
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function setResolution(float $x, float $y): self;
|
public function setResolution(float $x, float $y): self;
|
||||||
|
|
||||||
@@ -188,8 +188,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Transform image to given colorspace
|
* Transform image to given colorspace
|
||||||
*
|
*
|
||||||
* @param string|ColorspaceInterface $colorspace
|
* @param string|ColorspaceInterface $colorspace
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function setColorspace(string|ColorspaceInterface $colorspace): self;
|
public function setColorspace(string|ColorspaceInterface $colorspace): self;
|
||||||
|
|
||||||
@@ -225,8 +225,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* which does not support transparency.
|
* which does not support transparency.
|
||||||
*
|
*
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function setBlendingColor(mixed $color): self;
|
public function setBlendingColor(mixed $color): self;
|
||||||
|
|
||||||
@@ -234,8 +234,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Replace transparent areas of the image with given color
|
* Replace transparent areas of the image with given color
|
||||||
*
|
*
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function blendTransparency(mixed $color = null): self;
|
public function blendTransparency(mixed $color = null): self;
|
||||||
|
|
||||||
@@ -250,16 +250,16 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Set given icc color profile to image
|
* Set given icc color profile to image
|
||||||
*
|
*
|
||||||
* @param ProfileInterface $profile
|
* @param ProfileInterface $profile
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function setProfile(ProfileInterface $profile): self;
|
public function setProfile(ProfileInterface $profile): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove ICC color profile from the current image
|
* Remove ICC color profile from the current image
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function removeProfile(): self;
|
public function removeProfile(): self;
|
||||||
|
|
||||||
@@ -268,8 +268,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function reduceColors(int $limit, mixed $background = 'transparent'): self;
|
public function reduceColors(int $limit, mixed $background = 'transparent'): self;
|
||||||
|
|
||||||
@@ -277,16 +277,16 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Sharpen the current image with given strength
|
* Sharpen the current image with given strength
|
||||||
*
|
*
|
||||||
* @param int $amount
|
* @param int $amount
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function sharpen(int $amount = 10): self;
|
public function sharpen(int $amount = 10): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn image into a greyscale version
|
* Turn image into a greyscale version
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function greyscale(): self;
|
public function greyscale(): self;
|
||||||
|
|
||||||
@@ -294,8 +294,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Adjust brightness of the current image
|
* Adjust brightness of the current image
|
||||||
*
|
*
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function brightness(int $level): self;
|
public function brightness(int $level): self;
|
||||||
|
|
||||||
@@ -303,8 +303,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Adjust color contrast of the current image
|
* Adjust color contrast of the current image
|
||||||
*
|
*
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function contrast(int $level): self;
|
public function contrast(int $level): self;
|
||||||
|
|
||||||
@@ -312,8 +312,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Apply gamma correction on the current image
|
* Apply gamma correction on the current image
|
||||||
*
|
*
|
||||||
* @param float $gamma
|
* @param float $gamma
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function gamma(float $gamma): self;
|
public function gamma(float $gamma): self;
|
||||||
|
|
||||||
@@ -323,24 +323,24 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $red
|
* @param int $red
|
||||||
* @param int $green
|
* @param int $green
|
||||||
* @param int $blue
|
* @param int $blue
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
|
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mirror the current image horizontally
|
* Mirror the current image horizontally
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function flip(): self;
|
public function flip(): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mirror the current image vertically
|
* Mirror the current image vertically
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function flop(): self;
|
public function flop(): self;
|
||||||
|
|
||||||
@@ -348,16 +348,16 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Blur current image by given strength
|
* Blur current image by given strength
|
||||||
*
|
*
|
||||||
* @param int $amount
|
* @param int $amount
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function blur(int $amount = 5): self;
|
public function blur(int $amount = 5): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invert the colors of the current image
|
* Invert the colors of the current image
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function invert(): self;
|
public function invert(): self;
|
||||||
|
|
||||||
@@ -365,8 +365,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Apply pixelation filter effect on current image
|
* Apply pixelation filter effect on current image
|
||||||
*
|
*
|
||||||
* @param int $size
|
* @param int $size
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function pixelate(int $size): self;
|
public function pixelate(int $size): self;
|
||||||
|
|
||||||
@@ -375,8 +375,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param float $angle
|
* @param float $angle
|
||||||
* @param string $background
|
* @param string $background
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function rotate(float $angle, mixed $background = 'ffffff'): self;
|
public function rotate(float $angle, mixed $background = 'ffffff'): self;
|
||||||
|
|
||||||
@@ -387,8 +387,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable|FontInterface $font
|
* @param callable|FontInterface $font
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
|
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
|
||||||
|
|
||||||
@@ -397,8 +397,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function resize(?int $width = null, ?int $height = null): self;
|
public function resize(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -407,8 +407,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function resizeDown(?int $width = null, ?int $height = null): self;
|
public function resizeDown(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -417,8 +417,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function scale(?int $width = null, ?int $height = null): self;
|
public function scale(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -428,8 +428,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function scaleDown(?int $width = null, ?int $height = null): self;
|
public function scaleDown(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -441,8 +441,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $width
|
* @param int $width
|
||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function cover(int $width, int $height, string $position = 'center'): self;
|
public function cover(int $width, int $height, string $position = 'center'): self;
|
||||||
|
|
||||||
@@ -452,8 +452,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $width
|
* @param int $width
|
||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function coverDown(int $width, int $height, string $position = 'center'): self;
|
public function coverDown(int $width, int $height, string $position = 'center'): self;
|
||||||
|
|
||||||
@@ -467,8 +467,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function resizeCanvas(
|
public function resizeCanvas(
|
||||||
?int $width = null,
|
?int $width = null,
|
||||||
@@ -486,8 +486,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function resizeCanvasRelative(
|
public function resizeCanvasRelative(
|
||||||
?int $width = null,
|
?int $width = null,
|
||||||
@@ -509,8 +509,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $background
|
* @param string $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function pad(
|
public function pad(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -527,8 +527,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $background
|
* @param string $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function contain(
|
public function contain(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -548,8 +548,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $offset_y
|
* @param int $offset_y
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function crop(
|
public function crop(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -568,8 +568,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $offset_x
|
* @param int $offset_x
|
||||||
* @param int $offset_y
|
* @param int $offset_y
|
||||||
* @param int $opacity
|
* @param int $opacity
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function place(
|
public function place(
|
||||||
mixed $element,
|
mixed $element,
|
||||||
@@ -592,8 +592,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @param null|int $x
|
* @param null|int $x
|
||||||
* @param null|int $y
|
* @param null|int $y
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function fill(mixed $color, ?int $x = null, ?int $y = null): self;
|
public function fill(mixed $color, ?int $x = null, ?int $y = null): self;
|
||||||
|
|
||||||
@@ -603,8 +603,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawPixel(int $x, int $y, mixed $color): self;
|
public function drawPixel(int $x, int $y, mixed $color): self;
|
||||||
|
|
||||||
@@ -614,8 +614,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawRectangle(int $x, int $y, callable $init): self;
|
public function drawRectangle(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -625,8 +625,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawEllipse(int $x, int $y, callable $init): self;
|
public function drawEllipse(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -636,8 +636,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawCircle(int $x, int $y, callable $init): self;
|
public function drawCircle(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -645,8 +645,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Draw a polygon on the current image
|
* Draw a polygon on the current image
|
||||||
*
|
*
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawPolygon(callable $init): self;
|
public function drawPolygon(callable $init): self;
|
||||||
|
|
||||||
@@ -654,8 +654,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Draw a line on the current image
|
* Draw a line on the current image
|
||||||
*
|
*
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function drawLine(callable $init): self;
|
public function drawLine(callable $init): self;
|
||||||
|
|
||||||
@@ -664,8 +664,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* will be encoded to the format of the originally read image.
|
* will be encoded to the format of the originally read image.
|
||||||
*
|
*
|
||||||
* @param null|string $type
|
* @param null|string $type
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface;
|
public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -675,8 +675,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* originally read image.
|
* originally read image.
|
||||||
*
|
*
|
||||||
* @param null|string $extension
|
* @param null|string $extension
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface;
|
public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -686,8 +686,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* the format of the originally read image.
|
* the format of the originally read image.
|
||||||
*
|
*
|
||||||
* @param null|string $path
|
* @param null|string $path
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface;
|
public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -695,8 +695,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to JPEG format
|
* Encode image to JPEG format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function toJpeg(mixed ...$options): EncodedImageInterface;
|
public function toJpeg(mixed ...$options): EncodedImageInterface;
|
||||||
@@ -705,8 +705,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to Jpeg2000 format
|
* Encode image to Jpeg2000 format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toJpeg2000(mixed ...$options): EncodedImageInterface;
|
public function toJpeg2000(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -714,8 +714,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to Webp format
|
* Encode image to Webp format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toWebp(mixed ...$options): EncodedImageInterface;
|
public function toWebp(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -723,8 +723,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to PNG format
|
* Encode image to PNG format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toPng(mixed ...$options): EncodedImageInterface;
|
public function toPng(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -732,8 +732,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to GIF format
|
* Encode image to GIF format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toGif(mixed ...$options): EncodedImageInterface;
|
public function toGif(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -741,8 +741,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to Bitmap format
|
* Encode image to Bitmap format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toBitmap(mixed ...$options): EncodedImageInterface;
|
public function toBitmap(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -750,8 +750,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to AVIF format
|
* Encode image to AVIF format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toAvif(mixed ...$options): EncodedImageInterface;
|
public function toAvif(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -759,8 +759,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to TIFF format
|
* Encode image to TIFF format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toTiff(mixed ...$options): EncodedImageInterface;
|
public function toTiff(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -768,8 +768,8 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Encode image to HEIC format
|
* Encode image to HEIC format
|
||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
|
||||||
* @throws EncoderException
|
* @throws EncoderException
|
||||||
|
* @return EncodedImageInterface
|
||||||
*/
|
*/
|
||||||
public function toHeic(mixed ...$options): EncodedImageInterface;
|
public function toHeic(mixed ...$options): EncodedImageInterface;
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,8 @@ interface InputHandlerInterface
|
|||||||
* Try to decode the given input with each decoder of the the handler chain
|
* Try to decode the given input with each decoder of the the handler chain
|
||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @return ImageInterface|ColorInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface|ColorInterface
|
||||||
*/
|
*/
|
||||||
public function handle($input): ImageInterface|ColorInterface;
|
public function handle($input): ImageInterface|ColorInterface;
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,8 @@ interface ModifierInterface
|
|||||||
* Apply modifications of the current modifier to the given image
|
* Apply modifications of the current modifier to the given image
|
||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
* @return ImageInterface
|
|
||||||
* @throws DecoderException
|
* @throws DecoderException
|
||||||
|
* @return ImageInterface
|
||||||
*/
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface;
|
public function apply(ImageInterface $image): ImageInterface;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user