xref: /PHP-8.1/ext/gd/tests/bug27582_1.phpt (revision a375d547)
1--TEST--
2Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
8@unlink($dest);
9$im = ImageCreateTrueColor(10, 10);
10imagealphablending($im, true);
11imagesavealpha($im, true);
12$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
13$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
14ImageFillToBorder($im, 5, 5, $bordercolor, $color);
15imagepng($im, $dest);
16
17$im2 = imagecreatefrompng($dest);
18$col = imagecolorat($im2, 5, 5);
19$color = imagecolorsforindex($im2, $col);
20echo $color['alpha'];
21@unlink($dest);
22?>
23--EXPECT--
241
25