1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-21 21:15:11 +02:00
This commit is contained in:
Oliver Vogel
2014-04-16 20:03:22 +02:00
parent ec28ee2f72
commit d10858bb66
2 changed files with 12 additions and 0 deletions

View File

@@ -1868,6 +1868,9 @@ class Image
private function cloneResource($resource)
{
$clone = imagecreatetruecolor($this->width, $this->height);
imagealphablending($clone, false);
imagesavealpha($clone, true);
imagecopy($clone, $resource, 0, 0, 0, 0, $this->width, $this->height);
return $clone;

View File

@@ -1489,6 +1489,15 @@ class ImageTest extends PHPUnit_Framework_Testcase
$this->assertEquals('#00ff00', $img->pickColor(0, 0, 'hex'));
}
public function testBackupKeepTransparency($value='')
{
$img = new Image('public/circle.png');
$img->backup();
$img->reset();
$transparent = array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0.0);
$this->assertEquals($transparent, $img->pickColor(0, 0, 'array'));
}
public function testLimitColors()
{
// reduce colors