mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00
- MFB: #36697, truecolor image lost im->transparent
This commit is contained in:
parent
9eebea0a45
commit
ff2822a82b
2 changed files with 32 additions and 1 deletions
|
@ -133,7 +133,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
|
|||
BitsPerPixel = colorstobpp(tim->colorsTotal);
|
||||
/* All set, let's do it. */
|
||||
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);
|
||||
if (pim) {
|
||||
/* Destroy palette based temporary image. */
|
||||
|
|
31
ext/gd/tests/bug36697.phpt
Normal file
31
ext/gd/tests/bug36697.phpt
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue