File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
gd /
tests /
colorresolve.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
imagecolorresolve
--SKIPIF--
<?php
if (!function_exists('imagecolorresolve')) die("skip gd extension not available\n");
?>
--FILE--
<?php
$im = imagecreatetruecolor(5,5);
$c = imagecolorresolve($im, 255,0,255);
printf("%X\n", $c);
imagedestroy($im);
$im = imagecreate(5,5);
$c = imagecolorresolve($im, 255,0,255);
print_r(imagecolorsforindex($im, $c));
imagedestroy($im);
$im = imagecreate(5,5);
for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0);
$c = imagecolorresolve($im, 255,0,0);
print_r(imagecolorsforindex($im, $c));
$im = imagecreate(5,5);
for ($i=0; $i<256; $i++) {
if ($i == 246) {
imagecolorresolve($im, $i,10,10);
} else {
imagecolorresolve($im, $i,0,0);
}
}
$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
Array
(
[red] => 255
[green] => 0
[blue] => 255
[alpha] => 0
)
Array
(
[red] => 255
[green] => 0
[blue] => 0
[alpha] => 0
)
Array
(
[red] => 246
[green] => 10
[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
)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>