From 50feb11dced7d619e163757c95ddbb9e3b3a25dc Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 4 Aug 2024 08:44:12 +0200 Subject: [PATCH] Refactor code --- src/Drivers/Gd/Encoders/PngEncoder.php | 10 ++++++---- src/Drivers/Imagick/Encoders/PngEncoder.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Drivers/Gd/Encoders/PngEncoder.php b/src/Drivers/Gd/Encoders/PngEncoder.php index b4600a83..0c3f810b 100644 --- a/src/Drivers/Gd/Encoders/PngEncoder.php +++ b/src/Drivers/Gd/Encoders/PngEncoder.php @@ -5,7 +5,9 @@ namespace Intervention\Image\Drivers\Gd\Encoders; use GdImage; -use Intervention\Image\Colors\Rgb\Color; +use Intervention\Image\Colors\Rgb\Channels\Blue; +use Intervention\Image\Colors\Rgb\Channels\Green; +use Intervention\Image\Colors\Rgb\Channels\Red; use Intervention\Image\Drivers\Gd\Cloner; use Intervention\Image\EncodedImage; use Intervention\Image\Encoders\PngEncoder as GenericPngEncoder; @@ -61,9 +63,9 @@ private function prepareOutput(ImageInterface $image): GdImage // original image with transprency $blendingIndex = imagecolorallocatealpha( $output, - $blendingColor->red()->value(), - $blendingColor->green()->value(), - $blendingColor->blue()->value(), + $blendingColor->channel(Red::class)->value(), + $blendingColor->channel(Green::class)->value(), + $blendingColor->channel(Blue::class)->value(), 1, ); diff --git a/src/Drivers/Imagick/Encoders/PngEncoder.php b/src/Drivers/Imagick/Encoders/PngEncoder.php index c3889b18..8dd89dac 100644 --- a/src/Drivers/Imagick/Encoders/PngEncoder.php +++ b/src/Drivers/Imagick/Encoders/PngEncoder.php @@ -50,7 +50,7 @@ private function prepareOutput(ImageInterface $image): Imagick if ($this->indexed === false) { $output = clone $image->core()->native(); - // ensure to encode PNG image type 6 true color alpha + // ensure to encode PNG image type 6 (true color alpha) $output->setFormat('PNG32'); $output->setImageFormat('PNG32');