xref: /PHP-7.0/ext/gd/tests/bug38179.phpt (revision 9208d250)
1--TEST--
2Bug #38179 (imagecopy from a palette to a truecolor image loses alpha channel)
3--SKIPIF--
4<?php
5        if (!function_exists('imagecopy')) die("skip gd extension not available\n");
6?>
7--FILE--
8<?php
9$src = imagecreate(5,5);
10$c0 = imagecolorallocate($src, 255,255,255);
11$c1 = imagecolorallocatealpha($src, 255,0,0,70);
12
13imagealphablending($src, 0);
14imagefill($src, 0,0, $c1);
15
16$dst_tc = imagecreatetruecolor(5,5);
17imagealphablending($dst_tc, 0);
18
19imagecopy($dst_tc, $src, 0,0, 0,0, imagesx($src), imagesy($src));
20
21$p1 = imagecolorat($dst_tc, 3,3);
22printf("%X\n", $p1);
23
24imagedestroy($src); imagedestroy($dst_tc);
25?>
26--EXPECTF--
2746FF0000
28
29