xref: /php-src/ext/gd/tests/bug27582_1.phpt (revision 0b8466f2)
1--TEST--
2Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7if (!(imagetypes() & IMG_PNG)) {
8    die("skip No PNG support");
9}
10?>
11--FILE--
12<?php
13$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
14@unlink($dest);
15$im = ImageCreateTrueColor(10, 10);
16imagealphablending($im, true);
17imagesavealpha($im, true);
18$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
19$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
20ImageFillToBorder($im, 5, 5, $bordercolor, $color);
21imagepng($im, $dest);
22
23$im2 = imagecreatefrompng($dest);
24$col = imagecolorat($im2, 5, 5);
25$color = imagecolorsforindex($im2, $col);
26echo $color['alpha'];
27@unlink($dest);
28?>
29--EXPECT--
301
31