bug27582_1.phpt 634 B

123456789101112131415161718192021222324
  1. --TEST--
  2. Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill color)
  3. --EXTENSIONS--
  4. gd
  5. --FILE--
  6. <?php
  7. $dest = dirname(realpath(__FILE__)) . '/bug27582.png';
  8. @unlink($dest);
  9. $im = ImageCreateTrueColor(10, 10);
  10. imagealphablending($im, true);
  11. imagesavealpha($im, true);
  12. $bordercolor=ImageColorAllocateAlpha($im, 0, 0, 0, 2);
  13. $color = ImageColorAllocateAlpha($im, 0, 0, 0, 1);
  14. ImageFillToBorder($im, 5, 5, $bordercolor, $color);
  15. imagepng($im, $dest);
  16. $im2 = imagecreatefrompng($dest);
  17. $col = imagecolorat($im2, 5, 5);
  18. $color = imagecolorsforindex($im2, $col);
  19. echo $color['alpha'];
  20. @unlink($dest);
  21. ?>
  22. --EXPECT--
  23. 1