Skip to content

Commit

Permalink
Add tests, improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed May 10, 2024
1 parent 3ad4261 commit 64632cd
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 108 deletions.
24 changes: 3 additions & 21 deletions src/Config.php
Expand Up @@ -9,10 +9,6 @@

class Config implements ConfigInterface
{
public const AUTO_ORIENTATION = 'autoOrientation';
public const DECODE_ANIMATION = 'decodeAnimation';
public const BLENDING_COLOR = 'blendingColor';

/**
* Create config object instance
*
Expand All @@ -22,26 +18,12 @@ class Config implements ConfigInterface
* @return void
*/
public function __construct(
protected bool $autoOrientation = true,
protected bool $decodeAnimation = true,
protected mixed $blendingColor = 'ffffff00',
public bool $autoOrientation = true,
public bool $decodeAnimation = true,
public mixed $blendingColor = 'ffffff',
) {
}

/**
* {@inheritdoc}
*
* @see ConfigInterface::option()
*/
public function option(string $name, mixed $default = null): mixed
{
if (!property_exists($this, $name)) {
return $default;
}

return $this->{$name};
}

/**
* {@inheritdoc}
*
Expand Down
3 changes: 1 addition & 2 deletions src/Drivers/Gd/Decoders/BinaryImageDecoder.php
Expand Up @@ -4,7 +4,6 @@

namespace Intervention\Image\Drivers\Gd\Decoders;

use Intervention\Image\Config;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
Expand Down Expand Up @@ -61,7 +60,7 @@ private function decodeBinary(string $input): ImageInterface
}

// adjust image orientation
if ($this->driver()->config()->option(Config::AUTO_ORIENTATION) === true) {
if ($this->driver()->config()->autoOrientation === true) {

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 63 in src/Drivers/Gd/Decoders/BinaryImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.
$image->modify(new AlignRotationModifier());
}

Expand Down
3 changes: 1 addition & 2 deletions src/Drivers/Gd/Decoders/FilePathImageDecoder.php
Expand Up @@ -4,7 +4,6 @@

namespace Intervention\Image\Drivers\Gd\Decoders;

use Intervention\Image\Config;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\DecoderInterface;
Expand Down Expand Up @@ -51,7 +50,7 @@ public function decode(mixed $input): ImageInterface|ColorInterface
$image->setExif($this->extractExifData($input));

// adjust image orientation
if ($this->driver()->config()->option(Config::AUTO_ORIENTATION) === true) {
if ($this->driver()->config()->autoOrientation === true) {

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 53 in src/Drivers/Gd/Decoders/FilePathImageDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.
$image->modify(new AlignRotationModifier());
}

Expand Down
3 changes: 1 addition & 2 deletions src/Drivers/Gd/Decoders/NativeObjectDecoder.php
Expand Up @@ -7,7 +7,6 @@
use GdImage;
use Intervention\Gif\Decoder as GifDecoder;
use Intervention\Gif\Splitter as GifSplitter;
use Intervention\Image\Config;
use Intervention\Image\Drivers\Gd\Core;
use Intervention\Image\Drivers\Gd\Frame;
use Intervention\Image\Exceptions\DecoderException;
Expand Down Expand Up @@ -61,7 +60,7 @@ public function decode(mixed $input): ImageInterface|ColorInterface
protected function decodeGif(mixed $input): ImageInterface
{
// create non-animated image depending on config
if (!$this->driver()->config()->option(Config::DECODE_ANIMATION) === true) {
if (!$this->driver()->config()->decodeAnimation === true) {

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 63 in src/Drivers/Gd/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.
$native = match (true) {
$this->isGifFormat($input) => @imagecreatefromstring($input),
default => @imagecreatefromgif($input),
Expand Down
9 changes: 8 additions & 1 deletion src/Drivers/Gd/Encoders/JpegEncoder.php
Expand Up @@ -14,7 +14,14 @@ class JpegEncoder extends GenericJpegEncoder implements SpecializedInterface
{
public function encode(ImageInterface $image): EncodedImage
{
$output = Cloner::cloneBlended($image->core()->native(), background: $image->blendingColor());
$blendingColor = $this->driver()->handleInput(
$this->driver()->config()->blendingColor

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.
);

$output = Cloner::cloneBlended(
$image->core()->native(),
background: $blendingColor
);

$data = $this->buffered(function () use ($output) {
imageinterlace($output, $this->progressive);
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php
Expand Up @@ -15,7 +15,7 @@ public function apply(ImageInterface $image): ImageInterface
{
// decode blending color
$color = $this->driver()->handleInput(
$this->color ? $this->color : $image->blendingColor()
$this->color ? $this->color : $this->driver()->config()->blendingColor

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 18 in src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.
);

foreach ($image as $frame) {
Expand Down
4 changes: 3 additions & 1 deletion src/Drivers/Gd/Modifiers/ContainModifier.php
Expand Up @@ -23,7 +23,9 @@ public function apply(ImageInterface $image): ImageInterface
$crop = $this->getCropSize($image);
$resize = $this->getResizeSize($image);
$background = $this->driver()->handleInput($this->background);
$blendingColor = $image->blendingColor();
$blendingColor = $this->driver()->handleInput(
$this->driver()->config()->blendingColor

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 27 in src/Drivers/Gd/Modifiers/ContainModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.
);

foreach ($image as $frame) {
$this->modify($frame, $crop, $resize, $background, $blendingColor);
Expand Down
6 changes: 5 additions & 1 deletion src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php
Expand Up @@ -31,9 +31,13 @@ public function apply(ImageInterface $image): ImageInterface
$this->driver()->handleInput($this->background)
);

$blendingColor = $this->driver()->handleInput(
$this->driver()->config()->blendingColor

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 35 in src/Drivers/Gd/Modifiers/QuantizeColorsModifier.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.
);

foreach ($image as $frame) {
// create new image for color quantization
$reduced = Cloner::cloneEmpty($frame->native(), background: $image->blendingColor());
$reduced = Cloner::cloneEmpty($frame->native(), background: $blendingColor);

// fill with background
imagefill($reduced, 0, 0, $background);
Expand Down
5 changes: 2 additions & 3 deletions src/Drivers/Imagick/Decoders/NativeObjectDecoder.php
Expand Up @@ -5,7 +5,6 @@
namespace Intervention\Image\Drivers\Imagick\Decoders;

use Imagick;
use Intervention\Image\Config;
use Intervention\Image\Drivers\Imagick\Core;
use Intervention\Image\Drivers\SpecializableDecoder;
use Intervention\Image\Exceptions\DecoderException;
Expand Down Expand Up @@ -41,12 +40,12 @@ public function decode(mixed $input): ImageInterface|ColorInterface
);

// discard animation depending on config
if (!$this->driver()->config()->option(Config::DECODE_ANIMATION) === true) {
if (!$this->driver()->config()->decodeAnimation === true) {

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.

Check failure on line 43 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$decodeAnimation.
$image->modify(new RemoveAnimationModifier());
}

// adjust image rotatation
if ($this->driver()->config()->option(Config::AUTO_ORIENTATION) === true) {
if ($this->driver()->config()->autoOrientation === true) {

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.

Check failure on line 48 in src/Drivers/Imagick/Decoders/NativeObjectDecoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$autoOrientation.
$image->modify(new AlignRotationModifier());
}

Expand Down
5 changes: 4 additions & 1 deletion src/Drivers/Imagick/Encoders/JpegEncoder.php
Expand Up @@ -16,11 +16,14 @@ public function encode(ImageInterface $image): EncodedImage
{
$format = 'jpeg';
$compression = Imagick::COMPRESSION_JPEG;
$blendingColor = $this->driver()->handleInput(
$this->driver()->config()->blendingColor

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 6.9.12-55

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.

Check failure on line 20 in src/Drivers/Imagick/Encoders/JpegEncoder.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 - prefer-stable - ImageMagick 7.1.0-40

Access to an undefined property Intervention\Image\Interfaces\ConfigInterface::$blendingColor.
);

// resolve blending color because jpeg has no transparency
$background = $this->driver()
->colorProcessor($image->colorspace())
->colorToNative($image->blendingColor());
->colorToNative($blendingColor);

// set alpha value to 1 because Imagick renders
// possible full transparent colors as black
Expand Down
Expand Up @@ -15,7 +15,7 @@ public function apply(ImageInterface $image): ImageInterface
{
// decode blending color
$color = $this->driver()->handleInput(
$this->color ? $this->color : $image->blendingColor()
$this->color ? $this->color : $this->driver()->config()->blendingColor
);

// get imagickpixel from color
Expand Down
7 changes: 3 additions & 4 deletions src/Image.php
Expand Up @@ -408,7 +408,7 @@ public function pickColors(int $x, int $y): CollectionInterface
public function blendingColor(): ColorInterface
{
return $this->driver()->handleInput(
$this->driver()->config()->option(Config::BLENDING_COLOR)
$this->driver()->config()->blendingColor
);
}

Expand All @@ -419,9 +419,8 @@ public function blendingColor(): ColorInterface
*/
public function setBlendingColor(mixed $color): ImageInterface
{
$this->driver()->config()->setOption(
Config::BLENDING_COLOR,
$this->driver()->handleInput($color)
$this->driver()->config()->setOptions(
blendingColor: $this->driver()->handleInput($color)
);

return $this;
Expand Down
8 changes: 0 additions & 8 deletions src/Interfaces/ConfigInterface.php
Expand Up @@ -8,14 +8,6 @@

interface ConfigInterface
{
/**
* Return value of given config option
*
* @param string $name
* @return mixed
*/
public function option(string $name, mixed $default = null): mixed;

/**
* Set value of given config option
*
Expand Down
45 changes: 21 additions & 24 deletions tests/Unit/ConfigTest.php
Expand Up @@ -16,9 +16,9 @@ public function testConstructor(): void
$config = new Config();
$this->assertInstanceOf(Config::class, $config);

$this->assertTrue($config->option('autoOrientation'));
$this->assertTrue($config->option('decodeAnimation'));
$this->assertEquals('ffffff00', $config->option('blendingColor'));
$this->assertTrue($config->autoOrientation);
$this->assertTrue($config->decodeAnimation);
$this->assertEquals('ffffff', $config->blendingColor);

$config = new Config(
autoOrientation: false,
Expand All @@ -27,43 +27,40 @@ public function testConstructor(): void
);
$this->assertInstanceOf(Config::class, $config);

$this->assertFalse($config->option('autoOrientation'));
$this->assertFalse($config->option('decodeAnimation'));
$this->assertEquals('f00', $config->option('blendingColor'));
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertEquals('f00', $config->blendingColor);
}

public function testGetSetOptions(): void
{
$config = new Config();
$this->assertTrue($config->option('autoOrientation'));
$this->assertTrue($config->option('decodeAnimation'));
$this->assertEquals('ffffff00', $config->option('blendingColor'));
$this->assertTrue($config->autoOrientation);
$this->assertTrue($config->decodeAnimation);
$this->assertEquals('ffffff', $config->blendingColor);

$result = $config->setOptions(
autoOrientation: false,
decodeAnimation: false,
blendingColor: 'f00',
);

$this->assertFalse($config->option('autoOrientation'));
$this->assertFalse($config->option('decodeAnimation'));
$this->assertEquals('f00', $config->option('blendingColor'));
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertEquals('f00', $config->blendingColor);

$this->assertFalse($result->option('autoOrientation'));
$this->assertFalse($result->option('decodeAnimation'));
$this->assertEquals('f00', $result->option('blendingColor'));
$this->assertFalse($result->autoOrientation);
$this->assertFalse($result->decodeAnimation);
$this->assertEquals('f00', $result->blendingColor);

$result = $config->setOption('blendingColor', '000');

$this->assertFalse($config->option('autoOrientation'));
$this->assertFalse($config->option('decodeAnimation'));
$this->assertEquals('000', $config->option('blendingColor'));
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertEquals('000', $config->blendingColor);

$this->assertFalse($result->option('autoOrientation'));
$this->assertFalse($result->option('decodeAnimation'));
$this->assertEquals('000', $result->option('blendingColor'));

$this->assertNull($config->option('unknown'));
$this->assertEquals('test', $config->option('unknown', 'test'));
$this->assertFalse($result->autoOrientation);
$this->assertFalse($result->decodeAnimation);
$this->assertEquals('000', $result->blendingColor);
}
}
14 changes: 6 additions & 8 deletions tests/Unit/Drivers/Gd/ImageTest.php
Expand Up @@ -7,7 +7,6 @@
use Intervention\Image\Analyzers\WidthAnalyzer;
use Intervention\Image\Collection;
use Intervention\Image\Colors\Hsl\Colorspace;
use Intervention\Image\Colors\Rgb\Color;
use Intervention\Image\Drivers\Gd\Core;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Drivers\Gd\Frame;
Expand Down Expand Up @@ -280,17 +279,16 @@ public function testText(): void
$this->assertInstanceOf(Image::class, $this->image->text('test', 0, 0, new Font()));
}

public function testSetGetBlendingColor(): void
public function testBlendTransparencyDefault(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertInstanceOf(ColorInterface::class, $image->blendingColor());
$this->assertColor(255, 255, 255, 0, $image->blendingColor());
$result = $image->setBlendingColor(new Color(1, 2, 3, 4));
$this->assertColor(1, 2, 3, 4, $result->blendingColor());
$this->assertColor(1, 2, 3, 4, $image->blendingColor());
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency();
$this->assertColor(255, 255, 255, 255, $image->pickColor(1, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(1, 0));
}

public function testBlendTransparency(): void
public function testBlendTransparencyArgument(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
Expand Down
14 changes: 6 additions & 8 deletions tests/Unit/Drivers/Imagick/ImageTest.php
Expand Up @@ -8,7 +8,6 @@
use Intervention\Image\Analyzers\WidthAnalyzer;
use Intervention\Image\Collection;
use Intervention\Image\Colors\Cmyk\Colorspace as CmykColorspace;
use Intervention\Image\Colors\Rgb\Color;
use Intervention\Image\Colors\Rgb\Colorspace as RgbColorspace;
use Intervention\Image\Drivers\Imagick\Core;
use Intervention\Image\Drivers\Imagick\Driver;
Expand Down Expand Up @@ -263,17 +262,16 @@ public function testSharpen(): void
$this->assertInstanceOf(Image::class, $this->image->sharpen(12));
}

public function testSetGetBlendingColor(): void
public function testBlendTransparencyDefault(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertInstanceOf(ColorInterface::class, $image->blendingColor());
$this->assertColor(255, 255, 255, 0, $image->blendingColor());
$result = $image->setBlendingColor(new Color(1, 2, 3, 4));
$this->assertColor(1, 2, 3, 4, $result->blendingColor());
$this->assertColor(1, 2, 3, 4, $image->blendingColor());
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency();
$this->assertColor(255, 255, 255, 255, $image->pickColor(1, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(1, 0));
}

public function testBlendTransparency(): void
public function testBlendTransparencyArgument(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
Expand Down

0 comments on commit 64632cd

Please sign in to comment.