rasmus          Sun Oct  6 02:47:55 2002 EDT

  Modified files:              
    /php4/ext/gd/libgd  gd.c 
  Log:
  Fix for bug #19700 - code by Wez
  
  
Index: php4/ext/gd/libgd/gd.c
diff -u php4/ext/gd/libgd/gd.c:1.17 php4/ext/gd/libgd/gd.c:1.18
--- php4/ext/gd/libgd/gd.c:1.17 Mon Sep 30 03:23:34 2002
+++ php4/ext/gd/libgd/gd.c      Sun Oct  6 02:47:53 2002
@@ -1735,6 +1735,36 @@
        }
       return;
     }
+
+         /* Destination is palette based */
+
+    if (src->trueColor) {  /* But source is truecolor (Ouch!) */
+        for (y = srcY; (y < (srcY + h)); y++)
+        {
+            tox = dstX;
+            for (x = srcX; (x < (srcX + w)); x++)
+            {
+                int nc;
+                c = gdImageGetPixel (src, x, y);
+
+                /* Get best match possible. */
+                nc = gdImageColorResolveAlpha (
+                         dst,
+                         gdTrueColorGetRed(c),
+                         gdTrueColorGetGreen(c),
+                         gdTrueColorGetBlue(c),
+                         gdTrueColorGetAlpha(c));
+
+                gdImageSetPixel (dst, tox, toy, nc);
+                tox++;
+            }
+            toy++;
+        }
+        return;
+    }
+
+       /* Palette based to palette based */
+
   for (i = 0; (i < gdMaxColors); i++)
     {
       colorMap[i] = (-1);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to