summaryrefslogtreecommitdiff
path: root/ext/gd/tests/bug27582_1.phpt
blob: b85f7457e01b89c151cbd7aa0cd728934f069b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
--SKIPIF--
<?php
        if (!extension_loaded('gd')) die("skip gd extension not available\n");
        if (!GD_BUNDLED) die('skip external GD libraries always fail');
?>
--FILE--
<?php
/* $id$ */
$dest = dirname(realpath(__FILE__)) . '/bug27582.png';
@unlink($dest);
$im = ImageCreateTrueColor(10, 10);
imagealphablending($im, true);
imagesavealpha($im, true);
$bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
$color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
ImageFillToBorder($im, 5, 5, $bordercolor, $color);
imagepng($im, $dest);

$im2 = imagecreatefrompng($dest);
$col = imagecolorat($im2, 5, 5);
$color = imagecolorsforindex($im2, $col);
echo $color['alpha'];
@unlink($dest);
?>
--EXPECT--
1