From: Pierre Joye Date: Sun, 25 Dec 2005 21:45:04 +0000 (+0000) Subject: - add colorresolvealpha to colorresolve tests X-Git-Tag: RELEASE_1_0_4~231 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b6d77365750c5e9de6fc1173a52b0247d88aacc;p=php - add colorresolvealpha to colorresolve tests - update colormatch --- diff --git a/ext/gd/tests/colormatch.phpt b/ext/gd/tests/colormatch.phpt index d940914ea5..460b01a7e3 100644 --- a/ext/gd/tests/colormatch.phpt +++ b/ext/gd/tests/colormatch.phpt @@ -12,10 +12,8 @@ $im2 = imagecreate(5,5); imagecolormatch($im, $im2); -echo "ok\n"; - imagedestroy($im); ?> --EXPECTF-- -Fatal error: imagecolormatch(): Image2 must have at least one color in %s on line %d +Warning: imagecolormatch(): Image2 must have at least one color in %s on line %d diff --git a/ext/gd/tests/colorresolve.phpt b/ext/gd/tests/colorresolve.phpt index c8e6a345af..9af0f18600 100644 --- a/ext/gd/tests/colorresolve.phpt +++ b/ext/gd/tests/colorresolve.phpt @@ -35,6 +35,36 @@ $c = imagecolorresolve($im, 255,10,10); print_r(imagecolorsforindex($im, $c)); + +// with alpha +$im = imagecreatetruecolor(5,5); +$c = imagecolorresolvealpha($im, 255,0,255, 100); +printf("%X\n", $c); +imagedestroy($im); + +$im = imagecreate(5,5); +$c = imagecolorresolvealpha($im, 255,0,255,100); +print_r(imagecolorsforindex($im, $c)); +imagedestroy($im); + +$im = imagecreate(5,5); +for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1); +$c = imagecolorresolvealpha($im, 255,0,0,1); +print_r(imagecolorsforindex($im, $c)); + + +$im = imagecreate(5,5); +for ($i=0; $i<256; $i++) { + if ($i == 246) { + imagecolorresolvealpha($im, $i,10,10,1); + } else { + imagecolorresolvealpha($im, $i,0,0,100); + } +} +$c = imagecolorresolvealpha($im, 255,10,10,0); +print_r(imagecolorsforindex($im, $c)); + + ?> --EXPECTF-- FF00FF @@ -59,3 +89,25 @@ Array [blue] => 10 [alpha] => 0 ) +64FF00FF +Array +( + [red] => 255 + [green] => 0 + [blue] => 255 + [alpha] => 100 +) +Array +( + [red] => 255 + [green] => 0 + [blue] => 0 + [alpha] => 1 +) +Array +( + [red] => 246 + [green] => 10 + [blue] => 10 + [alpha] => 1 +)