Commits

Anonymous committed c39c4ea

- sync to 2.0.29

  • Participants
  • Parent commits 46da631

Comments (0)

Files changed (2)

   int i, j, k, number;
   char buf[5];
   gdImagePtr im = 0;
-  char *apixel;
   int *pointer;
   int red = 0, green = 0, blue = 0;
   int *colors;
 	fprintf (stderr, "ARRRGH\n");
     }
 
-  apixel = (char *) gdMalloc (image.cpp + 1);
-  if (apixel == NULL)
-    return (0);
-  apixel[image.cpp] = '\0';
-
   pointer = (int *) image.data;
   for (i = 0; i < image.height; i++)
     {
 	  gdImageSetPixel (im, j, i, colors[k]);
 	}
     }
-  gdFree (apixel);
   gdFree (colors);
   return (im);
 }

src/gifanimtest.c

+#include <gd.h>
+
+#include "config.h"
+
+int main (int argc, char *argv[])
+{
+	gdImagePtr im;
+	gdImagePtr last, cim;
+	int black;
+	int blue;
+	FILE *out;
+	int i;
+	im = gdImageCreate(100, 100);
+	black = gdImageColorAllocate(im, 0, 0, 0);
+	blue = gdImageColorAllocate(im, 0, 0, 255);
+	out = fopen("gifanim.gif", "wb");
+	gdImageGifAnimBegin(im, out, 1, 10);
+	last = 0;
+	for (i = 0; (i <= 100); i += 2) {
+		cim = gdImageCreate(100, 100);
+		gdImagePaletteCopy(cim, im);
+		gdImageArc(cim, 50, 50, i, i, 0, 360, blue);
+		gdImageGifAnimAdd(cim, out, 0, 0, 0, 10, gdDisposalNone, last);
+		if (last) {
+			gdImageDestroy(last);
+		}
+		last = cim;
+	}	
+	gdImageDestroy(last);
+	gdImageGifAnimEnd(out);
+	fclose(out);
+	gdImageDestroy(im);
+	return 0;
+}
+