$NetBSD: patch-aa,v 1.3 2011/11/29 16:26:57 darcy Exp $ To work with PNG files instead of GIF. --- gdmodule.c.orig 2005-12-19 15:53:23.000000000 +0000 +++ gdmodule.c @@ -28,14 +28,13 @@ version 0.22 #include static PyObject *ErrorObject; -extern int errno; /* DOCSTRING */ static char *gdModuleDocString = "GD module is an interface to the GD library written by Thomas Bouttel.\n\ \'It allows your code to quickly draw images complete with lines, arcs,\n\ text, multiple colors, cut and paste from other images, and flood fills,\n\ -and write out the result as a .GIF file. This is particularly useful in\n\ -World Wide Web applications, where .GIF is the format used for inline images.\'\n\ +and write out the result as a .PNG file. This is particularly useful in\n\ +World Wide Web applications, where .PNG is the format used for inline images.\'\n\ It has been extended in some ways from the original GD library."; /* @@ -84,7 +83,7 @@ static imageobject *newimageobject(); /* ** Methods for the image type */ -static PyObject *image_writegif(self, args) +static PyObject *image_writepng(self, args) imageobject *self; PyObject *args; { @@ -94,11 +93,11 @@ static PyObject *image_writegif(self, ar if (PyArg_ParseTuple(args, "O!", &PyFile_Type, &fileobj)) { - gdImageGif(self->imagedata, PyFile_AsFile(fileobj)); + gdImagePng(self->imagedata, PyFile_AsFile(fileobj)); } else if (PyErr_Clear(), PyArg_ParseTuple(args, "z", &filename)) { - if (fp = fopen(filename, "wb")) gdImageGif(self->imagedata, fp); + if (fp = fopen(filename, "wb")) gdImagePng(self->imagedata, fp); else { PyErr_SetFromErrno(PyExc_IOError); @@ -662,8 +661,8 @@ static PyObject *image_getorigin(self) } static struct PyMethodDef image_methods[] = { - {"writeGif", (PyCFunction)image_writegif, 1, "writeGif(f)\n\ - write the image to f as a GIF, where f is either an open file object or a\n\ + {"writePng", (PyCFunction)image_writepng, 1, "writePng(f)\n\ + write the image to f as a PNG, where f is either an open file object or a\n\ file name."}, {"writeGd", (PyCFunction)image_writegd, 1, "writeGd(f)\n\ write the image to f as a GD file, where f is either an open file object\n\ @@ -802,7 +801,7 @@ static imageobject *newimageobject(args) { if (!(ext = strrchr(filename,'.'))) { - PyErr_SetString(PyExc_IOError, "need an extension to determine file type (.gif|.gd|.xbm)"); + PyErr_SetString(PyExc_IOError, "need an extension to determine file type (.png|.gd|.xbm)"); Py_DECREF(self); return NULL; } @@ -814,7 +813,7 @@ static imageobject *newimageobject(args) Py_DECREF(self); return(NULL); } - if (!strcmp(ext,"gif") && (!(self->imagedata = gdImageCreateFromGif(fp)))) { + if (!strcmp(ext,"png") && (!(self->imagedata = gdImageCreateFromPng(fp)))) { fclose(fp); Py_DECREF(self); return(NULL); @@ -923,7 +922,7 @@ static PyObject *gd_fontSSize(self, args static struct PyMethodDef gd_methods[] = { {"image", gd_image, 1, "image(image[,(w,h)] | file | file,type | (w,h))\n\ -create GD image from file.(gif|gd|xbm), file,type (gif|gd|xbm),\n\ +create GD image from file.(png|gd|xbm), file,type (png|gd|xbm),\n\ the existing image, optionally resized to width w and height h\n\ or blank with width w and height h"}, {"fontstrsize", gd_fontSSize, 1, "fontstrsize(font, string)\n\