- MFB: #36697, truecolor image lost im->transparent

This commit is contained in:
Pierre Joye 2006-03-14 03:46:59 +00:00
parent 9eebea0a45
commit ff2822a82b
2 changed files with 32 additions and 1 deletions

View file

@ -133,7 +133,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
BitsPerPixel = colorstobpp(tim->colorsTotal); BitsPerPixel = colorstobpp(tim->colorsTotal);
/* All set, let's do it. */ /* All set, let's do it. */
GIFEncode( GIFEncode(
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel, out, tim->sx, tim->sy, tim->interlace, 0, tim->transparent, BitsPerPixel,
tim->red, tim->green, tim->blue, tim); tim->red, tim->green, tim->blue, tim);
if (pim) { if (pim) {
/* Destroy palette based temporary image. */ /* Destroy palette based temporary image. */

View file

@ -0,0 +1,31 @@
--TEST--
Bug #36697 (TrueColor transparency with GIF palette output).
--SKIPIF--
<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?>
--FILE--
<?php
$dest = dirname(__FILE__) . "/36697.gif";
$im = imagecreatetruecolor(192, 36);
$trans_color = imagecolorallocate($im, 255, 0, 0);
$color = imagecolorallocate($im, 255, 255, 255);
imagecolortransparent($im, $trans_color);
imagefilledrectangle($im, 0,0, 192,36, $trans_color);
$c = imagecolorat($im, 191,35);
imagegif($im, $dest);
imagedestroy($im);
$im = imagecreatefromgif($dest);
$c = imagecolorat($im, 191, 35);
$colors = imagecolorsforindex($im, $c);
echo $colors['red'] . ' ' . $colors['green'] . ' ' . $colors['blue'];
@unlink($dest);
?>
--EXPECT--
255 0 0