1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-22 05:22:50 +02:00

Change arguments of ImageInterface::background()

This commit is contained in:
Oliver Vogel
2025-06-24 17:15:39 +02:00
parent 2e711bc92f
commit 7153316485
4 changed files with 8 additions and 7 deletions

View File

@@ -11,7 +11,7 @@
## API Changes
- ImageInterface::blendTransparency() was renamed to ImageInterface::background()
- ImageInterface::blendTransparency() was renamed to ImageInterface::background() - Signature changed
- ImageInterface::setBlendingColor() was renamed to ImageInterface::setBackgroundColor()
- ImageInterface::blendingColor() was renamed to ImageInterface::backgroundColor()
- Changed default value for `background` to `null` in ImageInterface::rotate()

View File

@@ -417,7 +417,7 @@ final class Image implements ImageInterface
*
* @see ImageInterface::setBackgroundColor()
*/
public function setBackgroundColor(mixed $color): ImageInterface
public function setBackgroundColor(string|ColorInterface $color): ImageInterface
{
$this->driver()->config()->setOptions(
backgroundColor: $this->driver()->handleInput($color)
@@ -431,7 +431,7 @@ final class Image implements ImageInterface
*
* @see ImageInterface::background()
*/
public function background(mixed $color = null): ImageInterface
public function background(null|string|ColorInterface $color = null): ImageInterface
{
return $this->modify(new BackgroundModifier($color));
}

View File

@@ -235,14 +235,15 @@ interface ImageInterface extends IteratorAggregate, Countable
*
* @throws RuntimeException
*/
public function setBackgroundColor(mixed $color): self;
public function setBackgroundColor(string|ColorInterface $color): self;
/**
* Replace transparent areas of the image with given color
* Replace transparent areas of the image with given color or currently
* configured background color
*
* @throws RuntimeException
*/
public function background(mixed $color = null): self;
public function background(null|string|ColorInterface $color = null): self;
/**
* Retrieve ICC color profile of image

View File

@@ -21,7 +21,7 @@ class BackgroundModifier extends SpecializableModifier
*
* @return void
*/
public function __construct(public mixed $color = null)
public function __construct(public null|string|ColorInterface $color = null)
{
//
}