]> granicus.if.org Git - php/commitdiff
- #36697, Transparency is lost when using imagecreatetruecolor
authorPierre Joye <pajoye@php.net>
Mon, 13 Mar 2006 21:56:38 +0000 (21:56 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 13 Mar 2006 21:56:38 +0000 (21:56 +0000)
NEWS
ext/gd/libgd/gd_gif_out.c
ext/gd/tests/bug36697.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 4f68751a549fd2cb89bebf1e46f18a9a0dd25a30..9081fd70915cfaa8d4db172ece5a4a68b067ac3b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
 - Removed the E_STRICT deprecation notice from "var". (Ilia)
 - Fixed debug_zval_dump() to support private and protected members. (Dmitry)
 - Fixed bug #36629 (SoapServer::handle() exits on SOAP faults). (Dmitry)
+- Fixed bug #36697 (Transparency is lost when using imagecreatetruecolor).
+ (Pierre)
 
 09 Mar 2006, PHP 5.1.3RC1
 - Updated PCRE to version 6.6. (Andrei)
index 49da75f96f972a17b1cf7d0c73b19ef252e69856..651df90d4f80de593a409b44920b4c54d9a49d78 100644 (file)
@@ -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. */
diff --git a/ext/gd/tests/bug36697.phpt b/ext/gd/tests/bug36697.phpt
new file mode 100644 (file)
index 0000000..b257f63
--- /dev/null
@@ -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