Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s

- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-25 20:35:30 +00:00
parent 7197eaebf2
commit 9c0f8de791
15771 changed files with 1564103 additions and 5 deletions

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface AnalyzerInterface
{
/**
* Analyze given image and return the retrieved data.
*/
public function analyze(ImageInterface $image): mixed;
}

View file

@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Alignment;
use Intervention\Image\Direction;
use Intervention\Image\Fraction;
// phpcs:disable Generic.Files.LineLength
/**
* @method ImageInterface width()
* @method ImageInterface height()
* @method ImageInterface size()
* @method ImageInterface modify(ModifierInterface $modifier)
* @method ImageInterface analyze(AnalyzerInterface $analyzer)
* @method ImageInterface isAnimated()
* @method ImageInterface removeAnimation(int|string $position = 0)
* @method ImageInterface sliceAnimation(int $offset = 0, ?int $length = null)
* @method ImageInterface colorAt(int $x, int $y, int $frame = 0)
* @method ImageInterface colorsAt(int $x, int $y)
* @method ImageInterface fillTransparentAreas(null|string|ColorInterface $color = null)
* @method ImageInterface reduceColors(int $limit, null|string|ColorInterface $background = null)
* @method ImageInterface sharpen(int $level = 10)
* @method ImageInterface grayscale()
* @method ImageInterface brightness(int $level)
* @method ImageInterface contrast(int $level)
* @method ImageInterface gamma(float $gamma)
* @method ImageInterface colorize(int $red = 0, int $green = 0, int $blue = 0)
* @method ImageInterface flip(Direction $direction = Direction::HORIZONTAL)
* @method ImageInterface blur(int $level = 5)
* @method ImageInterface invert()
* @method ImageInterface pixelate(int $size)
* @method ImageInterface rotate(float $angle, null|string|ColorInterface $background = null)
* @method ImageInterface orient()
* @method ImageInterface text(string $text, int $x, int $y, callable|FontInterface $font)
* @method ImageInterface resize(null|int|Fraction $width = null, null|int|Fraction $height = null)
* @method ImageInterface resizeDown(null|int|Fraction $width = null, null|int|Fraction $height = null)
* @method ImageInterface scale(null|int|Fraction $width = null, null|int|Fraction $height = null)
* @method ImageInterface scaleDown(null|int|Fraction $width = null, null|int|Fraction $height = null)
* @method ImageInterface cover(int|Fraction $width, int|Fraction $height, string|Alignment $alignment = Alignment::CENTER)
* @method ImageInterface coverDown(int|Fraction $width, int|Fraction $height, string|Alignment $alignment = Alignment::CENTER)
* @method ImageInterface resizeCanvas(null|int|Fraction $width = null, null|int|Fraction $height = null, null|string|ColorInterface $background = null, string|Alignment $alignment = Alignment::CENTER)
*/
// phpcs:enable Generic.Files.LineLength
interface AnimationFactoryInterface
{
/**
* Create the animation of the factory statically by calling given callable.
*/
public static function build(int $width, int $height, callable $animation, DriverInterface $driver): ImageInterface;
/**
* Resolve image or color from given source and add it as new animation frame with specific delay in seconds.
*/
public function add(mixed $source, float $delay = 1): self;
/**
* Build the animation as an image.
*/
public function image(DriverInterface $driver): ImageInterface;
}

View file

@ -0,0 +1,86 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Traversable;
/**
* @extends Traversable<int|string, mixed>
*/
interface CollectionInterface extends Traversable
{
/**
* Determine if the collection has item at given key.
*/
public function has(int|string $key): bool;
/**
* Add item to collection.
*
* @return CollectionInterface<int|string, mixed>
*/
public function push(mixed $item): self;
/**
* Return item for given key or return default if key does not exist.
*/
public function get(int|string $key, mixed $default = null): mixed;
/**
* Set item in collection.
*/
public function set(int|string $key, mixed $item): self;
/**
* Return item at given numeric position starting at 0.
*/
public function at(int $key = 0, mixed $default = null): mixed;
/**
* Return first item in collection.
*/
public function first(): mixed;
/**
* Return last item in collection.
*/
public function last(): mixed;
/**
* Return item count of collection.
*/
public function count(): int;
/**
* Map each item of collection by given callback.
*/
public function map(callable $callback): self;
/**
* Run callback on each item of the collection and remove it if it does not return true.
*/
public function filter(callable $callback): self;
/**
* Empty collection.
*
* @return CollectionInterface<int|string, mixed>
*/
public function clear(): self;
/**
* Transform collection as array.
*
* @return array<int|string, mixed>
*/
public function toArray(): array;
/**
* Extract items based on given values and discard the rest.
*
* @return CollectionInterface<int|string, mixed>
*/
public function slice(int $offset, ?int $length = null): self;
}

View file

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Stringable;
interface ColorChannelInterface extends Stringable
{
/**
* Create color channel from normalized (0.0 - 1.0) value.
*/
public static function fromNormalized(float $normalized): self;
/**
* Return the channels value normalized to a float value from 0.0 to 1.0.
*/
public function normalized(int $precision = 32): float;
/**
* Return the the minimal possible value of the color channel.
*/
public static function min(): float;
/**
* Return the the maximal possible value of the color channel.
*/
public static function max(): float;
/**
* Return color channels value.
*/
public function value(): int|float;
/**
* Scale channel value by given percent.
*/
public function scale(int $percent): self;
/**
* Transform color channel's value to string.
*/
public function toString(): string;
}

View file

@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ColorInterface
{
/**
* Return colorspace of current color.
*/
public function colorspace(): ColorspaceInterface;
/**
* Cast color object to string.
*/
public function toString(): string;
/**
* Transform color object to hex encoded web color.
*/
public function toHex(bool $prefix = false): string;
/**
* Return array of all color channels.
*
* @return array<ColorChannelInterface>
*/
public function channels(): array;
/**
* Retrieve the color channel by its classname.
*/
public function channel(string $classname): ColorChannelInterface;
/**
* Get the alpha channel of the color.
*/
public function alpha(): ColorChannelInterface;
/**
* Convert color to given colorspace.
*/
public function toColorspace(string|ColorspaceInterface $colorspace): self;
/**
* Determine if the current color is gray.
*/
public function isGrayscale(): bool;
/**
* Determine if the current color is (semi) transparent.
*/
public function isTransparent(): bool;
/**
* Determine whether the current color is completely transparent.
*/
public function isClear(): bool;
/**
* Return a copy of the current color with the specified transparency value.
*/
public function withTransparency(float $transparency): self;
/**
* Return a copy of the current color with adjusted brightness.
* Positive values lighten, negative values darken. Range: -100 to 100.
*/
public function withBrightness(int $level): self;
/**
* Return a copy of the current color with adjusted saturation.
* Positive values saturate, negative values desaturate. Range: -100 to 100.
*/
public function withSaturation(int $level): self;
/**
* Return an inverted copy of the current color.
*/
public function withInversion(): self;
}

View file

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ColorProcessorInterface
{
/**
* Transform the given color object into the driver's color represenation.
*/
public function export(ColorInterface $color): mixed;
/**
* Transform the given driver's represenation of a color into a color object.
*/
public function import(mixed $color): ColorInterface;
/**
* Return the colorspace the processor currently operates in.
*/
public function colorspace(): ColorspaceInterface;
}

View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ColorspaceInterface
{
/**
* Return array of all color channel classnames of the colorspace.
*
* @return array<string>
*/
public static function channels(): array;
/**
* Create new color in colorspace from given normalized (0-1) channel values.
*
* @param array<float> $normalized
*/
public static function colorFromNormalized(array $normalized): ColorInterface;
/**
* Convert given color to the format of the current colorspace.
*/
public function importColor(ColorInterface $color): ColorInterface;
}

View file

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface CoreInterface extends CollectionInterface
{
/**
* Return driver's representation of the image core.
*/
public function native(): mixed;
/**
* Set driver's representation of the image core.
*
* @return CoreInterface<FrameInterface>
*/
public function setNative(mixed $native): self;
/**
* Count number of frames of animated image core.
*/
public function count(): int;
/**
* Return frame of given position in an animated image.
*/
public function frame(int $position): FrameInterface;
/**
* Add new frame to core.
*
* @return CoreInterface<FrameInterface>
*/
public function add(FrameInterface $frame): self;
/**
* Return number of repetitions of an animated image.
*/
public function loops(): int;
/**
* Set the number of repetitions for an animation. Where a value of 0 means infinite repetition.
*
* @return CoreInterface<FrameInterface>
*/
public function setLoops(int $loops): self;
/**
* Get first frame in core.
*/
public function first(): FrameInterface;
/**
* Get last frame in core.
*/
public function last(): FrameInterface;
/**
* Access meta information of core instance.
*/
public function meta(): CollectionInterface;
}

View file

@ -0,0 +1,93 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\MediaType;
use Stringable;
interface DataUriInterface extends Stringable
{
/**
* Parse new object from given data uri scheme string.
*/
public static function parse(string $dataUriScheme): self;
/**
* Create data uri object from given unencoded data.
*
* @param array<string, string> $parameters
*/
public static function create(
string $data,
null|string|MediaType $mediaType = null,
array $parameters = [],
): self;
/**
* Return current data uri data.
*/
public function data(): string;
/**
* Set data of current data uri scheme.
*/
public function setData(string $data): self;
/**
* Get media type of current data uri output.
*/
public function mediaType(): ?string;
/**
* Set media type of current data uri output.
*/
public function setMediaType(null|string|MediaType $mediaType): self;
/**
* Get all parameters of current data uri output.
*
* @return array<string, string>
*/
public function parameters(): array;
/**
* Set (overwrite) all parameters of current data uri output.
*
* @param array<string, string> $parameters
*/
public function setParameters(array $parameters): self;
/**
* Append given parameters to current data uri output.
*
* @param array<string, string> $parameters
*/
public function appendParameters(array $parameters): self;
/**
* Get value of given parameter, return null if parameter is not set.
*/
public function parameter(string $key): ?string;
/**
* Set (overwrite) parameter of given key to given value.
*/
public function setParameter(string $key, string $value): self;
/**
* Get charset of current data uri scheme, null if no charset is defined.
*/
public function charset(): ?string;
/**
* Define charset of current data uri scheme.
*/
public function setCharset(string $charset): self;
/**
* Transform current data uri scheme to string.
*/
public function toString(): string;
}

View file

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface DecoderInterface
{
/**
* Determine if the given input is supported by decoder.
*
* Support does not mean that the input can necessarily be decoded, but only
* that the input might match the decoder and that it is worth trying.
*/
public function supports(mixed $input): bool;
/**
* Decode given input either to color or image.
*/
public function decode(mixed $input): ImageInterface|ColorInterface;
}

View file

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface DrawableFactoryInterface
{
/**
* Create the drawable.
*/
public static function build(null|callable|DrawableInterface $drawable = null): DrawableInterface;
/**
* Return the drawable.
*/
public function drawable(): DrawableInterface;
/**
* Define the background color of the drawable object.
*/
public function background(string|ColorInterface $color): self;
/**
* Set the border size & color of the drawable object to be produced.
*/
public function border(string|ColorInterface $color, int $size = 1): self;
}

View file

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface DrawableInterface
{
/**
* Position of the drawable object.
*/
public function position(): PointInterface;
/**
* Set position of the drawable object.
*/
public function setPosition(PointInterface $position): self;
/**
* Set the background color of the drawable object.
*/
public function setBackgroundColor(string|ColorInterface $color): self;
/**
* Return background color of drawable object.
*/
public function backgroundColor(): null|string|ColorInterface;
/**
* Determine if a background color was set.
*/
public function hasBackgroundColor(): bool;
/**
* Set border color & size of the drawable object.
*/
public function setBorder(string|ColorInterface $color, int $size = 1): self;
/**
* Set border size of the drawable object.
*/
public function setBorderSize(int $size): self;
/**
* Set border color of the drawable object.
*/
public function setBorderColor(string|ColorInterface $color): self;
/**
* Get border size.
*/
public function borderSize(): int;
/**
* Get border color of drawable object.
*/
public function borderColor(): null|string|ColorInterface;
/**
* Determine if the drawable object has a border.
*/
public function hasBorder(): bool;
/**
* Return the factory object with a copy of the current drawable object.
*/
public function factory(): DrawableFactoryInterface;
/**
* Return a copy of the current drawable by making adjustments via a callback on the objects factory.
*/
public function adjust(callable $adjustments): self;
}

View file

@ -0,0 +1,133 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Config;
use Intervention\Image\Exceptions\MissingDependencyException;
use Intervention\Image\FileExtension;
use Intervention\Image\Format;
use Intervention\Image\MediaType;
interface DriverInterface
{
/**
* Create new driver instance with configuration.
*/
public function __construct(Config $config);
/**
* Return drivers unique id.
*/
public function id(): string;
/**
* Get driver configuration.
*/
public function config(): Config;
/**
* Resolve given modifier into a specialized version for the current driver.
*
* @template T of ModifierInterface
* @param T $modifier
* @return T
*/
public function specializeModifier(ModifierInterface $modifier): ModifierInterface;
/**
* Resolve given analyzer into a specialized version for the current driver.
*
* @template T of AnalyzerInterface
* @param T $analyzer
* @return T
*/
public function specializeAnalyzer(AnalyzerInterface $analyzer): AnalyzerInterface;
/**
* Resolve given encoder into a specialized version for the current driver.
*
* @template T of EncoderInterface
* @param T $encoder
* @return T
*/
public function specializeEncoder(EncoderInterface $encoder): EncoderInterface;
/**
* Resolve given decoder into a specialized version for the current driver.
*
* @template T of DecoderInterface
* @param T $decoder
* @return T
*/
public function specializeDecoder(DecoderInterface $decoder): DecoderInterface;
/**
* Create new image instance in the given dimensions and with full transparent
* background and the current driver in given dimensions.
*/
public function createImage(int $width, int $height): ImageInterface;
/**
* Create new core instance from array of frame objects.
*
* @param array<int|string, FrameInterface> $frames
*/
public function createCore(array $frames): CoreInterface;
/**
* Decode image source with given decoders. Try all image decoders by default.
*
* Image sources can be as follows:
*
* - Path in filesystem
* - Raw binary image data
* - Base64 encoded image data
* - Data Uri
* - Stream resource
* - SplFileInfo object
* - Intervention Image Instance (Intervention\Image\Image)
* - Encoded Intervention Image (Intervention\Image\EncodedImage)
* - Driver-specific image (instance of GDImage or Imagick)
*
* @param array<string|DecoderInterface> $decoders
*/
public function decodeImage(mixed $input, ?array $decoders = null): ImageInterface;
/**
* Decode color source with given decoders. Try all color decoders by default.
*
* @param array<string|DecoderInterface> $decoders
*/
public function decodeColor(mixed $input, ?array $decoders = null): ColorInterface;
/**
* Return color processor for the given image and its colorspace.
*/
public function colorProcessor(ImageInterface $image): ColorProcessorInterface;
/**
* Return font processor of the current driver.
*/
public function fontProcessor(): FontProcessorInterface;
/**
* Check whether all requirements for operating the driver are met and
* throw exception if the check fails.
*
* @throws MissingDependencyException
*/
public function checkHealth(): void;
/**
* Check if the current driver supports the given format and if the
* underlying PHP extension was built with support for the format.
*/
public function supports(string|Format|FileExtension|MediaType $identifier): bool;
/**
* Return the version number of the image driver currently in use.
*/
public function version(): string;
}

View file

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface EncodedImageInterface extends FileInterface
{
/**
* Return Media (MIME) Type of encoded image.
*/
public function mediaType(): string;
/**
* Alias of self::mediaType().
*/
public function mimetype(): string;
/**
* Transform encoded image data into an data uri string.
*/
public function toDataUri(): DataUriInterface;
/**
* Return base64-encoded string from the current instance.
*/
public function toBase64(): string;
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface EncoderInterface
{
/**
* Encode given image.
*/
public function encode(ImageInterface $image): EncodedImageInterface;
/**
* Set encoder options.
*/
public function setOptions(mixed ...$options): self;
}

View file

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Throwable;
interface ExceptionInterface extends Throwable
{
//
}

View file

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Stringable;
interface FileInterface extends Stringable
{
/**
* Create file object from path in file system.
*/
public static function fromPath(string $path): self;
/**
* Save data in given path in file system.
*/
public function save(string $path): void;
/**
* Create stream resource from encoded data.
*
* @return resource
*/
public function toStream();
/**
* Return size in bytes.
*/
public function size(): int;
/**
* Transform file object into string.
*/
public function toString(): string;
}

View file

@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Alignment;
interface FontInterface
{
/**
* Set color of font.
*/
public function setColor(string|ColorInterface $color): self;
/**
* Get color of font.
*/
public function color(): null|string|ColorInterface;
/**
* Set stroke color of font.
*/
public function setStrokeColor(string|ColorInterface $color): self;
/**
* Get stroke color of font.
*/
public function strokeColor(): null|string|ColorInterface;
/**
* Set stroke width of font.
*/
public function setStrokeWidth(int $width): self;
/**
* Get stroke width of font.
*/
public function strokeWidth(): int;
/**
* Determine if the font is drawn with outline stroke effect.
*/
public function hasStrokeEffect(): bool;
/**
* Set font size.
*/
public function setSize(float $size): self;
/**
* Get font size.
*/
public function size(): float;
/**
* Set clockwise rotation angle of font.
*/
public function setAngle(float $angle): self;
/**
* Get rotation angle of font.
*/
public function angle(): float;
/**
* Set font file path.
*/
public function setFilepath(string $path): self;
/**
* Get font file path.
*/
public function filepath(): ?string;
/**
* Determine if font has a corresponding file.
*/
public function hasFile(): bool;
/**
* Set horizontal alignment of font.
*/
public function setAlignmentHorizontal(string|Alignment $alignment): self;
/**
* Get horizontal alignment of font.
*/
public function alignmentHorizontal(): Alignment;
/**
* Set vertical alignment of font.
*/
public function setAlignmentVertical(string|Alignment $alignment): self;
/**
* Get vertical alignment of font.
*/
public function alignmentVertical(): Alignment;
/**
* Set typographical line height.
*/
public function setLineHeight(float $height): self;
/**
* Get line height of font.
*/
public function lineHeight(): float;
/**
* Set the wrap width with which the text is rendered.
*/
public function setWrapWidth(?int $width): self;
/**
* Get wrap width with which the text is rendered.
*/
public function wrapWidth(): ?int;
}

View file

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Typography\TextBlock;
interface FontProcessorInterface
{
/**
* Calculate size of bounding box of given text in conjunction with the given font.
*/
public function boxSize(string $text, FontInterface $font): SizeInterface;
/**
* Build TextBlock object from text string and align every line according
* to text modifier's font object and position.
*/
public function textBlock(string $text, FontInterface $font, PointInterface $position): TextBlock;
/**
* Calculate the actual font size to pass at the driver level.
*/
public function nativeFontSize(FontInterface $font): float;
/**
* Calculate the typographical font size in pixels.
*/
public function typographicalSize(FontInterface $font): int;
/**
* Calculates typographical cap height.
*/
public function capHeight(FontInterface $font): int;
/**
* Calculates typographical leading size.
*/
public function leading(FontInterface $font): int;
}

View file

@ -0,0 +1,81 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface FrameInterface
{
/**
* Return image data of frame in driver specific format.
*/
public function native(): mixed;
/**
* Set image data of frame in driver specific format.
*/
public function setNative(mixed $native): self;
/**
* Transform frame into an image.
*/
public function toImage(DriverInterface $driver): ImageInterface;
/**
* Get image size of current frame.
*/
public function size(): SizeInterface;
/**
* Return animation delay of current frame in seconds.
*/
public function delay(): float;
/**
* Set animation frame delay in seconds.
*/
public function setDelay(float $delay): self;
/**
* Get disposal method of current frame.
*/
public function disposalMethod(): int;
/**
* Set disposal method of current frame.
*
* The disposal method specifies what happens to the current frame when
* moving to the next. Available method values are:
*
* - 0: No disposal, can be used then frames do not have transparency
* - 1: Leave the frame in place and draw the next on top of it
* - 2: Clear the frame with the background color before displaying the next frame
* - 3: Restore the frame to its previous state before the current was drawn
*/
public function setDisposalMethod(int $method): self;
/**
* Set pixel offset of current frame.
*/
public function setOffset(int $left, int $top): self;
/**
* Get left offset in pixels.
*/
public function offsetLeft(): int;
/**
* Set left pixel offset for current frame.
*/
public function setOffsetLeft(int $offset): self;
/**
* Get top pixel offset of current frame.
*/
public function offsetTop(): int;
/**
* Set top pixel offset of current frame.
*/
public function setOffsetTop(int $offset): self;
}

View file

@ -0,0 +1,573 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Countable;
use Intervention\Image\FileExtension;
use Intervention\Image\Geometry\Bezier;
use Intervention\Image\Geometry\Circle;
use Intervention\Image\Geometry\Ellipse;
use Intervention\Image\Geometry\Line;
use Intervention\Image\Geometry\Polygon;
use Intervention\Image\Geometry\Rectangle;
use Intervention\Image\MediaType;
use Intervention\Image\Alignment;
use Intervention\Image\Direction;
use Intervention\Image\Fraction;
use Intervention\Image\Format;
use IteratorAggregate;
/**
* @extends IteratorAggregate<FrameInterface>
*/
interface ImageInterface extends IteratorAggregate, Countable
{
/**
* Return the image driver.
*/
public function driver(): DriverInterface;
/**
* Return the image core.
*/
public function core(): CoreInterface;
/**
* Return the image origin.
*/
public function origin(): OriginInterface;
/**
* Set the image origin.
*/
public function setOrigin(OriginInterface $origin): self;
/**
* Return the image width in pixels.
*
* @link https://image.intervention.io/v4/basics/meta-information#read-the-pixel-width
*/
public function width(): int;
/**
* Return the image height in pixels.
*
* @link https://image.intervention.io/v4/basics/meta-information#read-the-pixel-height
*/
public function height(): int;
/**
* Return the image size as an object.
*
* @link https://image.intervention.io/v4/basics/meta-information#read-the-image-size-as-an-object
*/
public function size(): SizeInterface;
/**
* Save the image to the given path. If no path is given, the image will
* be saved at its original location.
*
* @link https://image.intervention.io/v4/basics/image-output#encode--save-combined
*/
public function save(?string $path = null, mixed ...$options): self;
/**
* Apply the given modifier to the image.
*
* @link https://image.intervention.io/v4/modifying-images/custom-modifiers
*/
public function modify(ModifierInterface $modifier): self;
/**
* Analyze the image with the given analyzer.
*/
public function analyze(AnalyzerInterface $analyzer): mixed;
/**
* Determine if the image is animated.
*
* @link https://image.intervention.io/v4/modifying-images/animations#check-the-current-image-instance-for-animation
*/
public function isAnimated(): bool;
/**
* Remove all frames but keep the one at the specified position.
*
* Integer values select the exact frame position, while string values
* represent a percentage between '0%' and '100%' to determine the
* approximate frame position.
*
* @link https://image.intervention.io/v4/modifying-images/animations#remove-animation
*/
public function removeAnimation(int|string $position = 0): self;
/**
* Keep only the frames defined by offset and length, discarding the rest.
*
* @link https://image.intervention.io/v4/modifying-images/animations#change-the-animation-frames
*/
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
/**
* Return the animation loop count.
*
* @link https://image.intervention.io/v4/modifying-images/animations#read-the-animation-iteration-count
*/
public function loops(): int;
/**
* Set the animation loop count.
*
* @link https://image.intervention.io/v4/modifying-images/animations#change-the-animation-iteration-count
*/
public function setLoops(int $loops): self;
/**
* Return the EXIF data of the image.
*
* @link https://image.intervention.io/v4/basics/meta-information#exif-information
*/
public function exif(?string $query = null): mixed;
/**
* Set the EXIF data of the image.
*/
public function setExif(CollectionInterface $exif): self;
/**
* Return the image resolution in DPI.
*
* @link https://image.intervention.io/v4/basics/meta-information#image-resolution
*/
public function resolution(): ResolutionInterface;
/**
* Set the image resolution in DPI.
*
* @link https://image.intervention.io/v4/basics/meta-information#image-resolution
*/
public function setResolution(float $x, float $y): self;
/**
* Return the image colorspace.
*
* @link https://image.intervention.io/v4/basics/colors#read-the-image-colorspace
*/
public function colorspace(): ColorspaceInterface;
/**
* Transform the image to the given colorspace.
*
* @link https://image.intervention.io/v4/basics/colors#change-the-image-colorspace
*/
public function setColorspace(string|ColorspaceInterface $colorspace): self;
/**
* Return the color of the pixel at the given position and frame.
*
* @link https://image.intervention.io/v4/basics/colors#color-information
*/
public function colorAt(int $x, int $y, int $frame = 0): ColorInterface;
/**
* Return the colors of the pixel at the given position across all frames.
*
* @link https://image.intervention.io/v4/basics/colors#read-all-colors-of-certain-pixels-in-animated-images
*/
public function colorsAt(int $x, int $y): CollectionInterface;
/**
* Return the background color used to replace transparent areas during
* encoding to formats that do not support transparency.
*
* @link https://image.intervention.io/v4/basics/configuration-drivers#configuration-options
*/
public function backgroundColor(): ColorInterface;
/**
* Set the background color used to replace transparent areas during
* encoding to formats that do not support transparency.
*
* @link https://image.intervention.io/v4/basics/configuration-drivers#configuration-options
*/
public function setBackgroundColor(string|ColorInterface $color): self;
/**
* Replace transparent areas with the given color or the configured background color.
*
* @link https://image.intervention.io/v4/basics/colors#merge-transparent-areas-with-color
*/
public function fillTransparentAreas(null|string|ColorInterface $color = null): self;
/**
* Return the ICC color profile.
*
* @link https://image.intervention.io/v4/basics/colors#color-profiles
*/
public function profile(): ProfileInterface;
/**
* Set the ICC color profile.
*
* @link https://image.intervention.io/v4/basics/colors#color-profiles
*/
public function setProfile(ProfileInterface $profile): self;
/**
* Remove the ICC color profile.
*
* @link https://image.intervention.io/v4/basics/colors#color-profiles
*/
public function removeProfile(): self;
/**
* Reduce the number of colors in the image to the given limit.
*
* @link https://image.intervention.io/v4/modifying-images/effects#reduce-colors
*/
public function reduceColors(int $limit, null|string|ColorInterface $background = null): self;
/**
* Sharpen the image by the given level.
*
* @link https://image.intervention.io/v4/modifying-images/effects#sharpening-effect
*/
public function sharpen(int $level = 10): self;
/**
* Turn the image into a grayscale version.
*
* @link https://image.intervention.io/v4/modifying-images/effects#convert-image-to-a-grayscale-version
*/
public function grayscale(): self;
/**
* Adjust the image brightness by the given level.
*
* @link https://image.intervention.io/v4/modifying-images/effects#change-the-image-brightness
*/
public function brightness(int $level): self;
/**
* Adjust the image contrast by the given level.
*
* @link https://image.intervention.io/v4/modifying-images/effects#change-the-image-contrast
*/
public function contrast(int $level): self;
/**
* Apply gamma correction to the image.
*
* @link https://image.intervention.io/v4/modifying-images/effects#gamma-correction
*/
public function gamma(float $gamma): self;
/**
* Adjust the intensity of the RGB color channels.
*
* @link https://image.intervention.io/v4/modifying-images/effects#color-correction
*/
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
/**
* Mirror the image in the given direction.
*
* @link https://image.intervention.io/v4/modifying-images/effects#mirror-images
*/
public function flip(Direction $direction = Direction::HORIZONTAL): self;
/**
* Apply a blur effect with the given level.
*
* @link https://image.intervention.io/v4/modifying-images/effects#blur-effect
*/
public function blur(int $level = 5): self;
/**
* Invert the image colors.
*
* @link https://image.intervention.io/v4/modifying-images/effects#invert-colors
*/
public function invert(): self;
/**
* Apply a pixelation effect with the given tile size.
*
* @link https://image.intervention.io/v4/modifying-images/effects#pixelation-effect
*/
public function pixelate(int $size): self;
/**
* Rotate the image clockwise by the given angle.
*
* @link https://image.intervention.io/v4/modifying-images/effects#image-rotation
*/
public function rotate(float $angle, null|string|ColorInterface $background = null): self;
/**
* Orient the image upright based on EXIF data.
*
* @link https://image.intervention.io/v4/modifying-images/effects#image-orientation-according-to-exif-data
*/
public function orient(): self;
/**
* Draw text on the image.
*
* @link https://image.intervention.io/v4/modifying-images/text-fonts
*/
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
/**
* Resize the image to the given width and/or height.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#simple-image-resizing
*/
public function resize(null|int|Fraction $width = null, null|int|Fraction $height = null): self;
/**
* Resize the image to the given width and/or height without exceeding
* the original dimensions.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#resize-without-exceeding-the-original-size
*/
public function resizeDown(null|int|Fraction $width = null, null|int|Fraction $height = null): self;
/**
* Resize the image to the given width and/or height while maintaining
* the aspect ratio.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#resize-images-proportionally
*/
public function scale(null|int|Fraction $width = null, null|int|Fraction $height = null): self;
/**
* Resize the image to the given width and/or height while maintaining
* the aspect ratio and without exceeding the original dimensions.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#scale-images-but-do-not-exceed-the-original-size
*/
public function scaleDown(null|int|Fraction $width = null, null|int|Fraction $height = null): self;
/**
* Crop and resize the image to cover the given dimensions exactly.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#cropping--resizing-combined
*/
public function cover(
int|Fraction $width,
int|Fraction $height,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Crop and resize the image to cover the given dimensions without
* exceeding the original dimensions.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#fitted-resizing-without-exceeding-the-original-size
*/
public function coverDown(
int|Fraction $width,
int|Fraction $height,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Resize the image canvas to the given width and height without resampling
*
* The alignment position defines where the original image is fixed,
* and new areas are filled with the given background color.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#resize-image-boundaries-without-resampling-the-original-image
*/
public function resizeCanvas(
null|int|Fraction $width = null,
null|int|Fraction $height = null,
null|string|ColorInterface $background = null,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Resize the image canvas by adding or subtracting the given width and
* height relative to the original dimensions.
*
* The alignment position defines where the original image is fixed,
* and new areas are filled with the given background color.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#resize-image-boundaries-relative-to-the-original
*/
public function resizeCanvasRelative(
null|int|Fraction $width = null,
null|int|Fraction $height = null,
null|string|ColorInterface $background = null,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Resize the image to fit within the given dimensions while maintaining
* the aspect ratio. New areas are filled with the given background color.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#contain-resizing-1
*/
public function contain(
int|Fraction $width,
int|Fraction $height,
null|string|ColorInterface $background = null,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Resize the image to fit within the given dimensions while maintaining
* the aspect ratio and without exceeding the original dimensions. New
* areas are filled with the given background color.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#contain-resizing-without-upscaling
*/
public function containDown(
int|Fraction $width,
int|Fraction $height,
null|string|ColorInterface $background = null,
string|Alignment $alignment = Alignment::CENTER,
): self;
/**
* Cut out a rectangular part of the image with the given width and height
* at the given alignment position offset by x and y.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#cut-out-a-rectangular-part
*/
public function crop(
int|Fraction $width,
int|Fraction $height,
int $x = 0,
int $y = 0,
null|string|ColorInterface $background = null,
string|Alignment $alignment = Alignment::TOP_LEFT,
): self;
/**
* Trim border areas of similar color within the given tolerance.
*
* @link https://image.intervention.io/v4/modifying-images/resizing#remove-border-areas-in-similar-color
*/
public function trim(int $tolerance = 0): self;
/**
* Insert another image at the given position relative to the alignment position.
*
* @link https://image.intervention.io/v4/modifying-images/inserting#insert-images
*/
public function insert(
mixed $image,
int $x = 0,
int $y = 0,
string|Alignment $alignment = Alignment::TOP_LEFT,
float $transparency = 1,
): self;
/**
* Fill the image with the given color. If coordinates are specified, the
* fill is applied as a flood fill starting at that position. Otherwise
* the entire image area is filled.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#fill-images-with-color
*/
public function fill(string|ColorInterface $color, ?int $x = null, ?int $y = null): self;
/**
* Draw a single pixel at the given position in the given color.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-pixels
*/
public function drawPixel(int $x, int $y, string|ColorInterface $color): self;
/**
* Draw a rectangle on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-a-rectangle
*/
public function drawRectangle(callable|Rectangle $rectangle): self;
/**
* Draw an ellipse on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-ellipses
*/
public function drawEllipse(callable|Ellipse $ellipse): self;
/**
* Draw a circle on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-a-circle
*/
public function drawCircle(callable|Circle $circle): self;
/**
* Draw a polygon on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-a-polygon
*/
public function drawPolygon(callable|Polygon $polygon): self;
/**
* Draw a line on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-a-line
*/
public function drawLine(callable|Line $line): self;
/**
* Draw a bezier curve on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing#draw-bezier-curves
*/
public function drawBezier(callable|Bezier $bezier): self;
/**
* Draw a geometric object on the image.
*
* @link https://image.intervention.io/v4/modifying-images/drawing
*/
public function draw(DrawableInterface $drawable): self;
/**
* Encode the image with the given encoder. If no encoder is provided,
* the format is detected from the original image automatically.
*
* @link https://image.intervention.io/v4/basics/image-output#encode-images-with-encoder-objects
*/
public function encode(?EncoderInterface $encoder = null): EncodedImageInterface;
/**
* Encode the image in the given format.
*
* @link https://image.intervention.io/v4/basics/image-output#encode-images-using-format
*/
public function encodeUsingFormat(Format $format, mixed ...$options): EncodedImageInterface;
/**
* Encode the image based on the given media (MIME) type.
*
* @link https://image.intervention.io/v4/basics/image-output#encode-images-using-media-mime-types
*/
public function encodeUsingMediaType(string|MediaType $mediaType, mixed ...$options): EncodedImageInterface;
/**
* Encode the image based on the given file extension.
*
* @link https://image.intervention.io/v4/basics/image-output#encode-images-using-file-extensions
*/
public function encodeUsingFileExtension(
string|FileExtension $fileExtension,
mixed ...$options,
): EncodedImageInterface;
/**
* Encode the image based on the given file path's extension.
*
* @link https://image.intervention.io/v4/basics/image-output#encode-images-using-file-paths
*/
public function encodeUsingPath(string $path, mixed ...$options): EncodedImageInterface;
}

View file

@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use SplFileInfo;
use Stringable;
interface ImageManagerInterface
{
/**
* Create a new image manager using the given driver.
*/
public static function usingDriver(string|DriverInterface $driver, mixed ...$options): self;
/**
* Create a new image with the given width and height.
*/
public function createImage(
int $width,
int $height,
null|callable|AnimationFactoryInterface $animation = null,
): ImageInterface;
/**
* Decode an image from the given source which can be one of the following:
*
* - Path in filesystem
* - Raw binary image data
* - SplFileInfo object
* - Base64 encoded image data
* - Data URI string or instance of DataUriInterface
* - Stream resource
* - Instance of ImageInterface
* - Instance of EncodedImageInterface
*
* Optionally, one or more specific decoders can be provided. If no
* decoders are specified, all available decoders will be tried.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-image-sources
*
* @param null|string|array<string|DecoderInterface>|DecoderInterface $decoders
*/
public function decode(mixed $source, null|string|array|DecoderInterface $decoders = null): ImageInterface;
/**
* Decode an image from the given file path.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-file-paths
*/
public function decodePath(string|Stringable $path): ImageInterface;
/**
* Decode an image from the given raw binary data.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-binary-data
*/
public function decodeBinary(string|Stringable $binary): ImageInterface;
/**
* Decode an image from the given SplFileInfo object.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-splfileinfo-objects
*/
public function decodeSplFileInfo(SplFileInfo $splFileInfo): ImageInterface;
/**
* Decode an image from the given base64 encoded data.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-base64-encoded-data
*/
public function decodeBase64(string|Stringable $base64): ImageInterface;
/**
* Decode an image from the given data URI.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-data-uri-scheme
*/
public function decodeDataUri(string|Stringable|DataUriInterface $dataUri): ImageInterface;
/**
* Decode an image from the given stream resource.
*
* @link https://image.intervention.io/v4/basics/instantiation#read-images-from-stream
*/
public function decodeStream(mixed $stream): ImageInterface;
}

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface InputHandlerInterface
{
/**
* Try to decode the given input with each decoder of the the handler chain.
*/
public function handle(mixed $input): ImageInterface|ColorInterface;
}

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ModifierInterface
{
/**
* Apply modifications of the current modifier to the given image.
*/
public function apply(ImageInterface $image): ImageInterface;
}

View file

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Format;
use Intervention\Image\MediaType;
interface OriginInterface
{
/**
* Return media type of origin.
*/
public function mediaType(): string;
/**
* Set media type of current instance.
*/
public function setMediaType(string|MediaType $type): self;
/**
* Return file path of origin.
*/
public function filePath(): ?string;
/**
* Set file path for origin.
*/
public function setFilePath(string $path): self;
/**
* Return file extension if origin was created from file path.
*/
public function fileExtension(): ?string;
/**
* Return format of the origin image.
*/
public function format(): Format;
}

View file

@ -0,0 +1,112 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use ArrayAccess;
use Countable;
use IteratorAggregate;
use Traversable;
/**
* @extends Traversable<int, ColorInterface>
* @extends IteratorAggregate<int, ColorInterface>
* @extends ArrayAccess<int, ColorInterface>
*/
interface PaletteInterface extends Traversable, Countable, IteratorAggregate, ArrayAccess
{
/**
* Get first color of palette.
*/
public function first(): ?ColorInterface;
/**
* Get last color of palette.
*/
public function last(): ?ColorInterface;
/**
* Return number of unique colors in palette.
*/
public function count(): int;
/**
* Return the number of times the color appears in the palette.
*/
public function colorCount(ColorInterface $color): int;
/**
* Count total sum of all color in palette.
*/
public function totalCount(): int;
/**
* Transform all colors in palette to given color space.
*/
public function toColorspace(string|ColorspaceInterface $colorspace): self;
/**
* Transform palette to array.
*
* @return array<ColorInterface>
*/
public function toArray(): array;
/**
* Run callback on each color in the palette and keep only the ones that return true.
*/
public function filter(callable $callback): self;
/**
* Map each color of the palette by given callback.
*/
public function map(callable $callback): self;
/**
* Sort the palette by given color channel.
*/
public function sortByChannel(string|ColorChannelInterface $channel): self;
/**
* Sort the palette by given color channel in reverse order.
*/
public function sortByChannelDesc(string|ColorChannelInterface $channel): self;
/**
* Sort the palette by the number of times each color appears in the image starting with the smallest number.
*/
public function sortByPresence(): self;
/**
* Sort the palette by the number of times each color appears in the image in reverse order.
*/
public function sortByPresenceDesc(): self;
/**
* Transform the palette by retaining only the specified number of colors after the offset.
*/
public function slice(int $offset, ?int $length = null): self;
/**
* Add color to palette.
*/
public function addColor(ColorInterface $color, int $count = 1): self;
/**
* Determine if given color exists in the palette.
*/
public function hasColor(ColorInterface $color): bool;
/**
* Combine similar colors in the palette by replacing them to their quantized
* version according to the given level of quantization.
*/
public function quantize(int $levels): self;
/**
* Reduce similar colors in the palette by quantization with the given levels of detail
* but keep nearest original color instead of its quantized version.
*/
public function reduce(int $levels): self;
}

View file

@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use IteratorAggregate;
/**
* @extends IteratorAggregate<int>
*/
interface PointInterface extends IteratorAggregate
{
/**
* Return x position.
*/
public function x(): int;
/**
* Return y position.
*/
public function y(): int;
/**
* Set x position.
*/
public function setX(int $x): self;
/**
* Set y position.
*/
public function setY(int $y): self;
/**
* Move X coordinate.
*/
public function moveX(int $value): self;
/**
* Move Y coordinate.
*/
public function moveY(int $value): self;
/**
* Move position of current point by given coordinates.
*/
public function move(int $x, int $y): self;
/**
* Set position of point.
*/
public function setPosition(int $x, int $y): self;
/**
* Rotate the current point clockwise around given pivot point.
*/
public function rotate(float $angle, self $pivot): self;
}

View file

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Stringable;
interface ProfileInterface extends Stringable
{
/**
* Create profile object from path in file system.
*/
public static function fromPath(string $path): self;
/**
* Transform object to string.
*/
public function toString(): string;
}

View file

@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Length;
use Stringable;
interface ResolutionInterface extends Stringable
{
/**
* Factory method to create resolution with given dots per inch.
*/
public static function dpi(float $x, float $y): self;
/**
* Factory method to create resolution with given pixels per inch.
*/
public static function ppi(float $x, float $y): self;
/**
* Convert resolution to units per inch.
*/
public function perInch(): self;
/**
* Convert resolution to units per centimeter.
*/
public function perCm(): self;
/**
* Return resolution of x-axis value.
*/
public function x(): float;
/**
* Return resolution on y-axis value.
*/
public function y(): float;
/**
* Return length unit of resolution.
*/
public function length(): Length;
/**
* Transform object to string.
*/
public function toString(): string;
}

View file

@ -0,0 +1,114 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Alignment;
use Traversable;
/**
* @extends Traversable<int>
*/
interface SizeInterface extends Traversable
{
/**
* Get width.
*/
public function width(): int;
/**
* Get height.
*/
public function height(): int;
/**
* Get pivot point.
*/
public function pivot(): PointInterface;
/**
* Set width.
*/
public function setWidth(int $width): self;
/**
* Set height.
*/
public function setHeight(int $height): self;
/**
* Set pivot point.
*/
public function setPivot(PointInterface $pivot): self;
/**
* Calculate aspect ratio of the current size.
*/
public function aspectRatio(): float;
/**
* Determine if current size fits within given size.
*/
public function fitsWithin(self $size): bool;
/**
* Determine if size is in landscape format.
*/
public function isLandscape(): bool;
/**
* Determine if size is in portrait format.
*/
public function isPortrait(): bool;
/**
* Move pivot to the given alignment position in the size and adjust the new position by given offset values.
*/
public function movePivot(string|Alignment $alignment, int $x = 0, int $y = 0): self;
/**
* Align pivot relative to given size at given alignment position.
*/
public function alignPivotTo(self $size, string|Alignment $alignment): self;
/**
* Calculate the relative position to another size based on the pivot point settings of both sizes.
*/
public function offsetTo(self $size): PointInterface;
/**
* @see Resizer::resize()
*/
public function resize(?int $width = null, ?int $height = null): self;
/**
* @see Resizer::resizeDown()
*/
public function resizeDown(?int $width = null, ?int $height = null): self;
/**
* @see Resizer::scale()
*/
public function scale(?int $width = null, ?int $height = null): self;
/**
* @see Resizer::scaleDown()
*/
public function scaleDown(?int $width = null, ?int $height = null): self;
/**
* @see Resizer::cover()
*/
public function cover(int $width, int $height): self;
/**
* @see Resizer::contain()
*/
public function contain(int $width, int $height): self;
/**
* @see Resizer::containDown()
*/
public function containDown(int $width, int $height): self;
}

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface SpecializableInterface
{
/**
* Return the constructor arguments of the specializable object. Keyed by
* parameter name, used to construct the driver-specialized counterpart.
*
* @return array<string, mixed>
*/
public function specializationArguments(): array;
/**
* Set the driver for which the object will be specialized.
*/
public function setDriver(DriverInterface $driver): self;
/**
* Return the driver for which the object is specialized.
*/
public function driver(): DriverInterface;
}

View file

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface SpecializedInterface
{
//
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ThemeDefinitionInterface
{
/**
* Collect the colors needed to define the theme.
*/
public function collectColors(ImageInterface $image): PaletteInterface;
/**
* Assign the colors based on the theme definition.
*/
public function themeColors(PaletteInterface $image): ThemeInterface;
}

View file

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
interface ThemeInterface
{
/**
* Transform theme colors to palette.
*/
public function toPalette(): PaletteInterface;
}