xref: /PHP-8.0/ext/gd/tests/bug27582_1.phpt (revision 8d3f8ca1)
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$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
10@unlink($dest);
11$im = ImageCreateTrueColor(10, 10);
12imagealphablending($im, true);
13imagesavealpha($im, true);
14$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
15$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
16ImageFillToBorder($im, 5, 5, $bordercolor, $color);
17imagepng($im, $dest);
18
19$im2 = imagecreatefrompng($dest);
20$col = imagecolorat($im2, 5, 5);
21$color = imagecolorsforindex($im2, $col);
22echo $color['alpha'];
23@unlink($dest);
24?>
25--EXPECT--
261
27