xref: /PHP-7.2/ext/gd/tests/bug27582_1.phpt (revision 70650810)
1--TEST--
2Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
3--SKIPIF--
4<?php
5        if (!extension_loaded('gd')) die("skip gd extension not available\n");
6?>
7--FILE--
8<?php
9/* $id$ */
10$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
11@unlink($dest);
12$im = ImageCreateTrueColor(10, 10);
13imagealphablending($im, true);
14imagesavealpha($im, true);
15$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
16$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
17ImageFillToBorder($im, 5, 5, $bordercolor, $color);
18imagepng($im, $dest);
19
20$im2 = imagecreatefrompng($dest);
21$col = imagecolorat($im2, 5, 5);
22$color = imagecolorsforindex($im2, $col);
23echo $color['alpha'];
24@unlink($dest);
25?>
26--EXPECT--
271
28