1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-02 18:32:56 +02:00

Rename Image::blendTransparency() to Image::background()

This commit is contained in:
Oliver Vogel
2025-06-20 17:09:19 +02:00
parent 2fb891da36
commit a20c9833da
16 changed files with 96 additions and 84 deletions

View File

@@ -18,12 +18,12 @@ final class ConfigTest extends BaseTestCase
$this->assertTrue($config->autoOrientation);
$this->assertTrue($config->decodeAnimation);
$this->assertEquals('ffffff', $config->blendingColor);
$this->assertEquals('ffffff', $config->backgroundColor);
$config = new Config(
autoOrientation: false,
decodeAnimation: false,
blendingColor: 'f00',
backgroundColor: 'f00',
strip: true,
);
$this->assertInstanceOf(Config::class, $config);
@@ -31,7 +31,7 @@ final class ConfigTest extends BaseTestCase
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertTrue($config->strip);
$this->assertEquals('f00', $config->blendingColor);
$this->assertEquals('f00', $config->backgroundColor);
}
public function testGetSetOptions(): void
@@ -40,35 +40,35 @@ final class ConfigTest extends BaseTestCase
$this->assertTrue($config->autoOrientation);
$this->assertTrue($config->decodeAnimation);
$this->assertFalse($config->strip);
$this->assertEquals('ffffff', $config->blendingColor);
$this->assertEquals('ffffff', $config->backgroundColor);
$result = $config->setOptions(
autoOrientation: false,
decodeAnimation: false,
blendingColor: 'f00',
backgroundColor: 'f00',
strip: true,
);
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertEquals('f00', $config->blendingColor);
$this->assertEquals('f00', $config->backgroundColor);
$this->assertFalse($result->autoOrientation);
$this->assertFalse($result->decodeAnimation);
$this->assertTrue($result->strip);
$this->assertEquals('f00', $result->blendingColor);
$this->assertEquals('f00', $result->backgroundColor);
$result = $config->setOptions(blendingColor: '000');
$result = $config->setOptions(backgroundColor: '000');
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertTrue($config->strip);
$this->assertEquals('000', $config->blendingColor);
$this->assertEquals('000', $config->backgroundColor);
$this->assertFalse($result->autoOrientation);
$this->assertFalse($result->decodeAnimation);
$this->assertTrue($result->strip);
$this->assertEquals('000', $result->blendingColor);
$this->assertEquals('000', $result->backgroundColor);
}
public function testSetOptionsWithArray(): void
@@ -77,17 +77,17 @@ final class ConfigTest extends BaseTestCase
$result = $config->setOptions([
'autoOrientation' => false,
'decodeAnimation' => false,
'blendingColor' => 'f00',
'backgroundColor' => 'f00',
'strip' => true,
]);
$this->assertFalse($config->autoOrientation);
$this->assertFalse($config->decodeAnimation);
$this->assertTrue($config->strip);
$this->assertEquals('f00', $config->blendingColor);
$this->assertEquals('f00', $config->backgroundColor);
$this->assertFalse($result->autoOrientation);
$this->assertFalse($result->decodeAnimation);
$this->assertTrue($result->strip);
$this->assertEquals('f00', $result->blendingColor);
$this->assertEquals('f00', $result->backgroundColor);
}
}

View File

@@ -283,29 +283,29 @@ final class ImageTest extends GdTestCase
$this->assertInstanceOf(Image::class, $this->image->text('test', 0, 0, new Font()));
}
public function testBlendTransparencyDefault(): void
public function testBackgroundDefault(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 255, 255, 255, $image->pickColor(1, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(1, 0));
}
public function testBlendTransparencyArgument(): void
public function testBackgroundArgument(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff5500');
$result = $image->background('ff5500');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}
public function testBlendTransparencyIgnoreTransparencyInBlendingColor(): void
public function testBackgroundIgnoreTransparencyInBackgroundColor(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff550055');
$result = $image->background('ff550055');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}

View File

@@ -277,29 +277,29 @@ final class ImageTest extends ImagickTestCase
$this->assertInstanceOf(Image::class, $this->image->sharpen(12));
}
public function testBlendTransparencyDefault(): void
public function testBackgroundDefault(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 255, 255, 255, $image->pickColor(1, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(1, 0));
}
public function testBlendTransparencyArgument(): void
public function testBackgroundArgument(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff5500');
$result = $image->background('ff5500');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}
public function testBlendTransparencyIgnoreTransparencyInBlendingColor(): void
public function testBackgroundIgnoreTransparencyInBackgroundColor(): void
{
$image = $this->readTestImage('gradient.gif');
$this->assertColor(0, 0, 0, 0, $image->pickColor(1, 0));
$result = $image->blendTransparency('ff550055');
$result = $image->background('ff550055');
$this->assertColor(255, 85, 0, 255, $image->pickColor(1, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(1, 0));
}

View File

@@ -137,20 +137,20 @@ final class ImageManagerTestGd extends BaseTestCase
$this->assertFalse($image->isAnimated());
}
public function testApplyBlendingColorDefault(): void
public function testApplyBackgroundColorDefault(): void
{
$manager = new ImageManager(Driver::class);
$image = $manager->read($this->getTestResourcePath('blocks.png'));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 255, 255, 255, $image->pickColor(530, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(530, 0));
}
public function testApplyBlendingColorConfigured(): void
public function testApplyBackgroundColorConfigured(): void
{
$manager = new ImageManager(Driver::class, blendingColor: 'ff5500');
$manager = new ImageManager(Driver::class, backgroundColor: 'ff5500');
$image = $manager->read($this->getTestResourcePath('blocks.png'));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 85, 0, 255, $image->pickColor(530, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(530, 0));
}

View File

@@ -137,20 +137,20 @@ final class ImageManagerTestImagick extends BaseTestCase
$this->assertFalse($image->isAnimated());
}
public function testApplyBlendingColor(): void
public function testApplyBackgroundColor(): void
{
$manager = new ImageManager(Driver::class);
$image = $manager->read($this->getTestResourcePath('blocks.png'));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 255, 255, 255, $image->pickColor(530, 0));
$this->assertColor(255, 255, 255, 255, $result->pickColor(530, 0));
}
public function testApplyBlendingColorConfigured(): void
public function testApplyBackgroundColorConfigured(): void
{
$manager = new ImageManager(Driver::class, blendingColor: 'ff5500');
$manager = new ImageManager(Driver::class, backgroundColor: 'ff5500');
$image = $manager->read($this->getTestResourcePath('blocks.png'));
$result = $image->blendTransparency();
$result = $image->background();
$this->assertColor(255, 85, 0, 255, $image->pickColor(530, 0));
$this->assertColor(255, 85, 0, 255, $result->pickColor(530, 0));
}