cvs: php-src /ext/gd/tests colormatch.phpt colorresolve.phpt
| From: | Pierre-Alain Joye | Date: | Sun, 25 Dec 2005 21:45:05 +0000 |
| Subject: | cvs: php-src /ext/gd/tests colormatch.phpt colorresolve.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36228@lists.php.net to get a copy of this message | ||
pajoye Sun Dec 25 21:45:05 2005 EDT
Modified files:
/php-src/ext/gd/tests colormatch.phpt colorresolve.phpt
Log:
- add colorresolvealpha to colorresolve tests
- update colormatch
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/colormatch.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/gd/tests/colormatch.phpt
diff -u php-src/ext/gd/tests/colormatch.phpt:1.1 php-src/ext/gd/tests/colormatch.phpt:1.2
--- php-src/ext/gd/tests/colormatch.phpt:1.1 Sun Dec 25 19:21:58 2005
+++ php-src/ext/gd/tests/colormatch.phpt Sun Dec 25 21:45:04 2005
@@ -12,10 +12,8 @@
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
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/colorresolve.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/gd/tests/colorresolve.phpt
diff -u php-src/ext/gd/tests/colorresolve.phpt:1.3 php-src/ext/gd/tests/colorresolve.phpt:1.4
--- php-src/ext/gd/tests/colorresolve.phpt:1.3 Sat Dec 24 14:05:20 2005
+++ php-src/ext/gd/tests/colorresolve.phpt Sun Dec 25 21:45:04 2005
@@ -35,6 +35,36 @@
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 @@
[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
+)