Annotation of embedaddon/php/ext/gd/tests/colorresolve.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: imagecolorresolve
! 3: --SKIPIF--
! 4: <?php
! 5: if (!function_exists('imagecolorresolve')) die("skip gd extension not available\n");
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9:
! 10: $im = imagecreatetruecolor(5,5);
! 11: $c = imagecolorresolve($im, 255,0,255);
! 12: printf("%X\n", $c);
! 13: imagedestroy($im);
! 14:
! 15: $im = imagecreate(5,5);
! 16: $c = imagecolorresolve($im, 255,0,255);
! 17: print_r(imagecolorsforindex($im, $c));
! 18: imagedestroy($im);
! 19:
! 20: $im = imagecreate(5,5);
! 21: for ($i=0; $i<255; $i++) imagecolorresolve($im, $i,0,0);
! 22: $c = imagecolorresolve($im, 255,0,0);
! 23: print_r(imagecolorsforindex($im, $c));
! 24:
! 25:
! 26: $im = imagecreate(5,5);
! 27: for ($i=0; $i<256; $i++) {
! 28: if ($i == 246) {
! 29: imagecolorresolve($im, $i,10,10);
! 30: } else {
! 31: imagecolorresolve($im, $i,0,0);
! 32: }
! 33: }
! 34: $c = imagecolorresolve($im, 255,10,10);
! 35: print_r(imagecolorsforindex($im, $c));
! 36:
! 37:
! 38:
! 39: // with alpha
! 40: $im = imagecreatetruecolor(5,5);
! 41: $c = imagecolorresolvealpha($im, 255,0,255, 100);
! 42: printf("%X\n", $c);
! 43: imagedestroy($im);
! 44:
! 45: $im = imagecreate(5,5);
! 46: $c = imagecolorresolvealpha($im, 255,0,255,100);
! 47: print_r(imagecolorsforindex($im, $c));
! 48: imagedestroy($im);
! 49:
! 50: $im = imagecreate(5,5);
! 51: for ($i=0; $i<255; $i++) imagecolorresolvealpha($im, $i,0,0,1);
! 52: $c = imagecolorresolvealpha($im, 255,0,0,1);
! 53: print_r(imagecolorsforindex($im, $c));
! 54:
! 55:
! 56: $im = imagecreate(5,5);
! 57: for ($i=0; $i<256; $i++) {
! 58: if ($i == 246) {
! 59: imagecolorresolvealpha($im, $i,10,10,1);
! 60: } else {
! 61: imagecolorresolvealpha($im, $i,0,0,100);
! 62: }
! 63: }
! 64: $c = imagecolorresolvealpha($im, 255,10,10,0);
! 65: print_r(imagecolorsforindex($im, $c));
! 66:
! 67:
! 68: ?>
! 69: --EXPECTF--
! 70: FF00FF
! 71: Array
! 72: (
! 73: [red] => 255
! 74: [green] => 0
! 75: [blue] => 255
! 76: [alpha] => 0
! 77: )
! 78: Array
! 79: (
! 80: [red] => 255
! 81: [green] => 0
! 82: [blue] => 0
! 83: [alpha] => 0
! 84: )
! 85: Array
! 86: (
! 87: [red] => 246
! 88: [green] => 10
! 89: [blue] => 10
! 90: [alpha] => 0
! 91: )
! 92: 64FF00FF
! 93: Array
! 94: (
! 95: [red] => 255
! 96: [green] => 0
! 97: [blue] => 255
! 98: [alpha] => 100
! 99: )
! 100: Array
! 101: (
! 102: [red] => 255
! 103: [green] => 0
! 104: [blue] => 0
! 105: [alpha] => 1
! 106: )
! 107: Array
! 108: (
! 109: [red] => 246
! 110: [green] => 10
! 111: [blue] => 10
! 112: [alpha] => 1
! 113: )
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>