bug61221.phpt 624 B

123456789101112131415161718192021
  1. --TEST--
  2. Bug #61221 - imagegammacorrect function loses alpha channel
  3. --EXTENSIONS--
  4. gd
  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);
  12. imagefill($img, 0, 0, $blacktransparent);
  13. imageline($img, $imagew / 2, 0, $imagew / 2, $imageh - 1, $redsolid);
  14. imageline($img, 0, $imageh / 2, $imagew - 1, $imageh / 2, $redsolid);
  15. imagegammacorrect($img, 1, 1);
  16. $color = imagecolorat($img, 0, 0);
  17. var_dump($color === $blacktransparent);
  18. imagedestroy($img);
  19. ?>
  20. --EXPECT--
  21. bool(true)