mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
Add decoder and encoder thrown exception
This commit is contained in:
parent
fe1b0e2e64
commit
3e87be6a63
@ -32,6 +32,7 @@ abstract class AbstractInputHandler implements InputHandlerInterface
|
||||
* Stack the decoder array into a nested decoder object
|
||||
*
|
||||
* @return AbstractDecoder
|
||||
* @throws DecoderException
|
||||
*/
|
||||
protected function chain(): AbstractDecoder
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
||||
*
|
||||
* @param string $filepath
|
||||
* @return string
|
||||
* @throws DecoderException
|
||||
*/
|
||||
protected function getMediaTypeByFilePath(string $filepath): string
|
||||
{
|
||||
@ -35,6 +36,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
||||
*
|
||||
* @param string $data
|
||||
* @return string
|
||||
* @throws DecoderException
|
||||
*/
|
||||
protected function getMediaTypeByBinary(string $data): string
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Intervention\Image\Drivers\Gd;
|
||||
|
||||
use Intervention\Image\Drivers\AbstractDriver;
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Exceptions\RuntimeException;
|
||||
use Intervention\Image\Image;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
@ -79,6 +80,9 @@ class Driver extends AbstractDriver
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function add($source, float $delay = 1): self
|
||||
{
|
||||
$this->core->add(
|
||||
|
@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Gd\Encoders;
|
||||
use Intervention\Gif\Builder as GifBuilder;
|
||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
||||
use Intervention\Image\EncodedImage;
|
||||
use Intervention\Image\Exceptions\EncoderException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class GifEncoder extends DriverSpecializedEncoder
|
||||
@ -25,6 +26,9 @@ class GifEncoder extends DriverSpecializedEncoder
|
||||
return new EncodedImage($data, 'image/gif');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws EncoderException
|
||||
*/
|
||||
protected function encodeAnimated(ImageInterface $image): EncodedImage
|
||||
{
|
||||
$builder = GifBuilder::canvas(
|
||||
|
@ -6,6 +6,7 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\DriverSpecialized;
|
||||
use Intervention\Image\Drivers\Gd\Frame;
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Interfaces\ModifierInterface;
|
||||
@ -32,6 +33,9 @@ class FillModifier extends DriverSpecialized implements ModifierInterface
|
||||
return $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DecoderException
|
||||
*/
|
||||
private function color(ImageInterface $image): int
|
||||
{
|
||||
return $this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||
|
@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Imagick;
|
||||
use Imagick;
|
||||
use ImagickPixel;
|
||||
use Intervention\Image\Drivers\AbstractDriver;
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Exceptions\RuntimeException;
|
||||
use Intervention\Image\Image;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
@ -81,6 +82,9 @@ class Driver extends AbstractDriver
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function add($source, float $delay = 1): self
|
||||
{
|
||||
$native = $this->driver->handleInput($source)->core()->native();
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class AnimationException extends \RuntimeException
|
||||
class AnimationException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class ColorException extends \RuntimeException
|
||||
class ColorException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class DecoderException extends \RuntimeException
|
||||
class DecoderException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class EncoderException extends \RuntimeException
|
||||
class EncoderException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class FontException extends \RuntimeException
|
||||
class FontException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class GeometryException extends \RuntimeException
|
||||
class GeometryException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class InputException extends \RuntimeException
|
||||
class InputException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class NotSupportedException extends \RuntimeException
|
||||
class NotSupportedException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Exceptions;
|
||||
|
||||
class NotWritableException extends \RuntimeException
|
||||
class NotWritableException extends RuntimeException
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image;
|
||||
|
||||
use Intervention\Image\Exceptions\RuntimeException;
|
||||
use Traversable;
|
||||
use Intervention\Image\Analyzers\ColorspaceAnalyzer;
|
||||
use Intervention\Image\Analyzers\HeightAnalyzer;
|
||||
@ -892,6 +893,7 @@ final class Image implements ImageInterface
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function toJpg(mixed ...$options): EncodedImageInterface
|
||||
{
|
||||
@ -913,6 +915,7 @@ final class Image implements ImageInterface
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function toJp2(mixed ...$options): EncodedImageInterface
|
||||
{
|
||||
@ -963,6 +966,7 @@ final class Image implements ImageInterface
|
||||
* Alias if self::toBitmap()
|
||||
*
|
||||
* @return EncodedImageInterface
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function toBmp(mixed ...$options): EncodedImageInterface
|
||||
{
|
||||
@ -994,6 +998,7 @@ final class Image implements ImageInterface
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function toTif(mixed ...$options): EncodedImageInterface
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image;
|
||||
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Interfaces\DriverInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
|
||||
@ -88,6 +89,7 @@ final class ImageManager
|
||||
* @param mixed $input
|
||||
* @param string|array|DecoderInterface $decoders
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface
|
||||
{
|
||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
|
||||
interface DecoderInterface
|
||||
{
|
||||
/**
|
||||
@ -11,6 +13,7 @@ interface DecoderInterface
|
||||
*
|
||||
* @param mixed $input
|
||||
* @return ImageInterface|ColorInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
|
||||
interface DriverInterface
|
||||
{
|
||||
/**
|
||||
@ -52,6 +54,7 @@ interface DriverInterface
|
||||
* @param mixed $input
|
||||
* @param array $decoders
|
||||
* @return ImageInterface|ColorInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface;
|
||||
|
||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Intervention\Image\Exceptions\EncoderException;
|
||||
|
||||
interface EncoderInterface
|
||||
{
|
||||
/**
|
||||
@ -11,6 +13,7 @@ interface EncoderInterface
|
||||
*
|
||||
* @param ImageInterface $image
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImageInterface;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Countable;
|
||||
use Intervention\Image\Encoders\AutoEncoder;
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
use Intervention\Image\Exceptions\EncoderException;
|
||||
use Intervention\Image\Origin;
|
||||
use IteratorAggregate;
|
||||
|
||||
@ -66,6 +68,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param EncoderInterface $encoder
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface;
|
||||
|
||||
@ -75,6 +78,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param null|string $path
|
||||
* @return ImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function save(?string $path = null, ...$options): self;
|
||||
|
||||
@ -83,6 +87,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param ModifierInterface $modifier
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function modify(ModifierInterface $modifier): self;
|
||||
|
||||
@ -111,6 +116,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int|string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function removeAnimation(int|string $position = 0): self;
|
||||
|
||||
@ -120,6 +126,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $offset
|
||||
* @param null|int $length
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
|
||||
|
||||
@ -166,6 +173,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function setResolution(float $x, float $y): self;
|
||||
|
||||
@ -181,6 +189,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param string|ColorspaceInterface $colorspace
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function setColorspace(string|ColorspaceInterface $colorspace): self;
|
||||
|
||||
@ -217,6 +226,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $color
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function setBlendingColor(mixed $color): self;
|
||||
|
||||
@ -225,6 +235,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $color
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function blendTransparency(mixed $color = null): self;
|
||||
|
||||
@ -240,6 +251,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param ProfileInterface $profile
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function setProfile(ProfileInterface $profile): self;
|
||||
|
||||
@ -247,6 +259,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* Remove ICC color profile from the current image
|
||||
*
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function removeProfile(): self;
|
||||
|
||||
@ -256,6 +269,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $limit
|
||||
* @param mixed $background
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function reduceColors(int $limit, mixed $background = 'transparent'): self;
|
||||
|
||||
@ -264,6 +278,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int $amount
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function sharpen(int $amount = 10): self;
|
||||
|
||||
@ -271,6 +286,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* Turn image into a greyscale version
|
||||
*
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function greyscale(): self;
|
||||
|
||||
@ -279,6 +295,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int $level
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function brightness(int $level): self;
|
||||
|
||||
@ -287,6 +304,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int $level
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function contrast(int $level): self;
|
||||
|
||||
@ -295,6 +313,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param float $gamma
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function gamma(float $gamma): self;
|
||||
|
||||
@ -305,6 +324,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
|
||||
|
||||
@ -312,6 +332,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* Mirror the current image horizontally
|
||||
*
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function flip(): self;
|
||||
|
||||
@ -319,6 +340,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* Mirror the current image vertically
|
||||
*
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function flop(): self;
|
||||
|
||||
@ -327,6 +349,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int $amount
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function blur(int $amount = 5): self;
|
||||
|
||||
@ -334,6 +357,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* Invert the colors of the current image
|
||||
*
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function invert(): self;
|
||||
|
||||
@ -342,6 +366,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param int $size
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function pixelate(int $size): self;
|
||||
|
||||
@ -351,6 +376,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param float $angle
|
||||
* @param string $background
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function rotate(float $angle, mixed $background = 'ffffff'): self;
|
||||
|
||||
@ -362,6 +388,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $y
|
||||
* @param callable|FontInterface $font
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
|
||||
|
||||
@ -371,6 +398,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function resize(?int $width = null, ?int $height = null): self;
|
||||
|
||||
@ -380,6 +408,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function resizeDown(?int $width = null, ?int $height = null): self;
|
||||
|
||||
@ -389,6 +418,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function scale(?int $width = null, ?int $height = null): self;
|
||||
|
||||
@ -399,6 +429,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function scaleDown(?int $width = null, ?int $height = null): self;
|
||||
|
||||
@ -411,6 +442,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $height
|
||||
* @param string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function cover(int $width, int $height, string $position = 'center'): self;
|
||||
|
||||
@ -421,6 +453,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $height
|
||||
* @param string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function coverDown(int $width, int $height, string $position = 'center'): self;
|
||||
|
||||
@ -435,6 +468,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param string $position
|
||||
* @param mixed $background
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function resizeCanvas(
|
||||
?int $width = null,
|
||||
@ -453,6 +487,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param string $position
|
||||
* @param mixed $background
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function resizeCanvasRelative(
|
||||
?int $width = null,
|
||||
@ -475,6 +510,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param string $background
|
||||
* @param string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function pad(
|
||||
int $width,
|
||||
@ -492,6 +528,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param string $background
|
||||
* @param string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function contain(
|
||||
int $width,
|
||||
@ -512,6 +549,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param mixed $background
|
||||
* @param string $position
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function crop(
|
||||
int $width,
|
||||
@ -531,6 +569,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $offset_y
|
||||
* @param int $opacity
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function place(
|
||||
mixed $element,
|
||||
@ -554,6 +593,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param null|int $x
|
||||
* @param null|int $y
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function fill(mixed $color, ?int $x = null, ?int $y = null): self;
|
||||
|
||||
@ -564,6 +604,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $y
|
||||
* @param mixed $color
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawPixel(int $x, int $y, mixed $color): self;
|
||||
|
||||
@ -574,6 +615,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $y
|
||||
* @param callable $init
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawRectangle(int $x, int $y, callable $init): self;
|
||||
|
||||
@ -584,6 +626,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $y
|
||||
* @param callable $init
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawEllipse(int $x, int $y, callable $init): self;
|
||||
|
||||
@ -594,6 +637,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
* @param int $y
|
||||
* @param callable $init
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawCircle(int $x, int $y, callable $init): self;
|
||||
|
||||
@ -602,6 +646,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param callable $init
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawPolygon(callable $init): self;
|
||||
|
||||
@ -610,6 +655,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param callable $init
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function drawLine(callable $init): self;
|
||||
|
||||
@ -619,6 +665,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param null|string $type
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface;
|
||||
|
||||
@ -629,6 +676,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param null|string $extension
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -639,6 +687,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param null|string $path
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -647,6 +696,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
|
||||
public function toJpeg(mixed ...$options): EncodedImageInterface;
|
||||
@ -656,6 +706,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toJpeg2000(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -664,6 +715,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toWebp(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -672,6 +724,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toPng(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -680,6 +733,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toGif(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -688,6 +742,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toBitmap(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -696,6 +751,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toAvif(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -704,6 +760,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toTiff(mixed ...$options): EncodedImageInterface;
|
||||
|
||||
@ -712,6 +769,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
||||
*
|
||||
* @param mixed $options
|
||||
* @return EncodedImageInterface
|
||||
* @throws EncoderException
|
||||
*/
|
||||
public function toHeic(mixed ...$options): EncodedImageInterface;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
|
||||
interface InputHandlerInterface
|
||||
{
|
||||
/**
|
||||
@ -11,6 +13,7 @@ interface InputHandlerInterface
|
||||
*
|
||||
* @param mixed $input
|
||||
* @return ImageInterface|ColorInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function handle($input): ImageInterface|ColorInterface;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Interfaces;
|
||||
|
||||
use Intervention\Image\Exceptions\DecoderException;
|
||||
|
||||
interface ModifierInterface
|
||||
{
|
||||
/**
|
||||
@ -11,6 +13,7 @@ interface ModifierInterface
|
||||
*
|
||||
* @param ImageInterface $image
|
||||
* @return ImageInterface
|
||||
* @throws DecoderException
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user