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