mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 12:18:14 +01:00
Add missing doc blocks
This commit is contained in:
parent
706ca2c31d
commit
54aa51efda
@ -16,6 +16,14 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||
|
||||
class Color extends AbstractColor
|
||||
{
|
||||
/**
|
||||
* Create new color object
|
||||
*
|
||||
* @param int $h
|
||||
* @param int $s
|
||||
* @param int $l
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(int $h, int $s, int $l)
|
||||
{
|
||||
/** @throws void */
|
||||
|
@ -16,6 +16,14 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||
|
||||
class Color extends AbstractColor
|
||||
{
|
||||
/**
|
||||
* Create new color object
|
||||
*
|
||||
* @param int $h
|
||||
* @param int $s
|
||||
* @param int $v
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(int $h, int $s, int $v)
|
||||
{
|
||||
/** @throws void */
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\ColorInterface;
|
||||
|
||||
class TransparentColorDecoder extends HexColorDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_string($input)) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class ColorspaceAnalyzer extends GenericColorspaceAnalyzer implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
return new Colorspace();
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class HeightAnalyzer extends GenericHeightAnalyzer implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
return imagesy($image->core()->native());
|
||||
|
@ -15,6 +15,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class PixelColorAnalyzer extends GenericPixelColorAnalyzer implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
return $this->colorAt(
|
||||
|
@ -9,6 +9,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class PixelColorsAnalyzer extends PixelColorAnalyzer
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
$colors = new Collection();
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Resolution;
|
||||
|
||||
class ResolutionAnalyzer extends GenericResolutionAnalyzer implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
return new Resolution(...imageresolution($image->core()->native()));
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class WidthAnalyzer extends GenericWidthAnalyzer implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see AnalyzerInterface::analyze()
|
||||
*/
|
||||
public function analyze(ImageInterface $image): mixed
|
||||
{
|
||||
return imagesx($image->core()->native());
|
||||
|
@ -17,10 +17,21 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
|
||||
|
||||
class ColorProcessor implements ColorProcessorInterface
|
||||
{
|
||||
/**
|
||||
* Create new color processor object
|
||||
*
|
||||
* @param ColorspaceInterface $colorspace
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(protected ColorspaceInterface $colorspace = new Colorspace())
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ColorProcessorInterface::colorToNative()
|
||||
*/
|
||||
public function colorToNative(ColorInterface $color): int
|
||||
{
|
||||
// convert color to colorspace
|
||||
@ -39,6 +50,11 @@ class ColorProcessor implements ColorProcessorInterface
|
||||
return ($a << 24) + ($r << 16) + ($g << 8) + $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ColorProcessorInterface::nativeToColor()
|
||||
*/
|
||||
public function nativeToColor(mixed $value): ColorInterface
|
||||
{
|
||||
if (!is_int($value)) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class Base64ImageDecoder extends BinaryImageDecoder implements DecoderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!$this->isValidBase64($input)) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class DataUriImageDecoder extends BinaryImageDecoder implements DecoderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_string($input)) {
|
||||
|
@ -13,6 +13,11 @@ use Intervention\Image\Modifiers\AlignRotationModifier;
|
||||
|
||||
class FilePathImageDecoder extends NativeObjectDecoder implements DecoderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!$this->isFile($input)) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class FilePointerImageDecoder extends BinaryImageDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_resource($input) || !in_array(get_resource_type($input), ['file', 'stream'])) {
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class SplFileInfoImageDecoder extends FilePathImageDecoder implements DecoderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_a($input, SplFileInfo::class)) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class AvifEncoder extends GenericAvifEncoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see EncoderInterface::encode()
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImage
|
||||
{
|
||||
$gd = $image->core()->native();
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class BmpEncoder extends GenericBmpEncoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see EncoderInterface::encode()
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImage
|
||||
{
|
||||
$data = $this->buffered(function () use ($image) {
|
||||
|
@ -15,6 +15,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class GifEncoder extends GenericGifEncoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see EncoderInterface::encode()
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImage
|
||||
{
|
||||
if ($image->isAnimated()) {
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see EncoderInterface::encode()
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImage
|
||||
{
|
||||
$blendingColor = $this->driver()->handleInput(
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\SpecializedInterface;
|
||||
|
||||
class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see EncoderInterface::encode()
|
||||
*/
|
||||
public function encode(ImageInterface $image): EncodedImage
|
||||
{
|
||||
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\AlignRotationModifier as GenericAlignRotationMo
|
||||
|
||||
class AlignRotationModifier extends GenericAlignRotationModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$image = match ($image->exif('IFD0.Orientation')) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Modifiers\BlendTransparencyModifier as GenericBlendTransp
|
||||
|
||||
class BlendTransparencyModifier extends GenericBlendTransparencyModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
// decode blending color
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\BlurModifier as GenericBlurModifier;
|
||||
|
||||
class BlurModifier extends GenericBlurModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier
|
||||
|
||||
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\ColorizeModifier as GenericColorizeModifier;
|
||||
|
||||
class ColorizeModifier extends GenericColorizeModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
// normalize colorize levels
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Modifiers\ColorspaceModifier as GenericColorspaceModifier
|
||||
|
||||
class ColorspaceModifier extends GenericColorspaceModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
if (!is_a($this->targetColorspace(), RgbColorspace::class)) {
|
||||
|
@ -18,6 +18,11 @@ use Intervention\Image\Modifiers\ContainModifier as GenericContainModifier;
|
||||
|
||||
class ContainModifier extends GenericContainModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$crop = $this->getCropSize($image);
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\ContrastModifier as GenericContrastModifier;
|
||||
|
||||
class ContrastModifier extends GenericContrastModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -14,6 +14,11 @@ use Intervention\Image\Modifiers\CoverModifier as GenericCoverModifier;
|
||||
|
||||
class CoverModifier extends GenericCoverModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$crop = $this->getCropSize($image);
|
||||
|
@ -14,6 +14,11 @@ use Intervention\Image\Modifiers\CropModifier as GenericCropModifier;
|
||||
|
||||
class CropModifier extends GenericCropModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$originalSize = $image->size();
|
||||
|
@ -13,6 +13,9 @@ use Intervention\Image\Modifiers\DrawBezierModifier as ModifiersDrawBezierModifi
|
||||
class DrawBezierModifier extends ModifiersDrawBezierModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
* @throws RuntimeException
|
||||
* @throws GeometryException
|
||||
*/
|
||||
|
@ -12,6 +12,9 @@ use Intervention\Image\Modifiers\DrawEllipseModifier as GenericDrawEllipseModifi
|
||||
class DrawEllipseModifier extends GenericDrawEllipseModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\DrawPixelModifier as GenericDrawPixelModifier;
|
||||
|
||||
class DrawPixelModifier extends GenericDrawPixelModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$color = $this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||
|
@ -12,6 +12,9 @@ use Intervention\Image\Modifiers\DrawPolygonModifier as ModifiersDrawPolygonModi
|
||||
class DrawPolygonModifier extends ModifiersDrawPolygonModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
|
@ -12,6 +12,9 @@ use Intervention\Image\Modifiers\DrawRectangleModifier as GenericDrawRectangleMo
|
||||
class DrawRectangleModifier extends GenericDrawRectangleModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Modifiers\FillModifier as GenericFillModifier;
|
||||
|
||||
class FillModifier extends GenericFillModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$color = $this->color($image);
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\FlipModifier as GenericFlipModifier;
|
||||
|
||||
class FlipModifier extends GenericFlipModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\FlopModifier as GenericFlopModifier;
|
||||
|
||||
class FlopModifier extends GenericFlopModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\GammaModifier as GenericGammaModifier;
|
||||
|
||||
class GammaModifier extends GenericGammaModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\GreyscaleModifier as GenericGreyscaleModifier;
|
||||
|
||||
class GreyscaleModifier extends GenericGreyscaleModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\InvertModifier as GenericInvertModifier;
|
||||
|
||||
class InvertModifier extends GenericInvertModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\PixelateModifier as GenericPixelateModifier;
|
||||
|
||||
class PixelateModifier extends GenericPixelateModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
foreach ($image as $frame) {
|
||||
|
@ -13,6 +13,11 @@ use Intervention\Image\Modifiers\PlaceModifier as GenericPlaceModifier;
|
||||
|
||||
class PlaceModifier extends GenericPlaceModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$watermark = $this->driver()->handleInput($this->element);
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Modifiers\ProfileModifier as GenericProfileModifier;
|
||||
|
||||
class ProfileModifier extends GenericProfileModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
throw new NotSupportedException(
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\ProfileRemovalModifier as GenericProfileRemoval
|
||||
|
||||
class ProfileRemovalModifier extends GenericProfileRemovalModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
// Color profiles are not supported by GD, so the decoded
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Modifiers\QuantizeColorsModifier as GenericQuantizeColors
|
||||
|
||||
class QuantizeColorsModifier extends GenericQuantizeColorsModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
if ($this->limit <= 0) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\RemoveAnimationModifier as GenericRemoveAnimati
|
||||
|
||||
class RemoveAnimationModifier extends GenericRemoveAnimationModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$image->core()->setNative(
|
||||
|
@ -18,6 +18,11 @@ use Intervention\Image\Modifiers\ResizeCanvasModifier as GenericResizeCanvasModi
|
||||
|
||||
class ResizeCanvasModifier extends GenericResizeCanvasModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$resize = $this->cropSize($image);
|
||||
|
@ -6,6 +6,7 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\Gd\Cloner;
|
||||
use Intervention\Image\Exceptions\ColorException;
|
||||
use Intervention\Image\Exceptions\GeometryException;
|
||||
use Intervention\Image\Exceptions\RuntimeException;
|
||||
use Intervention\Image\Interfaces\FrameInterface;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
@ -15,6 +16,11 @@ use Intervention\Image\Modifiers\ResizeModifier as GenericResizeModifier;
|
||||
|
||||
class ResizeModifier extends GenericResizeModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$resizeTo = $this->getAdjustedSize($image);
|
||||
@ -52,7 +58,12 @@ class ResizeModifier extends GenericResizeModifier implements SpecializedInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size the modifier will resize to
|
||||
*
|
||||
* @param ImageInterface $image
|
||||
* @throws RuntimeException
|
||||
* @throws GeometryException
|
||||
* @return SizeInterface
|
||||
*/
|
||||
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\ResolutionModifier as GenericResolutionModifier
|
||||
|
||||
class ResolutionModifier extends GenericResolutionModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$x = intval(round($this->x));
|
||||
|
@ -18,6 +18,11 @@ use Intervention\Image\Modifiers\RotateModifier as GenericRotateModifier;
|
||||
|
||||
class RotateModifier extends GenericRotateModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$background = $this->driver()->handleInput($this->background);
|
||||
|
@ -9,6 +9,11 @@ use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class ScaleDownModifier extends ResizeModifier
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ResizeModifier::getAdjustedSize()
|
||||
*/
|
||||
protected function getAdjustedSize(ImageInterface $image): SizeInterface
|
||||
{
|
||||
return $image->size()->scaleDown($this->width, $this->height);
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Modifiers\SharpenModifier as GenericSharpenModifier;
|
||||
|
||||
class SharpenModifier extends GenericSharpenModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$matrix = $this->matrix();
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Modifiers\SliceAnimationModifier as GenericSliceAnimation
|
||||
|
||||
class SliceAnimationModifier extends GenericSliceAnimationModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
if ($this->offset >= $image->count()) {
|
||||
|
@ -14,6 +14,11 @@ use Intervention\Image\Modifiers\TrimModifier as GenericTrimModifier;
|
||||
|
||||
class TrimModifier extends GenericTrimModifier implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ModifierInterface::apply()
|
||||
*/
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
if ($image->isAnimated()) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class Base64ImageDecoder extends BinaryImageDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!$this->isValidBase64($input)) {
|
||||
|
@ -13,6 +13,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class BinaryImageDecoder extends NativeObjectDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_string($input)) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class DataUriImageDecoder extends BinaryImageDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_string($input)) {
|
||||
|
@ -12,6 +12,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class FilePathImageDecoder extends NativeObjectDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!$this->isFile($input)) {
|
||||
|
@ -10,6 +10,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class FilePointerImageDecoder extends BinaryImageDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_resource($input) || !in_array(get_resource_type($input), ['file', 'stream'])) {
|
||||
|
@ -17,6 +17,11 @@ use Intervention\Image\Modifiers\RemoveAnimationModifier;
|
||||
|
||||
class NativeObjectDecoder extends SpecializableDecoder implements SpecializedInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_object($input)) {
|
||||
|
@ -11,6 +11,11 @@ use Intervention\Image\Interfaces\ImageInterface;
|
||||
|
||||
class SplFileInfoImageDecoder extends FilePathImageDecoder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
if (!is_a($input, SplFileInfo::class)) {
|
||||
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Intervention\Image\Drivers\Imagick;
|
||||
|
||||
use Imagick;
|
||||
use ImagickException;
|
||||
use ImagickPixel;
|
||||
use Intervention\Image\Geometry\Rectangle;
|
||||
use Intervention\Image\Image;
|
||||
@ -15,6 +16,13 @@ use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class Frame implements FrameInterface
|
||||
{
|
||||
/**
|
||||
* Create new frame object
|
||||
*
|
||||
* @param Imagick $native
|
||||
* @throws ImagickException
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(protected Imagick $native)
|
||||
{
|
||||
$background = new ImagickPixel('rgba(255, 255, 255, 0)');
|
||||
|
@ -14,6 +14,11 @@ abstract class SpecializableDecoder extends AbstractDecoder implements Specializ
|
||||
{
|
||||
use CanBeDriverSpecialized;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see DecoderInterface::decode()
|
||||
*/
|
||||
public function decode(mixed $input): ImageInterface|ColorInterface
|
||||
{
|
||||
throw new DecoderException('Decoder must be specialized by the driver first.');
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class AvifEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $quality = self::DEFAULT_QUALITY)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class GifEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param bool $interlaced
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public bool $interlaced = false)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class HeicEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $quality = self::DEFAULT_QUALITY)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class Jpeg2000Encoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $quality = self::DEFAULT_QUALITY)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,13 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class JpegEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @param bool $progressive
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public int $quality = self::DEFAULT_QUALITY,
|
||||
public bool $progressive = false
|
||||
|
@ -8,6 +8,13 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class PngEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param bool $interlaced
|
||||
* @param bool $indexed
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public bool $interlaced = false, public bool $indexed = false)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class TiffEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $quality = self::DEFAULT_QUALITY)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableEncoder;
|
||||
|
||||
class WebpEncoder extends SpecializableEncoder
|
||||
{
|
||||
/**
|
||||
* Create new encoder object
|
||||
*
|
||||
* @param int $quality
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $quality = self::DEFAULT_QUALITY)
|
||||
{
|
||||
}
|
||||
|
@ -6,5 +6,10 @@ namespace Intervention\Image\Interfaces;
|
||||
|
||||
interface ProfileInterface
|
||||
{
|
||||
/**
|
||||
* Cast color profile object to string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string;
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class BlendTransparencyModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param mixed $color
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public mixed $color = null)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,14 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ColorizeModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $red
|
||||
* @param int $green
|
||||
* @param int $blue
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public int $red = 0,
|
||||
public int $green = 0,
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ContrastModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $level
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $level)
|
||||
{
|
||||
}
|
||||
|
@ -12,6 +12,14 @@ use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class CoverModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param string $position
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public int $width,
|
||||
public int $height,
|
||||
|
@ -12,6 +12,17 @@ use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class CropModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param int $offset_x
|
||||
* @param int $offset_y
|
||||
* @param mixed $background
|
||||
* @param string $position
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public int $width,
|
||||
public int $height,
|
||||
|
@ -9,10 +9,21 @@ use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawBezierModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param Bezier $drawable
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public Bezier $drawable)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn
|
||||
*
|
||||
* @return DrawableInterface
|
||||
*/
|
||||
public function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
|
@ -9,10 +9,21 @@ use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawLineModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param Line $drawable
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public Line $drawable)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn
|
||||
*
|
||||
* @return DrawableInterface
|
||||
*/
|
||||
public function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
|
@ -9,6 +9,13 @@ use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class DrawPixelModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param PointInterface $position
|
||||
* @param mixed $color
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public PointInterface $position,
|
||||
public mixed $color
|
||||
|
@ -9,10 +9,21 @@ use Intervention\Image\Interfaces\DrawableInterface;
|
||||
|
||||
class DrawRectangleModifier extends AbstractDrawModifier
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Create new modifier object
|
||||
* @param Rectangle $drawable
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public Rectangle $drawable)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object to be drawn
|
||||
*
|
||||
* @return DrawableInterface
|
||||
*/
|
||||
public function drawable(): DrawableInterface
|
||||
{
|
||||
return $this->drawable;
|
||||
|
@ -11,6 +11,16 @@ use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class PlaceModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param mixed $element
|
||||
* @param string $position
|
||||
* @param int $offset_x
|
||||
* @param int $offset_y
|
||||
* @param int $opacity
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public mixed $element,
|
||||
public string $position = 'top-left',
|
||||
|
@ -8,6 +8,13 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class QuantizeColorsModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $limit
|
||||
* @param mixed $background
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public int $limit,
|
||||
public mixed $background = 'ffffff'
|
||||
|
@ -12,6 +12,15 @@ use Intervention\Image\Interfaces\SizeInterface;
|
||||
|
||||
class ResizeCanvasModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @param mixed $background
|
||||
* @param string $position
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public ?int $width = null,
|
||||
public ?int $height = null,
|
||||
|
@ -8,6 +8,13 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ResizeModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param null|int $width
|
||||
* @param null|int $height
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public ?int $width = null, public ?int $height = null)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,13 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class ResolutionModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public float $x, public float $y)
|
||||
{
|
||||
}
|
||||
|
@ -14,6 +14,14 @@ use Intervention\Image\Interfaces\PointInterface;
|
||||
|
||||
class TextModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param string $text
|
||||
* @param PointInterface $position
|
||||
* @param FontInterface $font
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
public string $text,
|
||||
public PointInterface $position,
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Drivers\SpecializableModifier;
|
||||
|
||||
class TrimModifier extends SpecializableModifier
|
||||
{
|
||||
/**
|
||||
* Create new modifier object
|
||||
*
|
||||
* @param int $tolerance
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public int $tolerance = 0)
|
||||
{
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ use Intervention\Image\Collection;
|
||||
|
||||
class TextBlock extends Collection
|
||||
{
|
||||
/**
|
||||
* Create new text block object
|
||||
*
|
||||
* @param string $text
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $text)
|
||||
{
|
||||
foreach (explode("\n", $text) as $line) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user