xref: /PHP-7.3/ext/gd/tests/bug61221.phpt (revision 7469c7e7)
1--TEST--
2Bug #61221 - imagegammacorrect function loses alpha channel
3--SKIPIF--
4<?php
5if (!extension_loaded('gd')) die('skip gd extension not available');
6?>
7--FILE--
8<?php
9$imagew = 50;
10$imageh = 50;
11$img = imagecreatetruecolor($imagew, $imageh);
12$blacktransparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
13$redsolid = imagecolorallocate($img, 255, 0, 0);
14imagefill($img, 0, 0, $blacktransparent);
15imageline($img, $imagew / 2, 0, $imagew / 2, $imageh - 1, $redsolid);
16imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
17imagegammacorrect($img, 1, 1);
18$color = imagecolorat($img, 0, 0);
19var_dump($color === $blacktransparent);
20imagedestroy($img);
21?>
22--EXPECT--
23bool(true)
24