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
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:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
69
vendor/intervention/image/src/Modifiers/AbstractDrawModifier.php
vendored
Normal file
69
vendor/intervention/image/src/Modifiers/AbstractDrawModifier.php
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Color;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\ColorDecoderException;
|
||||
use Intervention\Image\Exceptions\ModifierException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
abstract class AbstractDrawModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Return the drawable object which will be rendered by the modifier.
|
||||
*/
|
||||
abstract protected function drawable(): DrawableInterface;
|
||||
|
||||
/**
|
||||
* Return the background color of the object rendered by the modifier.
|
||||
*
|
||||
* @throws StateException
|
||||
* @throws ColorDecoderException
|
||||
*/
|
||||
protected function backgroundColor(): ColorInterface
|
||||
{
|
||||
$backgroundColor = $this->drawable()->backgroundColor();
|
||||
|
||||
if ($backgroundColor === null) {
|
||||
return Color::transparent();
|
||||
}
|
||||
|
||||
return $this->driver()->decodeColor($backgroundColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the border color of the object rendered by the modifier.
|
||||
*
|
||||
* @throws StateException
|
||||
* @throws ColorDecoderException
|
||||
*/
|
||||
protected function borderColor(): ColorInterface
|
||||
{
|
||||
$borderColor = $this->drawable()->borderColor();
|
||||
|
||||
if ($borderColor === null || $this->drawable()->hasBorder() === false) {
|
||||
return Color::transparent();
|
||||
}
|
||||
|
||||
return $this->driver()->decodeColor($borderColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw ModifierException with given message if result is false.
|
||||
*
|
||||
* @throws ModifierException
|
||||
*/
|
||||
protected function abortUnless(mixed $result, string $message): void
|
||||
{
|
||||
if ($result === false) {
|
||||
throw new ModifierException(
|
||||
'Failed to apply ' . self::class . ', ' . $message,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
vendor/intervention/image/src/Modifiers/BlurModifier.php
vendored
Normal file
21
vendor/intervention/image/src/Modifiers/BlurModifier.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class BlurModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int $level)
|
||||
{
|
||||
if ($this->level < 0) {
|
||||
throw new InvalidArgumentException('Invalid blur level. Must be int<0, max>');
|
||||
}
|
||||
}
|
||||
}
|
||||
15
vendor/intervention/image/src/Modifiers/BrightnessModifier.php
vendored
Normal file
15
vendor/intervention/image/src/Modifiers/BrightnessModifier.php
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class BrightnessModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(public int $level)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
34
vendor/intervention/image/src/Modifiers/ColorizeModifier.php
vendored
Normal file
34
vendor/intervention/image/src/Modifiers/ColorizeModifier.php
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class ColorizeModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(
|
||||
public int $red = 0,
|
||||
public int $green = 0,
|
||||
public int $blue = 0,
|
||||
) {
|
||||
if ($red < -100 || $red > 100) {
|
||||
throw new InvalidArgumentException('Color level for argument $red must be in range -100 to 100');
|
||||
}
|
||||
|
||||
if ($green < -100 || $green > 100) {
|
||||
throw new InvalidArgumentException('Color level for argument $green must be in range -100 to 100');
|
||||
}
|
||||
|
||||
if ($blue < -100 || $blue > 100) {
|
||||
throw new InvalidArgumentException('Color level for argument $blue must be in range -100 to 100');
|
||||
}
|
||||
}
|
||||
}
|
||||
59
vendor/intervention/image/src/Modifiers/ColorspaceModifier.php
vendored
Normal file
59
vendor/intervention/image/src/Modifiers/ColorspaceModifier.php
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Colors\Cmyk\Colorspace as Cmyk;
|
||||
use Intervention\Image\Colors\Hsl\Colorspace as Hsl;
|
||||
use Intervention\Image\Colors\Hsv\Colorspace as Hsv;
|
||||
use Intervention\Image\Colors\Oklab\Colorspace as Oklab;
|
||||
use Intervention\Image\Colors\Oklch\Colorspace as Oklch;
|
||||
use Intervention\Image\Colors\Rgb\Colorspace as Rgb;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\NotSupportedException;
|
||||
use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||
|
||||
class ColorspaceModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(public string|ColorspaceInterface $target)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the target color space.
|
||||
*
|
||||
* @throws NotSupportedException
|
||||
*/
|
||||
protected function targetColorspace(): ColorspaceInterface
|
||||
{
|
||||
if ($this->target instanceof ColorspaceInterface) {
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
if (class_exists($this->target)) {
|
||||
$colorspace = new $this->target();
|
||||
|
||||
if (!$colorspace instanceof ColorspaceInterface) {
|
||||
throw new NotSupportedException(
|
||||
'Target colorspace "' . $this->target . '" is not supported by driver',
|
||||
);
|
||||
}
|
||||
|
||||
return $colorspace;
|
||||
}
|
||||
|
||||
return match (strtolower($this->target)) {
|
||||
'rgb', 'srgb', 'rgba', 'srgba' => new Rgb(),
|
||||
'cmyk' => new Cmyk(),
|
||||
'hsl' => new Hsl(),
|
||||
'hsv', 'hsb' => new Hsv(),
|
||||
'oklab' => new Oklab(),
|
||||
'oklch' => new Oklch(),
|
||||
default => throw new NotSupportedException(
|
||||
'Colorspace is not supported by driver',
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
30
vendor/intervention/image/src/Modifiers/ContainDownModifier.php
vendored
Normal file
30
vendor/intervention/image/src/Modifiers/ContainDownModifier.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class ContainDownModifier extends ContainModifier
|
||||
{
|
||||
/**
|
||||
* Calculate crop size of the contain down resizing process.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function cropSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
return $image->size()
|
||||
->containDown(
|
||||
$this->width,
|
||||
$this->height,
|
||||
)
|
||||
->alignPivotTo(
|
||||
$this->resizeSize($image),
|
||||
$this->alignment,
|
||||
);
|
||||
}
|
||||
}
|
||||
66
vendor/intervention/image/src/Modifiers/ContainModifier.php
vendored
Normal file
66
vendor/intervention/image/src/Modifiers/ContainModifier.php
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Alignment;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
use Intervention\Image\Size;
|
||||
|
||||
class ContainModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(
|
||||
public int $width,
|
||||
public int $height,
|
||||
public null|string|ColorInterface $background = null,
|
||||
public string|Alignment $alignment = Alignment::CENTER,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the crop size of the contain resizing process.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function cropSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
return $image->size()
|
||||
->contain(
|
||||
$this->width,
|
||||
$this->height,
|
||||
)
|
||||
->alignPivotTo(
|
||||
$this->resizeSize($image),
|
||||
$this->alignment,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the resize target size of the contain resizing process.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function resizeSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
return new Size($this->width, $this->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color to fill newly created areas after resizing.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function backgroundColor(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor(
|
||||
$this->background ?? $this->driver()->config()->backgroundColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
18
vendor/intervention/image/src/Modifiers/ContrastModifier.php
vendored
Normal file
18
vendor/intervention/image/src/Modifiers/ContrastModifier.php
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ContrastModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public int $level)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
10
vendor/intervention/image/src/Modifiers/CoverDownModifier.php
vendored
Normal file
10
vendor/intervention/image/src/Modifiers/CoverDownModifier.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
class CoverDownModifier extends CoverModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
50
vendor/intervention/image/src/Modifiers/CoverModifier.php
vendored
Normal file
50
vendor/intervention/image/src/Modifiers/CoverModifier.php
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
use Intervention\Image\Alignment;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Size;
|
||||
|
||||
class CoverModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $width,
|
||||
public int $height,
|
||||
public string|Alignment $alignment = Alignment::CENTER,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate crop size of the cover resizing process
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function cropSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
$imagesize = $image->size();
|
||||
$crop = new Size($this->width, $this->height);
|
||||
|
||||
return $crop->contain(
|
||||
$imagesize->width(),
|
||||
$imagesize->height(),
|
||||
)->alignPivotTo($imagesize, $this->alignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate size for the resizing step of the cover modifier
|
||||
*/
|
||||
protected function resizeSize(SizeInterface $size): SizeInterface
|
||||
{
|
||||
return $size->resize($this->width, $this->height);
|
||||
}
|
||||
}
|
||||
57
vendor/intervention/image/src/Modifiers/CropModifier.php
vendored
Normal file
57
vendor/intervention/image/src/Modifiers/CropModifier.php
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Alignment;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
use Intervention\Image\Size;
|
||||
|
||||
class CropModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $width,
|
||||
public int $height,
|
||||
public int $x = 0,
|
||||
public int $y = 0,
|
||||
public null|string|ColorInterface $background = null,
|
||||
public string|Alignment $alignment = Alignment::TOP_LEFT,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function crop(ImageInterface $image): SizeInterface
|
||||
{
|
||||
$crop = new Size($this->width, $this->height);
|
||||
$crop->movePivot($this->alignment);
|
||||
|
||||
return $crop->alignPivotTo(
|
||||
$image->size(),
|
||||
$this->alignment,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color to fill newly created areas after resizing.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function backgroundColor(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor(
|
||||
$this->background ?? $this->driver()->config()->backgroundColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
27
vendor/intervention/image/src/Modifiers/DrawBezierModifier.php
vendored
Normal file
27
vendor/intervention/image/src/Modifiers/DrawBezierModifier.php
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Geometry\Bezier;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawBezierModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public Bezier $drawable)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn.
|
||||
*/
|
||||
protected function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
}
|
||||
}
|
||||
24
vendor/intervention/image/src/Modifiers/DrawEllipseModifier.php
vendored
Normal file
24
vendor/intervention/image/src/Modifiers/DrawEllipseModifier.php
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Geometry\Ellipse;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawEllipseModifier extends AbstractDrawModifier
|
||||
{
|
||||
public function __construct(public Ellipse $drawable)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn.
|
||||
*/
|
||||
protected function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
}
|
||||
}
|
||||
27
vendor/intervention/image/src/Modifiers/DrawLineModifier.php
vendored
Normal file
27
vendor/intervention/image/src/Modifiers/DrawLineModifier.php
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Geometry\Line;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawLineModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public Line $drawable)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn.
|
||||
*/
|
||||
protected function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
}
|
||||
}
|
||||
35
vendor/intervention/image/src/Modifiers/DrawPixelModifier.php
vendored
Normal file
35
vendor/intervention/image/src/Modifiers/DrawPixelModifier.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\ColorDecoderException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class DrawPixelModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(
|
||||
public PointInterface $position,
|
||||
public string|ColorInterface $color,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color for the new pixel.
|
||||
*
|
||||
* @throws StateException
|
||||
* @throws ColorDecoderException
|
||||
*/
|
||||
protected function color(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor($this->color);
|
||||
}
|
||||
}
|
||||
30
vendor/intervention/image/src/Modifiers/DrawPolygonModifier.php
vendored
Normal file
30
vendor/intervention/image/src/Modifiers/DrawPolygonModifier.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Geometry\Polygon;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawPolygonModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public Polygon $drawable)
|
||||
{
|
||||
if ($drawable->count() < 3) {
|
||||
throw new InvalidArgumentException('The polygon must have at least 3 points');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn.
|
||||
*/
|
||||
protected function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
}
|
||||
}
|
||||
27
vendor/intervention/image/src/Modifiers/DrawRectangleModifier.php
vendored
Normal file
27
vendor/intervention/image/src/Modifiers/DrawRectangleModifier.php
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Geometry\Rectangle;
|
||||
use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawRectangleModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public Rectangle $drawable)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn.
|
||||
*/
|
||||
protected function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
}
|
||||
}
|
||||
40
vendor/intervention/image/src/Modifiers/FillModifier.php
vendored
Normal file
40
vendor/intervention/image/src/Modifiers/FillModifier.php
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\ColorDecoderException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class FillModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(
|
||||
public string|ColorInterface $color,
|
||||
public ?PointInterface $position = null,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the modifier has a position defined.
|
||||
*/
|
||||
public function hasPosition(): bool
|
||||
{
|
||||
return $this->position instanceof PointInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filling color object.
|
||||
*
|
||||
* @throws ColorDecoderException
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function color(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor($this->color);
|
||||
}
|
||||
}
|
||||
30
vendor/intervention/image/src/Modifiers/FillTransparentAreasModifier.php
vendored
Normal file
30
vendor/intervention/image/src/Modifiers/FillTransparentAreasModifier.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\DriverInterface;
|
||||
|
||||
class FillTransparentAreasModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public null|string|ColorInterface $color = null)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode background color of current modifier with given driver.
|
||||
*/
|
||||
protected function backgroundColor(DriverInterface $driver): ColorInterface
|
||||
{
|
||||
return $driver->decodeColor(
|
||||
$this->color !== null ? $this->color : $driver->config()->backgroundColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
16
vendor/intervention/image/src/Modifiers/FlipModifier.php
vendored
Normal file
16
vendor/intervention/image/src/Modifiers/FlipModifier.php
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Direction;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class FlipModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(public Direction $direction = Direction::HORIZONTAL)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
15
vendor/intervention/image/src/Modifiers/GammaModifier.php
vendored
Normal file
15
vendor/intervention/image/src/Modifiers/GammaModifier.php
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class GammaModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(public float $gamma)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
12
vendor/intervention/image/src/Modifiers/GrayscaleModifier.php
vendored
Normal file
12
vendor/intervention/image/src/Modifiers/GrayscaleModifier.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class GrayscaleModifier extends SpecializableModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
49
vendor/intervention/image/src/Modifiers/InsertModifier.php
vendored
Normal file
49
vendor/intervention/image/src/Modifiers/InsertModifier.php
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Alignment;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class InsertModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(
|
||||
public mixed $image,
|
||||
public int $x = 0,
|
||||
public int $y = 0,
|
||||
public string|Alignment $alignment = Alignment::TOP_LEFT,
|
||||
public float $transparency = 1,
|
||||
) {
|
||||
if ($this->transparency < 0 || $this->transparency > 1) {
|
||||
throw new InvalidArgumentException('Transparency must be in range 0 to 1');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate position of the watermark to be inserted on the image.
|
||||
*/
|
||||
public function position(ImageInterface $image, ImageInterface $watermark): PointInterface
|
||||
{
|
||||
$imageSize = $image->size()->movePivot(
|
||||
$this->alignment,
|
||||
$this->x,
|
||||
$this->y,
|
||||
);
|
||||
|
||||
$watermarkSize = $watermark->size()->movePivot(
|
||||
$this->alignment,
|
||||
);
|
||||
|
||||
return $imageSize->offsetTo($watermarkSize);
|
||||
}
|
||||
}
|
||||
12
vendor/intervention/image/src/Modifiers/InvertModifier.php
vendored
Normal file
12
vendor/intervention/image/src/Modifiers/InvertModifier.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class InvertModifier extends SpecializableModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
12
vendor/intervention/image/src/Modifiers/OrientModifier.php
vendored
Normal file
12
vendor/intervention/image/src/Modifiers/OrientModifier.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class OrientModifier extends SpecializableModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
21
vendor/intervention/image/src/Modifiers/PixelateModifier.php
vendored
Normal file
21
vendor/intervention/image/src/Modifiers/PixelateModifier.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class PixelateModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int $size)
|
||||
{
|
||||
if ($this->size < 1) {
|
||||
throw new InvalidArgumentException('Invalid pixelation size. Must be int<1, max>');
|
||||
}
|
||||
}
|
||||
}
|
||||
16
vendor/intervention/image/src/Modifiers/ProfileModifier.php
vendored
Normal file
16
vendor/intervention/image/src/Modifiers/ProfileModifier.php
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Interfaces\ProfileInterface;
|
||||
|
||||
class ProfileModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(public ProfileInterface $profile)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
40
vendor/intervention/image/src/Modifiers/ReduceColorsModifier.php
vendored
Normal file
40
vendor/intervention/image/src/Modifiers/ReduceColorsModifier.php
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class ReduceColorsModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(
|
||||
public int $limit,
|
||||
public null|string|ColorInterface $background = null,
|
||||
) {
|
||||
if ($this->limit < 1) {
|
||||
throw new InvalidArgumentException('Invalid color limit. Must be int<1, max>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color in the image's colorspace to fill transparent areas.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function backgroundColor(ImageInterface $image): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor(
|
||||
$this->background ?? $this->driver()->config()->backgroundColor,
|
||||
)->toColorspace($image->colorspace());
|
||||
}
|
||||
}
|
||||
59
vendor/intervention/image/src/Modifiers/RemoveAnimationModifier.php
vendored
Normal file
59
vendor/intervention/image/src/Modifiers/RemoveAnimationModifier.php
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Interfaces\FrameInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class RemoveAnimationModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int|string $position = 0)
|
||||
{
|
||||
if (is_int($this->position) && $this->position < 0) {
|
||||
throw new InvalidArgumentException('Invalid position argument. Must be int<0, max>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function selectedFrame(ImageInterface $image): FrameInterface
|
||||
{
|
||||
return $image->core()->frame($this->normalizePosition($image));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the position of the selected frame as integer.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function normalizePosition(ImageInterface $image): int
|
||||
{
|
||||
if (is_int($this->position)) {
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
if (is_numeric($this->position)) {
|
||||
return (int) $this->position;
|
||||
}
|
||||
|
||||
// calculate position from percentage value
|
||||
if (preg_match("/^(?P<percent>[0-9]{1,3})%$/", $this->position, $matches) !== 1) {
|
||||
throw new InvalidArgumentException(
|
||||
'Position must be either integer or a percent value as string',
|
||||
);
|
||||
}
|
||||
|
||||
$total = count($image);
|
||||
$position = intval(round($total / 100 * intval($matches['percent'])));
|
||||
|
||||
return $position === $total ? $position - 1 : $position;
|
||||
}
|
||||
}
|
||||
12
vendor/intervention/image/src/Modifiers/RemoveProfileModifier.php
vendored
Normal file
12
vendor/intervention/image/src/Modifiers/RemoveProfileModifier.php
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class RemoveProfileModifier extends SpecializableModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
62
vendor/intervention/image/src/Modifiers/ResizeCanvasModifier.php
vendored
Normal file
62
vendor/intervention/image/src/Modifiers/ResizeCanvasModifier.php
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Alignment;
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
use Intervention\Image\Size;
|
||||
|
||||
class ResizeCanvasModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(
|
||||
public ?int $width = null,
|
||||
public ?int $height = null,
|
||||
public null|string|ColorInterface $background = null,
|
||||
public string|Alignment $alignment = Alignment::CENTER,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the crop size to be used for the ResizeCanvas process.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function cropSize(ImageInterface $image, bool $relative = false): SizeInterface
|
||||
{
|
||||
$size = match ($relative) {
|
||||
true => new Size(
|
||||
is_null($this->width) ? $image->width() : $image->width() + $this->width,
|
||||
is_null($this->height) ? $image->height() : $image->height() + $this->height,
|
||||
),
|
||||
default => new Size(
|
||||
is_null($this->width) ? $image->width() : $this->width,
|
||||
is_null($this->height) ? $image->height() : $this->height,
|
||||
),
|
||||
};
|
||||
|
||||
return $size->alignPivotTo($image->size(), $this->alignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color to fill newly created areas after resizing.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function backgroundColor(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor(
|
||||
$this->background ?? $this->driver()->config()->backgroundColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
10
vendor/intervention/image/src/Modifiers/ResizeCanvasRelativeModifier.php
vendored
Normal file
10
vendor/intervention/image/src/Modifiers/ResizeCanvasRelativeModifier.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
class ResizeCanvasRelativeModifier extends ResizeCanvasModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
10
vendor/intervention/image/src/Modifiers/ResizeDownModifier.php
vendored
Normal file
10
vendor/intervention/image/src/Modifiers/ResizeDownModifier.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
class ResizeDownModifier extends ResizeModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
23
vendor/intervention/image/src/Modifiers/ResizeModifier.php
vendored
Normal file
23
vendor/intervention/image/src/Modifiers/ResizeModifier.php
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class ResizeModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public ?int $width = null, public ?int $height = null)
|
||||
{
|
||||
if ($width === null && $height === null) {
|
||||
throw new InvalidArgumentException('At least one argument must be provided: width, height, or both.');
|
||||
}
|
||||
}
|
||||
}
|
||||
18
vendor/intervention/image/src/Modifiers/ResolutionModifier.php
vendored
Normal file
18
vendor/intervention/image/src/Modifiers/ResolutionModifier.php
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ResolutionModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(public float $x, public float $y)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
41
vendor/intervention/image/src/Modifiers/RotateModifier.php
vendored
Normal file
41
vendor/intervention/image/src/Modifiers/RotateModifier.php
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
|
||||
class RotateModifier extends SpecializableModifier
|
||||
{
|
||||
public function __construct(
|
||||
public float $angle,
|
||||
public null|string|ColorInterface $background = null,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Clockwise rotation angle.
|
||||
*
|
||||
* Restricted beyond 360 degrees because the end result is the same.
|
||||
*/
|
||||
public function rotationAngle(): float
|
||||
{
|
||||
return fmod($this->angle, 360);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color to fill newly created areas after rotation.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function backgroundColor(): ColorInterface
|
||||
{
|
||||
return $this->driver()->decodeColor(
|
||||
$this->background ?? $this->driver()->config()->backgroundColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
10
vendor/intervention/image/src/Modifiers/ScaleDownModifier.php
vendored
Normal file
10
vendor/intervention/image/src/Modifiers/ScaleDownModifier.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
class ScaleDownModifier extends ScaleModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
10
vendor/intervention/image/src/Modifiers/ScaleModifier.php
vendored
Normal file
10
vendor/intervention/image/src/Modifiers/ScaleModifier.php
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
class ScaleModifier extends ResizeModifier
|
||||
{
|
||||
//
|
||||
}
|
||||
21
vendor/intervention/image/src/Modifiers/SharpenModifier.php
vendored
Normal file
21
vendor/intervention/image/src/Modifiers/SharpenModifier.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class SharpenModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int $level)
|
||||
{
|
||||
if ($this->level < 0) {
|
||||
throw new InvalidArgumentException('Invalid sharpening level. Must be int<0, max>');
|
||||
}
|
||||
}
|
||||
}
|
||||
21
vendor/intervention/image/src/Modifiers/SliceAnimationModifier.php
vendored
Normal file
21
vendor/intervention/image/src/Modifiers/SliceAnimationModifier.php
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class SliceAnimationModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int $offset = 0, public ?int $length = null)
|
||||
{
|
||||
if ($this->length !== null && $this->length <= 0) {
|
||||
throw new InvalidArgumentException('Length must be greater than or equal to 1');
|
||||
}
|
||||
}
|
||||
}
|
||||
89
vendor/intervention/image/src/Modifiers/TextModifier.php
vendored
Normal file
89
vendor/intervention/image/src/Modifiers/TextModifier.php
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\StateException;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Interfaces\ColorInterface;
|
||||
use Intervention\Image\Interfaces\FontInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class TextModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $text,
|
||||
public PointInterface $position,
|
||||
public FontInterface $font,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode text color.
|
||||
*
|
||||
* The text outline effect is drawn with a trick by plotting additional text
|
||||
* under the actual text with an offset in the color of the outline effect.
|
||||
* For this reason, no colors with transparency can be used for the text
|
||||
* color or the color of the stroke effect, as this would be superimposed.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function textColor(): ColorInterface
|
||||
{
|
||||
$color = $this->driver()->decodeColor($this->font->color());
|
||||
|
||||
if ($this->font->hasStrokeEffect() && $color->isTransparent()) {
|
||||
throw new StateException(
|
||||
'The text color must be fully opaque when using the stroke effect',
|
||||
);
|
||||
}
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode outline stroke color.
|
||||
*
|
||||
* @throws StateException
|
||||
*/
|
||||
protected function strokeColor(): ColorInterface
|
||||
{
|
||||
$color = $this->driver()->decodeColor($this->font->strokeColor());
|
||||
|
||||
if ($color->isTransparent()) {
|
||||
throw new StateException(
|
||||
'The stroke color must be fully opaque',
|
||||
);
|
||||
}
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of offset points to draw text stroke effect below the actual text.
|
||||
*
|
||||
* @return array<PointInterface>
|
||||
*/
|
||||
protected function strokeOffsets(FontInterface $font): array
|
||||
{
|
||||
$offsets = [];
|
||||
|
||||
if ($font->strokeWidth() <= 0) {
|
||||
return $offsets;
|
||||
}
|
||||
|
||||
for ($x = $font->strokeWidth() * -1; $x <= $font->strokeWidth(); $x++) {
|
||||
for ($y = $font->strokeWidth() * -1; $y <= $font->strokeWidth(); $y++) {
|
||||
$offsets[] = new Point($x, $y);
|
||||
}
|
||||
}
|
||||
|
||||
return $offsets;
|
||||
}
|
||||
}
|
||||
23
vendor/intervention/image/src/Modifiers/TrimModifier.php
vendored
Normal file
23
vendor/intervention/image/src/Modifiers/TrimModifier.php
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Intervention\Image\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\SpecializableModifier;
|
||||
use Intervention\Image\Exceptions\InvalidArgumentException;
|
||||
|
||||
class TrimModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(public int $tolerance = 0)
|
||||
{
|
||||
if ($this->tolerance < 0) {
|
||||
throw new InvalidArgumentException('Invalid trim tolerance. Must be int<0, max>');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue