pax_global_header00006660000000000000000000000064121610502650014510gustar00rootroot0000000000000052 comment=b8939e7864501dcf1bb9262d9559d298886b5950 gdmodule-0.58/000077500000000000000000000000001216105026500132445ustar00rootroot00000000000000gdmodule-0.58/.gitignore000066400000000000000000000000251216105026500152310ustar00rootroot00000000000000*.o build dist *.pyc gdmodule-0.58/INSTALL000066400000000000000000000014651216105026500143030ustar00rootroot00000000000000gd module install notes I'm going to assume that you've got the GD library (version 2.0.8 or higher) installed, which is pretty trivial to do. If you're having troubles with that, I suggest you have a look at that package's instructions. This version of gdmodule is written assuming you have PNG, JPEG, FreeType, and Xpm libraries incorporated into your copy of GD. If you have an incomplete version you will have difficulty getting this one to build. Starting with gdmodule 0.30 the installation is done via the standard Distutils. Do this (as root if necessary): python Setup.py install This should build the _gd.so extension and install it along with the gd.py module in the standard location on your system. As of right now, I don't have a build for Windows. If I get time I might put one together. gdmodule-0.58/LICENSE000066400000000000000000000030311216105026500142460ustar00rootroot00000000000000gdmodule - Python GD module Copyright (c) 1995 Richard Jones All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. Redistributions in * binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. Neither the name of the Bureau * of Meteorology Australia nor the names of its contributors may be used to * endorse or promote products derived from this software without specific * prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. gdmodule-0.58/MANIFEST000066400000000000000000000001311216105026500143700ustar00rootroot00000000000000README Setup.py _gdmodule.c adventure.ttf gd-ref.html gd.py gddemo.py install_notes.html gdmodule-0.58/MANIFEST.in000066400000000000000000000000671216105026500150050ustar00rootroot00000000000000include *.html include gddemo.py include adventure.ttf gdmodule-0.58/PKG-INFO000066400000000000000000000004211216105026500143360ustar00rootroot00000000000000Metadata-Version: 1.0 Name: gdmodule Version: 0.54 Summary: GD Package Home-page: http://newcenturycomputers.net/projects/gdmodule.html Author: Chris Gonnerman Author-email: chris.gonnerman@newcenturycomputers.net License: UNKNOWN Description: GD Package Platform: UNKNOWN gdmodule-0.58/README000066400000000000000000000023101216105026500141200ustar00rootroot00000000000000Python GD Module README -------------------------------------------------------------------------- This module is Copyright 1995 Richard Jones Bureau of Meteorology Australia. richard@bofh.asn.au With Richard's blessing, I have taken over support for this module; so, send all bug reports, etc. to chris.gonnerman@newcenturycomputers.net -------------------------------------------------------------------------- GD module is an interface to the GD library written by Thomas Boutell. gd is a graphics library. It allows your code to quickly draw images complete with lines, arcs, text, multiple colors, cut and paste from other images, and flood fills, and write out the result as a PNG or JPEG file. This is particularly useful in World Wide Web applications, where PNG and JPEG are two of the formats accepted for inline images by most browsers. The GD library must be version 2.0.23 or higher (or you must choose an earlier version of this module). The official home page of GD is currently: http://www.boutell.com/gd/ gdmodule has been extended in some ways from the original GD library. -------------------------------------------------------------------------- gdmodule-0.58/Setup.py000066400000000000000000000056221216105026500147230ustar00rootroot00000000000000# Setup for gdmodule 0.50 and later from distutils.core import setup, Extension import os, glob, sys, string, commands # version of this gdmodule package this_version = "0.58" # directory existence tester def dirtest(lst): rlst = [] for d in lst: try: if os.listdir(d): rlst.append(d) except: pass return rlst def filetest(path, names): rlst = [] for d in path: for i in range(len(names)): found = glob.glob(os.path.join(d, "lib%s.*" % names[i])) if found: rlst.append(names[i]) names[i] = None names = filter(None, names) return rlst def remove(itm, lst): r = range(len(lst)) r.reverse() for i in r: if lst[i] == itm: del lst[i] # library_dirs option is rather non-portable, but since I am targetting # Unixoid OS's I will just look for the usual suspects. libdirs = dirtest([ "/usr/local/lib", "/sw/lib", "/usr/lib", "/usr/lib/i386-linux-gnu", "/usr/lib/x86_64-linux-gnu", "/usr/lib/X11", "/usr/X11R6/lib", "/opt/gnome/lib", ]) try: exotic_libdir = commands.getoutput("gdlib-config --libdir"), libdirs += exotic_libdir except: pass # include_dirs are also non-portable; same trick here. incdirs = dirtest([ "/usr/local/include", "/sw/include", "/usr/include", "/usr/include/X11", "/usr/X11R6/include", "/opt/gnome/include", ]) try: exotic_incdir = commands.getoutput("gdlib-config --includedir"), incdirs += exotic_incdir except: pass # Try to identify our libraries want_libs = [ "gd", "jpeg", "png", "gif", "X11", "Xpm", "z", "ttf", "freetype", ] libs = filetest(libdirs, want_libs) missing = [] for l in want_libs: if l and l not in libs: missing.append(l) if "ttf" in missing and "freetype" not in missing: remove("ttf", missing) if missing: print "WARNING: Missing", string.join(missing, ", "), "Libraries" # hand-clean the libs if "gd" not in libs: print "Can't find GD library." sys.exit(0) if "ttf" in libs and "freetype" in libs: remove("ttf", libs) if "Xpm" in libs and "X11" not in libs: remove("Xpm", libs) if "png" in libs and "z" not in libs: remove("png", libs) if "z" in libs and "png" not in libs: remove("png", libs) # build the macro list macros = [] for l in libs: macros.append(( "HAVE_LIB%s" % l.upper(), None )) # OK, now do it! setup(name="gdmodule", version=this_version, description="GD Package", long_description="GD Package", author="Chris Gonnerman", author_email="chris.gonnerman@newcenturycomputers.net", url="http://newcenturycomputers.net/projects/gdmodule.html", py_modules=["gd"], ext_modules=[ Extension("_gd", ["_gdmodule.c"], include_dirs=incdirs, library_dirs=libdirs, libraries=libs, define_macros=macros)], ) # end of file. gdmodule-0.58/_gdmodule.c000066400000000000000000001764031216105026500153620ustar00rootroot00000000000000/****************************************************************** Copyright 1995 Richard Jones, Bureau of Meteorology Australia. richard@bofh.asn.au Current maintainer is Chris Gonnerman Please direct all questions and problems to me. This module is a python wrapper for the GD library (version 1.8.3) version 0.56 Revised 03/10/2005 by Chris Gonnerman -- added support for GIF files. -- the minimum gd library version for this gdmodule version is 2.0.23. version 0.55 Revised 03/10/2005 by Chris Gonnerman -- corrected error in the gd.image() constructor, pointed out by Betty Li. maybe this time I got it right. -- the minimum gd library version for this gdmodule version is 2.0.22. version 0.54 Revised 03/03/2005 by Chris Gonnerman -- corrected error in the gd.image() constructor, pointed out by Betty Li. -- corrected yet another obvious error reported by Greg Hewgill, regarding an incorrect call to gdImagePolygon when fillcolor is not equal to 1. -- implemented the saveAlpha and alphaBlending features as suggested by Christopher Stone. -- fixed memory management issue regarding image deallocation reported by Matti Jagula. -- fixed memory management issue in image_filledpolygon reported by Sadruddin Rejeb. -- the minimum gd library version for this gdmodule version is 2.0.22. version 0.53 Revised 06/10/2004 by Chris Gonnerman -- corrected obvious error in image_settile(), as pointed out by Dan Mosedale -- applied some patches provided by John Hunter. Several are for Windows compatibility, but this should be considered a "work in progress" in this version. -- corrected another obvious error (and an ancient one too) reported by Greg Hewgill, regarding the foreground color being used rather than the fill color in the image_polygon function. -- the minimum gd library version for this gdmodule version is 2.0.22. version 0.52 Revised 02/03/2004 by Chris Gonnerman -- incorporated new functions from the matplotlib project (provided by John Hunter) -- corrected error in PyObject_HEAD_INIT() call noted by Stefan R Kuzminski (thanks!) version 0.51 Revised 09/24/2003 by Chris Gonnerman -- fixed memory management bug reported by Jack Diederich. version 0.50 Revised 09/13/2003 by Chris Gonnerman -- documentation change only: the GD library must be version 2.0.8 or higher (or you must choose version 0.40 or earlier of this module, which supports GD 1.8.3 or higher). version 0.42 Revised 06/10/2003 by Chris Gonnerman -- implemented patch by Gregory P. Smith to support writing to arbitrary objects, superceding the patch in 0.41 from Andreas Rottman. gddemo.py contains Rottman's example (which works with Smith's patched version) as well as an example (by me) of reading an image from a URL. The documentation was updated to reflect these changes. version 0.41 Revised 05/29/2003 by Chris Gonnerman -- implemented big patch by Andreas Rottmann to support writing images to memory via StringIO/CStringIO. Currently the only documentation is an example in gddemo.py. -- implemented patch by Bob Galloway to remove the "specialness" of negative coordinates in the string_ttf/string_ft methods. -- implemented patch by Nathan Robertson to enable MacOSX fink builds. -- fixed bugs in the proxy class with regard to passing of _gd.image types. version 0.40 Revised 09/18/2002 by Chris Gonnerman -- updated to deal with incomplete library installs version 0.30 Revised 06/12/2002 by Chris Gonnerman -- initial conversion to two-tier design version 0.26 Revised 12/10/2001 by Chris Gonnerman -- made unicode optional via define Py_UNICODEOBJECT_H version 0.25 Revised 09/15/2001 by Chris Gonnerman -- implemented patch by Mike Romberg: adds additional public functions, available only if GD 2.0.1+ is installed. version 0.24 Revised 08/08/2001 by Chris Gonnerman -- implemented patch by Mike Romberg: supports GCC 3.0 and GD 2.0.1 adds public C function makeGDImage() It allows C or C++ code which uses the gd library directly to make an imageobject instance. version 0.23 Revised 11/22/2000 by Chris Gonnerman -- included the patch from Tanimoto Osamu -- updated support to GD version 1.8.3 -- cleaned up code, added ANSI prototypes ******************************************************************/ #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIBTTF #define HAVE_LIBFREETYPE #endif /* missing from gd.h */ /* gdImagePtr gdImageCreateFromXpm(char *filename); */ #ifdef WIN32 #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT #endif static PyObject *ErrorObject; /* ** Declarations for objects of type image */ typedef struct i_o { PyObject_HEAD gdImagePtr imagedata; int multiplier_x,origin_x; int multiplier_y,origin_y; struct i_o *current_brush; struct i_o *current_tile; } imageobject; // 2.0.22 replaces gdFontTinyRep with gdFontGetTiny, and so on typedef gdFontPtr (*ptrGetFontFunction)(); typedef struct { char *name; ptrGetFontFunction func; } fontstruct; static fontstruct fonts[] = { {"gdFontTiny",&gdFontGetTiny}, {"gdFontSmall",&gdFontGetSmall}, {"gdFontMediumBold",&gdFontGetMediumBold}, {"gdFontLarge",&gdFontGetLarge}, {"gdFontGiant",&gdFontGetGiant}, {NULL,NULL} }; staticforward PyTypeObject Imagetype; #define is_imageobject(v) ((v)->ob_type == &Imagetype) #define MIN(x,y) ((x)<(y)?(x):(y)) #define X(x) ((x)*self->multiplier_x+self->origin_x) #define Y(y) ((y)*self->multiplier_y+self->origin_y) #define W(x) ((x)*self->multiplier_x) #define H(y) ((y)*self->multiplier_y) static imageobject *newimageobject(PyObject *args); /* ** Support Functions */ static PyObject *write_file(imageobject *img, PyObject *args, char fmt) { char *filename; PyObject *fileobj; FILE *fp = NULL; int closeme = 0, use_fileobj_write = 0; int arg1 = -1, arg2 = -1; int filesize = 0; void *filedata = NULL; if(PyArg_ParseTuple(args, "O!|ii", &PyFile_Type, &fileobj, &arg1, &arg2)) { fp = PyFile_AsFile(fileobj); } else if(PyErr_Clear(), PyArg_ParseTuple(args, "z|ii", &filename, &arg1, &arg2)) { if((fp = fopen(filename, "wb"))) { closeme = 1; } else { PyErr_SetFromErrno(PyExc_IOError); return NULL; } } else if (PyErr_Clear(), PyArg_ParseTuple(args, "O|ii", &fileobj, &arg1, &arg2)) { /* if we're passed a random object that has a write method we will * attempt to call object.write(filedata) */ if (!PyObject_HasAttrString(fileobj, "write")) { PyErr_SetString(ErrorObject, "first argument must be a file, string or object with a write method"); return NULL; } use_fileobj_write = 1; } else return NULL; switch(fmt) { case 'f' : /* gif */ #ifdef HAVE_LIBGIF if (use_fileobj_write) { filedata = gdImageGifPtr(img->imagedata, &filesize); } else { gdImageGif(img->imagedata, fp); } #else PyErr_SetString(PyExc_NotImplementedError, "GIF Support Not Available"); return NULL; #endif break; case 'p' : /* png */ #ifdef HAVE_LIBPNG if (use_fileobj_write) { filedata = gdImagePngPtr(img->imagedata, &filesize); } else { gdImagePng(img->imagedata, fp); } #else PyErr_SetString(PyExc_NotImplementedError, "PNG Support Not Available"); return NULL; #endif break; case 'j' : /* jpeg */ #ifdef HAVE_LIBJPEG if (use_fileobj_write) { filedata = gdImageJpegPtr(img->imagedata, &filesize, arg1); } else { gdImageJpeg(img->imagedata, fp, arg1); } #else PyErr_SetString(PyExc_NotImplementedError, "JPEG Support Not Available"); return NULL; #endif break; case 'g' : /* gd */ if (use_fileobj_write) { filedata = gdImageGdPtr(img->imagedata, &filesize); } else { gdImageGd(img->imagedata, fp); } break; case 'G' : /* gd2 */ if(arg1 == -1) arg1 = 0; if(arg2 != GD2_FMT_RAW && arg2 != GD2_FMT_COMPRESSED) arg2 = GD2_FMT_COMPRESSED; if (use_fileobj_write) { filedata = gdImageGd2Ptr(img->imagedata, arg1, arg2, &filesize); } else { gdImageGd2(img->imagedata, fp, arg1, arg2); } break; case 'w' : /* wbmp */ if(arg1 == -1) arg1 = 0; if (use_fileobj_write) { //filedata = gdImageWBMPPtr(img->imagedata, &filesize, arg1); } else { gdImageWBMP(img->imagedata, arg1, fp); } break; } if (use_fileobj_write || filedata) { PyObject *noerr; noerr = PyObject_CallMethod(fileobj, "write", "s#", filedata, filesize); gdFree(filedata); if (noerr == NULL) return NULL; } else if (closeme) { fclose(fp); } Py_INCREF(Py_None); return Py_None; } /* ** Methods for the image type */ imageobject *makeGDImage(gdImagePtr imagedata) { gdImagePtr newimg = gdImageCreate(gdImageSX(imagedata), gdImageSY(imagedata)); imageobject *rval = 0; gdImageCopy(newimg, imagedata, 0, 0, 0, 0, gdImageSX(imagedata), gdImageSY(imagedata)); if (!(rval = PyObject_NEW(imageobject, &Imagetype))) return NULL; rval->current_tile = rval->current_brush = NULL; rval->origin_x = rval->origin_y = 0; rval->multiplier_x = rval->multiplier_y = 1; rval->imagedata = newimg; return rval; } /*** I/O Methods ***/ static PyObject *image_writegif(imageobject *self, PyObject *args) { return write_file(self, args, 'f'); } static PyObject *image_writepng(imageobject *self, PyObject *args) { return write_file(self, args, 'p'); } static PyObject *image_writejpeg(imageobject *self, PyObject *args) { return write_file(self, args, 'j'); } static PyObject *image_writegd(imageobject *self, PyObject *args) { return write_file(self, args, 'g'); } static PyObject *image_writegd2(imageobject *self, PyObject *args) { return write_file(self, args, 'G'); } static PyObject *image_writewbmp(imageobject *self, PyObject *args) { return write_file(self, args, 'w'); } /*** Drawing Methods ***/ static PyObject *image_setpixel(imageobject *self, PyObject *args) { int x,y,color; if(!PyArg_ParseTuple(args, "(ii)i", &x, &y, &color)) return NULL; gdImageSetPixel(self->imagedata, X(x), Y(y), color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_line(imageobject *self, PyObject *args) { int sx,sy,ex,ey,color; if(!PyArg_ParseTuple(args, "(ii)(ii)i", &sx, &sy, &ex, &ey, &color)) return NULL; gdImageLine(self->imagedata, X(sx), Y(sy), X(ex), Y(ey), color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_lines(imageobject *self, PyObject *args) { int color,i,N; long sx,sy,ex,ey; PyObject *seq; PyObject *lastTup, *thisTup; if(!PyArg_ParseTuple(args, "Oi", &seq, &color)) return NULL; seq = PySequence_Fast(seq, NULL); N = PySequence_Length(seq); if (N<2) { PyErr_SetString(PyExc_ValueError, "lines() requires sequence of len(2) or greater"); return NULL; } lastTup = PySequence_GetItem(seq, 0); sx = X(PyInt_AsLong(PySequence_GetItem(lastTup, 0))); sy = Y(PyInt_AsLong(PySequence_GetItem(lastTup, 1))); for (i=0; iimagedata, sx, sy, ex, ey, color); sx = ex; sy = ey; } Py_INCREF(Py_None); return Py_None; } static PyObject *image_polygon(imageobject *self, PyObject *args) { PyObject *point, *points; gdPointPtr gdpoints; int size, color, i, fillcolor = -1; if(!PyArg_ParseTuple(args, "O!i|i", &PyTuple_Type, &points, &color, &fillcolor)) { PyErr_Clear(); if(PyArg_ParseTuple(args, "O!i|i", &PyList_Type, &points, &color, &fillcolor)) points=PyList_AsTuple(points); else return NULL; } size = PyTuple_Size(points); gdpoints = (gdPointPtr)calloc(size,sizeof(gdPoint)); for(i=0; iimagedata, gdpoints, size, fillcolor); gdImagePolygon(self->imagedata, gdpoints, size, color); free(gdpoints); Py_INCREF(Py_None); return Py_None; } static PyObject *image_rectangle(imageobject *self, PyObject *args) { int tx,ty,bx,by,t,color,fillcolor,fill=0; if(PyArg_ParseTuple(args, "(ii)(ii)ii", &tx, &ty, &bx, &by, &color, &fillcolor)) fill=1; else if(PyErr_Clear(), !PyArg_ParseTuple(args, "(ii)(ii)i", &tx, &ty, &bx, &by, &color)) return NULL; tx = X(tx); ty = Y(ty); bx = X(bx); by = Y(by); if(tx > bx) { t = tx; tx = bx; bx = t; } if(ty > by) { t = ty; ty = by; by = t; } if(fill) gdImageFilledRectangle(self->imagedata, tx, ty, bx, by, fillcolor); gdImageRectangle(self->imagedata, tx, ty, bx, by, color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_filledpolygon(imageobject *self, PyObject *args) { PyObject *point, *points; gdPointPtr gdpoints; int size, color, i; if(!PyArg_ParseTuple(args, "O!i", &PyTuple_Type, &points, &color)) { PyErr_Clear(); if(PyArg_ParseTuple(args, "O!i", &PyList_Type, &points, &color)) points=PyList_AsTuple(points); else return NULL; } size = PyTuple_Size(points); gdpoints = (gdPointPtr)calloc(size,sizeof(gdPoint)); for(i = 0; i < size; i++) { point = PyTuple_GET_ITEM(points,i); gdpoints[i].x = X(PyInt_AS_LONG((PyIntObject *)PyTuple_GET_ITEM(point,0))); gdpoints[i].y = Y(PyInt_AS_LONG((PyIntObject *)PyTuple_GET_ITEM(point,1))); } gdImageFilledPolygon(self->imagedata, gdpoints, size, color); free(gdpoints); Py_DECREF(points); Py_INCREF(Py_None); return Py_None; } static PyObject *image_filledrectangle(imageobject *self, PyObject *args) { int tx,ty,bx,by,t,color; if(!PyArg_ParseTuple(args, "(ii)(ii)i", &tx, &ty, &bx, &by, &color)) return NULL; tx = X(tx); ty = Y(ty); bx = X(bx); by = Y(by); if(tx > bx) {t=tx;tx=bx;bx=t;} if(ty > by) {t=ty;ty=by;by=t;} gdImageFilledRectangle(self->imagedata, tx, ty, bx, by, color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_arc(imageobject *self, PyObject *args) { int cx, cy, w, h, s, e, color, i; if(!PyArg_ParseTuple(args, "(ii)(ii)iii", &cx, &cy, &w, &h, &s, &e, &color)) return NULL; if(eimagedata, X(cx), Y(cy), W(w), H(h), s, e, color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_filledarc(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "filledArc() requires gd 2.0 or later"); return NULL; #else int cx, cy, w, h, s, e, color, i, style; if(!PyArg_ParseTuple(args, "(ii)(ii)iiii", &cx, &cy, &w, &h, &s, &e, &color, &style)) return NULL; if(eimagedata, X(cx), Y(cy), W(w), H(h), s, e, color, style); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_filledellipse(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "filledEllipse() requires gd 2.0 or later"); return NULL; #else int cx, cy, w, h, color; if(!PyArg_ParseTuple(args, "(ii)(ii)i", &cx, &cy, &w, &h, &color)) return NULL; gdImageFilledEllipse(self->imagedata, X(cx), Y(cy), W(w), H(h), color); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_filltoborder(imageobject *self, PyObject *args) { int x,y,border,color; if(!PyArg_ParseTuple(args, "(ii)ii", &x,&y,&border,&color)) return NULL; gdImageFillToBorder(self->imagedata, X(x),Y(y),border,color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_fill(imageobject *self, PyObject *args) { int x,y,color; if(!PyArg_ParseTuple(args, "(ii)i", &x,&y,&color)) return NULL; gdImageFill(self->imagedata, X(x),Y(y),color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_setbrush(imageobject *self, PyObject *args) { imageobject *brush; char *filename, *type; /* dummies */ if(PyArg_ParseTuple(args, "z|z", &filename, &type)) brush = (imageobject *)newimageobject(args); else if(PyErr_Clear(), PyArg_ParseTuple(args, "O!", &Imagetype, &brush)) Py_INCREF(brush); else return NULL; if(self->current_brush){ Py_DECREF(self->current_brush); } self->current_brush = brush; gdImageSetBrush(self->imagedata, brush->imagedata); Py_INCREF(Py_None); return Py_None; } static PyObject *image_setantialiased(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; gdImageSetAntiAliased(self->imagedata, c); Py_INCREF(Py_None); return Py_None; } static PyObject *image_setclip(imageobject *self, PyObject *args) { int tx,ty,bx,by,t; if(!PyArg_ParseTuple(args, "(ii)(ii)", &tx, &ty, &bx, &by)) return NULL; tx = X(tx); ty = Y(ty); bx = X(bx); by = Y(by); if(tx > bx) { t = tx; tx = bx; bx = t; } if(ty > by) { t = ty; ty = by; by = t; } gdImageSetClip(self->imagedata, tx, ty, bx, by); Py_INCREF(Py_None); return Py_None; } static PyObject *image_settile(imageobject *self, PyObject *args) { imageobject *tile; char *filename, *type; /* dummies */ if(PyArg_ParseTuple(args, "z|z", &filename, &type)) tile = (imageobject *)newimageobject(args); else if(PyErr_Clear(), PyArg_ParseTuple(args, "O!", &Imagetype, &tile)) Py_INCREF(tile); else return NULL; if(self->current_tile) { Py_DECREF(self->current_tile); } self->current_tile = tile; gdImageSetTile(self->imagedata, tile->imagedata); Py_INCREF(Py_None); return Py_None; } static PyObject *image_setstyle(imageobject *self, PyObject *args) { PyObject *style; int size, i, *stylearray; if(!PyArg_ParseTuple(args, "O!", &PyTuple_Type, &style)) { PyErr_Clear(); if(PyArg_ParseTuple(args, "O!", &PyList_Type, &style)) style=PyList_AsTuple(style); else return NULL; } size = PyTuple_Size(style); stylearray = (int *)calloc(size,sizeof(int)); for(i=0; iimagedata, stylearray, size); free(stylearray); Py_INCREF(Py_None); return Py_None; } static PyObject *image_setthickness(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "setThickness() requires gd 2.0 or later"); return NULL; #else int t; if(!PyArg_ParseTuple(args, "i", &t)) return NULL; gdImageSetThickness(self->imagedata, t); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_alphablending(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "alphaBlending() requires gd 2.0 or later"); return NULL; #else int blending; if(!PyArg_ParseTuple(args, "i", &blending)) return NULL; gdImageAlphaBlending(self->imagedata, blending); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_alpha(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "alpha() requires gd 2.0 or later"); return NULL; #else int color; if(!PyArg_ParseTuple(args, "i", &color)) return NULL; return Py_BuildValue("i", gdImageAlpha(self->imagedata, color)); #endif } static PyObject *image_getpixel(imageobject *self, PyObject *args) { int x,y; if(!PyArg_ParseTuple(args, "(ii)", &x,&y)) return NULL; return Py_BuildValue("i",gdImageGetPixel(self->imagedata, X(x),Y(y))); } static PyObject *image_boundssafe(imageobject *self, PyObject *args) { int x,y; if(!PyArg_ParseTuple(args, "(ii)", &x,&y)) return NULL; return Py_BuildValue("i",gdImageBoundsSafe(self->imagedata, X(x),Y(y))); } static PyObject *image_blue(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; return Py_BuildValue("i",gdImageBlue(self->imagedata,c)); } static PyObject *image_green(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; return Py_BuildValue("i",gdImageGreen(self->imagedata,c)); } static PyObject *image_red(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; return Py_BuildValue("i",gdImageRed(self->imagedata,c)); } static PyObject *image_size(imageobject *self) { return Py_BuildValue("(ii)",gdImageSX(self->imagedata),gdImageSY(self->imagedata)); } static PyObject *image_char(imageobject *self, PyObject *args) { int x,y,font,color; char c; if(!PyArg_ParseTuple(args, "i(ii)ii", &font,&x,&y,&c,&color)) return NULL; gdImageChar(self->imagedata, fonts[font].func(), X(x), Y(y), c, color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_charup(imageobject *self, PyObject *args) { int x,y,font,color; char c; if(!PyArg_ParseTuple(args, "i(ii)si", &font,&x,&y,&c,&color)) return NULL; gdImageCharUp(self->imagedata, fonts[font].func(), X(x), Y(y), c, color); Py_INCREF(Py_None); return Py_None; } static PyObject *image_get_bounding_rect(imageobject *self, PyObject *args) { #ifndef HAVE_LIBFREETYPE PyErr_SetString(PyExc_NotImplementedError, "Freetype Support Not Available"); return NULL; #else double ptsize, angle; char *fontname, *str, *rc; int x, y, brect[8]; if(!PyArg_ParseTuple(args, "sdd(ii)s", &fontname, &ptsize, &angle, &x, &y, &str)) return NULL; rc = gdImageStringTTF(NULL, brect, 0, fontname, ptsize, angle, x, y, str); if(rc != NULL){ PyErr_SetString(PyExc_ValueError, rc); return NULL; } return Py_BuildValue("(iiiiiiii)",brect[0],brect[1],brect[2],brect[3], brect[4],brect[5],brect[6],brect[7]); #endif } static PyObject *image_string_ft(imageobject *self, PyObject *args) { #ifndef HAVE_LIBFREETYPE PyErr_SetString(PyExc_NotImplementedError, "Freetype Support Not Available"); return NULL; #else #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "string_ft() requires gd 2.0 or later"); return NULL; #else int x,y,fg; double ptsize,angle; char *fontname,*str,*rc; int brect[8]; if(!PyArg_ParseTuple(args, "sdd(ii)si", &fontname, &ptsize, &angle, &x,&y,&str,&fg)) return NULL; rc = gdImageStringFT(NULL, brect, 0, fontname, ptsize, angle, 0, 0, str); /* calculate the bounding rect */ if(rc != NULL){ PyErr_SetString(PyExc_ValueError, rc); return NULL; } rc = gdImageStringTTF(self->imagedata, brect, fg, fontname, ptsize, angle, x, y, str); if(rc != NULL){ PyErr_SetString(PyExc_ValueError, rc); return NULL; } return Py_BuildValue("(iiiiiiii)", brect[0], brect[1], brect[2], brect[3], brect[4], brect[5], brect[6], brect[7]); #endif #endif } static PyObject *image_string_ttf(imageobject *self, PyObject *args) { #ifndef HAVE_LIBFREETYPE PyErr_SetString(PyExc_NotImplementedError, "Freetype Support Not Available"); return NULL; #else int x,y,fg; double ptsize,angle; char *fontname,*str,*rc; int brect[8]; if(!PyArg_ParseTuple(args, "sdd(ii)si", &fontname, &ptsize, &angle, &x,&y,&str,&fg)) return NULL; rc = gdImageStringTTF(NULL, brect, 0, fontname, ptsize, angle, 0, 0, str); /* calculate the bounding rect */ if(rc != NULL){ PyErr_SetString(PyExc_ValueError, rc); return NULL; } rc = gdImageStringTTF(self->imagedata, brect, fg, fontname, ptsize, angle, x, y, str); if(rc != NULL){ PyErr_SetString(PyExc_ValueError, rc); return NULL; } return Py_BuildValue("(iiiiiiii)", brect[0], brect[1], brect[2], brect[3], brect[4], brect[5], brect[6], brect[7]); #endif } static PyObject *image_string(imageobject *self, PyObject *args) { int x, y, font, color; unsigned char *str; if(!PyArg_ParseTuple(args, "i(ii)si", &font,&x,&y,&str,&color)) return NULL; gdImageString(self->imagedata, fonts[font].func(), X(x), Y(y), str, color); Py_INCREF(Py_None); return Py_None; } #ifdef Py_UNICODEOBJECT_H static PyObject *image_string16(imageobject *self, PyObject *args) { int x,y,font,color; Py_UNICODE *ustr; if(!PyArg_ParseTuple(args, "i(ii)ui", &font,&x,&y,&ustr,&color)) return NULL; gdImageString16(self->imagedata, fonts[font].func(), X(x), Y(y), (short unsigned int *)ustr, color); Py_INCREF(Py_None); return Py_None; } #endif static PyObject *image_stringup(imageobject *self, PyObject *args) { int x, y, font, color; unsigned char *str; if(!PyArg_ParseTuple(args, "i(ii)si", &font,&x,&y,&str,&color)) return NULL; gdImageStringUp(self->imagedata, fonts[font].func(), X(x), Y(y), str, color); Py_INCREF(Py_None); return Py_None; } #ifdef Py_UNICODEOBJECT_H static PyObject *image_stringup16(imageobject *self, PyObject *args) { int x,y,font,color; Py_UNICODE *ustr; if(!PyArg_ParseTuple(args, "i(ii)ui", &font,&x,&y,&ustr,&color)) return NULL; gdImageStringUp16(self->imagedata, fonts[font].func(), X(x), Y(y), (short unsigned int *)ustr, color); Py_INCREF(Py_None); return Py_None; } #endif static PyObject *image_colorallocate(imageobject *self, PyObject *args) { int r,g,b; if(!PyArg_ParseTuple(args, "(iii)", &r, &g, &b)) return NULL; return(Py_BuildValue("i",gdImageColorAllocate(self->imagedata, r, g, b))); } static PyObject *image_colorallocatealpha(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "colorAllocateAlpha() requires gd 2.0 or later"); return NULL; #else int r,g,b,a; if(!PyArg_ParseTuple(args, "(iiii)", &r, &g, &b, &a)) return NULL; return(Py_BuildValue("i",gdImageColorAllocateAlpha(self->imagedata, r, g, b, a))); #endif } static PyObject *image_colorclosest(imageobject *self, PyObject *args) { int r,g,b; if(!PyArg_ParseTuple(args, "(iii)", &r, &g, &b)) return NULL; return(Py_BuildValue("i",gdImageColorClosest(self->imagedata, r, g, b))); } static PyObject *image_colorclosestalpha(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "colorClosestAlpha() requires gd 2.0 or later"); return NULL; #else int r,g,b,a; if(!PyArg_ParseTuple(args, "(iiii)", &r, &g, &b, &a)) return NULL; return(Py_BuildValue("i",gdImageColorClosestAlpha(self->imagedata, r, g, b, a))); #endif } static PyObject *image_colorclosestHWB(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "colorClosestHWB() requires gd 2.0 or later"); return NULL; #else int r,g,b; if(!PyArg_ParseTuple(args, "(iii)", &r, &g, &b)) return NULL; return(Py_BuildValue("i",gdImageColorClosestHWB(self->imagedata, r, g, b))); #endif } static PyObject *image_colorexact(imageobject *self, PyObject *args) { int r,g,b; if(!PyArg_ParseTuple(args, "(iii)", &r, &g, &b)) return NULL; return(Py_BuildValue("i",gdImageColorExact(self->imagedata, r, g, b))); } static PyObject *image_colorresolve(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "colorResolve() requires gd 2.0 or later"); return NULL; #else int r,g,b; if(!PyArg_ParseTuple(args, "(iii)", &r, &g, &b)) return NULL; return(Py_BuildValue("i",gdImageColorResolve(self->imagedata, r, g, b))); #endif } static PyObject *image_colorresolvealpha(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "colorResolveAlpha() requires gd 2.0 or later"); return NULL; #else int r,g,b,a; if(!PyArg_ParseTuple(args, "(iiii)", &r, &g, &b, &a)) return NULL; return(Py_BuildValue("i",gdImageColorResolveAlpha(self->imagedata, r, g, b, a))); #endif } static PyObject *image_colorstotal(imageobject *self) { return Py_BuildValue("i",gdImageColorsTotal(self->imagedata)); } static PyObject *image_colorcomponents(imageobject *self, PyObject *args) { int c,r,g,b; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; r=gdImageRed(self->imagedata,c); g=gdImageGreen(self->imagedata,c); b=gdImageBlue(self->imagedata,c); return Py_BuildValue("(iii)",r,g,b); } static PyObject *image_getclip(imageobject *self) { int x1, y1, x2, y2; gdImageGetClip(self->imagedata, &x1, &y1, &x2, &y2); return Py_BuildValue("(ii)(ii)", x1, y1, x2, y2); } static PyObject *image_getinterlaced(imageobject *self) { return Py_BuildValue("i",gdImageGetInterlaced(self->imagedata)); } static PyObject *image_gettransparent(imageobject *self) { return Py_BuildValue("i",gdImageGetTransparent(self->imagedata)); } static PyObject *image_colordeallocate(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; gdImageColorDeallocate(self->imagedata, c); Py_INCREF(Py_None); return Py_None; } static PyObject *image_colortransparent(imageobject *self, PyObject *args) { int c; if(!PyArg_ParseTuple(args, "i", &c)) return NULL; gdImageColorTransparent(self->imagedata, c); Py_INCREF(Py_None); return Py_None; } static PyObject *image_copyto(imageobject *self, PyObject *args) { imageobject *dest; int dx,dy,sx,sy,w,h,dw,dh; dx=dy=sx=sy=0; w = gdImageSX(self->imagedata); h = gdImageSY(self->imagedata); if(!PyArg_ParseTuple(args, "O!|(ii)(ii)(ii)", &Imagetype, &dest, &dx, &dy, &sx, &sy, &w, &h)) return NULL; dw = gdImageSX(dest->imagedata); dh = gdImageSY(dest->imagedata); gdImageCopy(dest->imagedata, self->imagedata, X(dx), Y(dy), X(sx), Y(sy), W(w), H(h)); Py_INCREF(Py_None); return Py_None; } static PyObject *image_copyresizedto(imageobject *self, PyObject *args) { imageobject *dest; int dx,dy,sx,sy,dw,dh,sw,sh; dx=dy=sx=sy=0; sw = gdImageSX(self->imagedata); sh = gdImageSY(self->imagedata); if(PyArg_ParseTuple(args, "O!|(ii)(ii)", &Imagetype, &dest, &dx, &dy, &sx, &sy)) { dw = gdImageSX(dest->imagedata); dh = gdImageSY(dest->imagedata); } else if(PyErr_Clear(), !PyArg_ParseTuple(args, "O!|(ii)(ii)(ii)(ii)", &Imagetype, &dest, &dx, &dy, &sx, &sy, &dw, &dh, &sw, &sh)) return NULL; gdImageCopyResized(dest->imagedata, self->imagedata, X(dx), Y(dy), X(sx), Y(sy), W(dw), H(dh), W(sw), H(sh)); Py_INCREF(Py_None); return Py_None; } static PyObject *image_copyresampledto(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "copyResampledTo() requires gd 2.0 or later"); return NULL; #else imageobject *dest; int dx,dy,sx,sy,dw,dh,sw,sh; dx=dy=sx=sy=0; sw = gdImageSX(self->imagedata); sh = gdImageSY(self->imagedata); if(PyArg_ParseTuple(args, "O!|(ii)(ii)", &Imagetype, &dest, &dx, &dy, &sx, &sy)) { dw = gdImageSX(dest->imagedata); dh = gdImageSY(dest->imagedata); } else if(PyErr_Clear(), !PyArg_ParseTuple(args, "O!|(ii)(ii)(ii)(ii)", &Imagetype, &dest, &dx, &dy, &sx, &sy, &dw, &dh, &sw, &sh)) return NULL; gdImageCopyResampled(dest->imagedata, self->imagedata, X(dx), Y(dy), X(sx), Y(sy), W(dw), H(dh), W(sw), H(sh)); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_copymergeto(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "copyMergeTo() requires gd 2.0 or later"); return NULL; #else imageobject *dest; int dx,dy,sx,sy,w,h,dw,dh,pct; dx=dy=sx=sy=0; w = gdImageSX(self->imagedata); h = gdImageSY(self->imagedata); pct = 100; if(!PyArg_ParseTuple(args, "O!|(ii)(ii)(ii)i", &Imagetype, &dest, &dx, &dy, &sx, &sy, &w, &h, &pct)) return NULL; dw = gdImageSX(dest->imagedata); dh = gdImageSY(dest->imagedata); gdImageCopyMerge(dest->imagedata, self->imagedata, X(dx), Y(dy), X(sx), Y(sy), W(w), H(h), pct); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_copymergegrayto(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "copyMergeGrayTo() requires gd 2.0 or later"); return NULL; #else imageobject *dest; int dx,dy,sx,sy,w,h,dw,dh,pct; dx=dy=sx=sy=0; w = gdImageSX(self->imagedata); h = gdImageSY(self->imagedata); pct = 100; if(!PyArg_ParseTuple(args, "O!|(ii)(ii)(ii)i", &Imagetype, &dest, &dx, &dy, &sx, &sy, &w, &h, &pct)) return NULL; dw = gdImageSX(dest->imagedata); dh = gdImageSY(dest->imagedata); gdImageCopyMergeGray(dest->imagedata, self->imagedata, X(dx), Y(dy), X(sx), Y(sy), W(w), H(h), pct); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_copypaletteto(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "copyPaletteTo() requires gd 2.0 or later"); return NULL; #else imageobject *dest; if(!PyArg_ParseTuple(args, "O!", &Imagetype, &dest)) return NULL; gdImagePaletteCopy(dest->imagedata, self->imagedata); Py_INCREF(Py_None); return Py_None; #endif } static PyObject *image_compare(imageobject *self, PyObject *args) { #if GD2_VERS <= 1 PyErr_SetString(PyExc_NotImplementedError, "compare() requires gd 2.0 or later"); return NULL; #else imageobject *dest; if(!PyArg_ParseTuple(args, "O!", &Imagetype, &dest)) return NULL; return Py_BuildValue("i", gdImageCompare(dest->imagedata, self->imagedata)); #endif } static PyObject *image_interlace(imageobject *self, PyObject *args) { int i; if(!PyArg_ParseTuple(args, "i", &i)) return NULL; gdImageInterlace(self->imagedata, i); Py_INCREF(Py_None); return Py_None; } static PyObject *image_savealpha(imageobject *self, PyObject *args) { int i; if(!PyArg_ParseTuple(args, "i", &i)) return NULL; gdImageSaveAlpha(self->imagedata, i); Py_INCREF(Py_None); return Py_None; } static PyObject *image_origin(imageobject *self, PyObject *args) { if(!PyArg_ParseTuple(args, "(ii)|ii",&self->origin_x,&self->origin_y, &self->multiplier_x,&self->multiplier_y)) return NULL; Py_INCREF(Py_None); return Py_None; } static PyObject *image_getorigin(imageobject *self) { return Py_BuildValue("((ii)ii)",self->origin_x,self->origin_y,self->multiplier_x,self->multiplier_y); } 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" "file name."}, {"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."}, {"writeJpeg", (PyCFunction)image_writejpeg, 1, "writeJpeg(f,quality)\n" "write the image to f as a JPEG, where f is either an open file object or a\n" "file name. quality is an optional integer value giving the JPEG quality from\n" "0 to 95%; leave out for default quality."}, {"writeWbmp", (PyCFunction)image_writewbmp, 1, "writeWbmp(f,fg)\n" "write the image to f as a WBMP, where f is either an open file object or a\n" "file name. fg is a foreground color index which will be set in the output\n" "file; see the gd documentation for a further explanation of this value."}, {"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" "or a file name."}, {"writeGd2", (PyCFunction)image_writegd2, 1, "writeGd(f,chunksize,fmt)\n" "write the image to f as a GD2 file, where f is either an open file object\n" "or a file name. see the gd documentation for an explanation of the chunksize\n" "and fmt arguments. defaults will be used if not given."}, {"setPixel", (PyCFunction)image_setpixel, 1, "setPixel((x,y), color)\n" "set the pixel at (x,y) to color"}, {"line", (PyCFunction)image_line, 1, "line((x1,y1), (x2,y2), color)\n" "draw a line from (x1,y1) to (x2,y2) in color"}, {"lines", (PyCFunction)image_lines, 1, "line(seq, color)\n" "seq is a list of x,y tuples. Draw a connected line in color"}, {"polygon", (PyCFunction)image_polygon, 1, "polygon(((x1,y1), (x2,y2), ..., (xn, yn)), color[, fillcolor])\n" "draw a polygon using the list or tuple of points (minimum 3) in color,\n" "optionally filled with fillcolor"}, {"rectangle", (PyCFunction)image_rectangle, 1, "rectangle((x1,y1), (x2,y2), color[, fillcolor])\n" "draw a rectangle with upper corner (x1,y1), lower corner (x2,y2) in color,\n" "optionally filled with fillcolor"}, {"filledPolygon", (PyCFunction)image_filledpolygon, 1, "filledPolygon(((x1,y1), (x2,y2), ..., (xn, yn)), color)\n" "draw a filled polygon using the list or tuple of points (minimum 3) in color"}, {"filledRectangle", (PyCFunction)image_filledrectangle, 1, "filledRectangle((x1,y1), (x2,y2), color)\n" "draw a rectangle with upper corner (x1,y1), lower corner (x2,y2) in color"}, {"arc", (PyCFunction)image_arc, 1, "arc((x,y), (w,h), start, end, color)\n" "draw an ellipse centered at (x,y) with width w, height h from start\n" "degrees to end degrees in color."}, {"filledArc", (PyCFunction)image_filledarc, 1, "filledArc((x,y), (w,h), start, end, color, style)\n" "draw an ellipse centered at (x,y) with width w, height h from start\n" "degrees to end degrees in color. The style argument is a bitwise OR\n" "of the following (gdArc, gdChord, gdPie, gdNoFill, gdEdged)."}, {"filledEllipse", (PyCFunction)image_filledellipse, 1, "filledEllipse((x,y), (w,h), color)\n" "draw a filled ellipse centered at (x,y) with width w,\n" "height h in color."}, {"fillToBorder", (PyCFunction)image_filltoborder, 1, "fillToBorder((x,y), border, color)\n" "flood from point (x,y) to border color in color"}, {"fill", (PyCFunction)image_fill, 1, "fill((x,y), color)\n" "flood from point (x,y) in color for those pixels with the same color\n" "as the starting point"}, {"setBrush", (PyCFunction)image_setbrush, 1, "setBrush(image)\n" "set the drawing brush to (use gdBrushed when drawing)"}, {"setAntiAliased", (PyCFunction)image_setantialiased, 1, "setAntiAliased(color)\n" "Set the foreground color to be used when drawing antialiased lines. Use the gdAntiAliased in place of the color when drawing"}, {"setClip", (PyCFunction)image_setclip, 1, "setClip((x1,y1), (x2,y2))\n" "Set the image clipping rectangle"}, {"setTile", (PyCFunction)image_settile, 1, "setTile(image)\n" "set the fill tile to (use gdTiled when filling)"}, {"setStyle", (PyCFunction)image_setstyle, 1, "setStyle(tuple)\n" "set the line bit-style to tuple of colors (use gdStyled when drawing)"}, {"setThickness", (PyCFunction)image_setthickness, 1, "setThickness(thickness)\n" "set the width of lines, polyons, and arcs."}, {"alphaBlending", (PyCFunction)image_alphablending, 1, "alphaBlending(blending)\n" "toggles alpha channel blending for trucolor images."}, {"alpha", (PyCFunction)image_alpha, 1, "alpha(color)\n" "returns the alpha component of the specified color."}, {"blue", (PyCFunction)image_blue, 1, "blue(color)\n" "returns the blue component of the specified color."}, {"green", (PyCFunction)image_green, 1, "green(color)\n" "returns the green component of the specified color."}, {"red", (PyCFunction)image_red, 1, "red(color)\n" "returns the red component of the specified color."}, {"getPixel", (PyCFunction)image_getpixel, 1, "getPixel((x,y))\n" "color index of image at (x,y)"}, {"boundsSafe", (PyCFunction)image_boundssafe, 1, "boundsSafe((x,y))\n" "returns true if(x,y) is within image"}, {"size", (PyCFunction)image_size, 1, "size()\n" "return the 2-tuple size of image"}, {"char", (PyCFunction)image_char,1, "char(font, (x,y), c, color)\n" "draw string c at (x,y) using one of the pre-defined gdmodule fonts (gdFont*)"}, {"charUp", (PyCFunction)image_charup,1, "charUp(font, (x,y), c, color)\n" "vertically draw string c at (x,y) using one of the pre-defined gdmodule\n" "fonts (gdFont*)"}, {"get_bounding_rect", (PyCFunction)image_get_bounding_rect,1, "get_bounding_rect(font, ptsize, angle,(x,y), s)\n" "get bounding rect of string s using the truetype font"}, {"string_ttf", (PyCFunction)image_string_ttf,1, "string_ttf(font, ptsize, angle, (x,y), s, color)\n" "draw string s at (x,y) using the truetype font"}, {"string_ft", (PyCFunction)image_string_ft,1, "string_ft(font, ptsize, angle, (x,y), s, color)\n" "draw string s at (x,y) using the truetype font"}, {"string", (PyCFunction)image_string,1, "string(font, (x,y), s, color)\n" "draw string s at (x,y) using one of the pre-defined gdmodule fonts (gdFont*)"}, #ifdef Py_UNICODEOBJECT_H {"string16", (PyCFunction)image_string16,1, "string(font, (x,y), s, color)\n" "draw unicode string s at (x,y) using one of the pre-defined gdmodule fonts (gdFont*)"}, #endif {"stringUp", (PyCFunction)image_stringup,1, "stringUp(font, (x,y), s, color)\n" "vertically draw string s at (x,y) using one of the pre-defined gdmodule\n" "fonts (gdFont*)"}, #ifdef Py_UNICODEOBJECT_H {"stringUp16", (PyCFunction)image_stringup16,1, "stringUp16(font, (x,y), s, color)\n" "vertically draw unicode string s at (x,y) using one of the pre-defined gdmodule\n" "fonts (gdFont*)"}, #endif {"colorAllocate", (PyCFunction)image_colorallocate,1, "colorAllocate((r,g,b))\n" "allocate a color index to (r,g,b) (returns -1 if unable to)"}, {"colorAllocateAlpha", (PyCFunction)image_colorallocatealpha,1, "colorAllocateAlpha((r,g,b,a))\n" "allocate a color index to (r,g,b,a) (returns -1 if unable to)"}, {"colorClosest", (PyCFunction)image_colorclosest, 1, "colorClosest((r,g,b))\n" "return the color index closest to (r,g,b) (returns -1 if unable to)"}, {"colorClosestAlpha", (PyCFunction)image_colorclosestalpha, 1, "colorClosestAlpha((r,g,b,a))\n" "return the color index closest to (r,g,b,a) (returns -1 if unable to)"}, {"colorClosestHWB", (PyCFunction)image_colorclosestHWB, 1, "colorClosestHWB((r,g,b))\n" "return the color index closest in hue whiteness and blackness to (r,g,b) (returns -1 if unable to)"}, {"colorExact", (PyCFunction)image_colorexact, 1, "colorExact((r,g,b))\n" "return an exact color index match for (r,g,b) (returns -1 if unable to)"}, {"colorResolve", (PyCFunction)image_colorresolve, 1, "colorResolve((r,g,b))\n" "returns the exact color (after possibly allocating) or the closes match."}, {"colorResolveAlpha", (PyCFunction)image_colorresolvealpha, 1, "colorResolve((r,g,b,a))\n" "returns the exact color (after possibly allocating) or the closes match."}, {"colorsTotal", (PyCFunction)image_colorstotal, 1, "colorsTotal()\n" "returns the number of colors currently allocated"}, {"colorComponents", (PyCFunction)image_colorcomponents, 1, "colorComponents(color)\n" "returns a 3-tulple of the (r,g,b) components of color"}, {"getClip", (PyCFunction)image_getclip, 1, "getClip()\n" "returns (x1,y1), (x2,y2) of the image clip rectange"}, {"getInterlaced", (PyCFunction)image_getinterlaced, 1, "getInterlaced()\n" "returns true if the image is interlaced"}, {"getTransparent", (PyCFunction)image_gettransparent, 1, "getTransparent()\n" "returns transparent color index or -1"}, {"colorDeallocate", (PyCFunction)image_colordeallocate, 1, "colorDeallocate(color)\n" "deallocate color from the image palette"}, {"colorTransparent", (PyCFunction)image_colortransparent, 1, "colorTransparent(color)\n" "set the transparent color to color"}, {"copyTo", (PyCFunction)image_copyto, 1, "copyTo(image[, (dx,dy)[, (sx,sy)[, (w,h)]]])\n" "copy from (sx,sy), width sw and height sh to destination image (dx,dy)"}, {"copyResizedTo", (PyCFunction)image_copyresizedto,1, "copyResizedTocopyTo(image[, (dx,dy)[, (sx,sy)[, (dw,dh)[, (sw,sh)]]]])\n" "copy from (sx,sy), width sw and height sh to destination image (dx,dy), \n" "width dw and height dh"}, {"copyResampledTo", (PyCFunction)image_copyresampledto,1, "copyResampledTo(image[, (dx,dy)[, (sx,sy)[, (dw,dh)[, (sw,sh)]]]])\n" "copy from (sx,sy), width sw and height sh to destination image (dx,dy), \n" "width dw and height dh using smooth pixel interpolation."}, {"copyMergeTo", (PyCFunction)image_copymergeto, 1, "copyMergeTo(image[, (dx,dy)[, (sx,sy)[, (w,h)]], pct])\n" "copy from (sx,sy), width sw and height sh to destination image (dx,dy)\n" "If pct is 100 then this is equivalent to copyTo(). If pct is less\n" "than 100 the images are merged." }, {"copyMergeGrayTo", (PyCFunction)image_copymergegrayto, 1, "copyMergeGrayTo(image[, (dx,dy)[, (sx,sy)[, (w,h)]], pct])\n" "copy from (sx,sy), width sw and height sh to destination image (dx,dy)\n" "If pct is 100 then this is equivalent to copyTo(). If pct is less\n" "than 100 the images are merged. The hue is preserved by first\n" "converting the destination pixels to gray." }, {"copyPaletteTo", (PyCFunction)image_copypaletteto, 1, "copyPaletteTo(image)\n" "copy the palette from one image to another."}, {"compare", (PyCFunction)image_compare, 1, "compare(image)\n" "compares this image with another. Returns a bitmask whose values\n" "are composed of CMP_IMAGE, CMP_NUM_COLORS, CMP_COLOR, CMP_SIZE_X,\n" "CMP_SIZE_Y, CMP_TRANSPARENT, CMP_BACKGROUND, CMP_INTERLACE, CMP_TRUECOLOR"}, {"interlace", (PyCFunction)image_interlace, 1, "interlace()\n" "set the interlace bit"}, {"origin", (PyCFunction)image_origin, 1, "origin((x,y)[,xmult,ymult])\n" "set the origin of the image to (x,y) and multiply all x, y, width and\n" "height factors by xmult and ymult (typically either 1 or -1)"}, {"getOrigin", (PyCFunction)image_getorigin, 1, "getOrigin()\n" "returns the origin parameters ((x,y),xmult,ymult)"}, {"saveAlpha", (PyCFunction)image_savealpha, 1, "saveAlpha(n)\n" "if n = 1, alpha channel information will be saved" " (assuming the format supports it, i.e. PNG)"}, {NULL, NULL} /* sentinel */ }; /* ** Table of file types understood to gd "constructors" */ static struct { char *ext; gdImagePtr (*func)(FILE*); } ext_table[] = { #ifdef HAVE_LIBGIF {"gif", gdImageCreateFromGif}, #endif #ifdef HAVE_LIBPNG {"png", gdImageCreateFromPng}, #endif #ifdef HAVE_LIBJPEG {"jpeg", gdImageCreateFromJpeg}, {"jpg", gdImageCreateFromJpeg}, {"jfif", gdImageCreateFromJpeg}, #endif {"gd", gdImageCreateFromGd}, {"gd2", gdImageCreateFromGd2}, {"xbm", gdImageCreateFromXbm}, /* this is internal to gd */ {NULL, NULL} }; static struct { char *ext; gdImagePtr (*func)(gdIOCtxPtr); } ext_table_ctx[] = { #ifdef HAVE_LIBPNG {"png", gdImageCreateFromPngCtx}, #endif #ifdef HAVE_LIBJPEG {"jpeg", gdImageCreateFromJpegCtx}, {"jpg", gdImageCreateFromJpegCtx}, {"jfif", gdImageCreateFromJpegCtx}, #endif {"gd", gdImageCreateFromGdCtx}, {"gd2", gdImageCreateFromGd2Ctx}, {NULL, NULL} }; /* ** Code to act as a gdIOCtx wrapper for a python file object ** (read-only; write support would not be difficult to add) */ struct PyFileIfaceObj_gdIOCtx { gdIOCtx ctx; PyObject *fileIfaceObj; PyObject *strObj; // our reference to the data string we're currently }; int PyFileIfaceObj_IOCtx_GetC(gdIOCtx *ctx) { struct PyFileIfaceObj_gdIOCtx *pctx = (struct PyFileIfaceObj_gdIOCtx *)ctx; if (pctx->strObj) { Py_DECREF(pctx->strObj); pctx->strObj = NULL; } pctx->strObj = PyObject_CallMethod(pctx->fileIfaceObj, "read", "i", 1); if (!pctx->strObj || !PyString_Check(pctx->strObj)) { return EOF; } if (PyString_GET_SIZE(pctx->strObj) == 1) { return (int)(unsigned char)PyString_AS_STRING(pctx->strObj)[0]; } return EOF; } int PyFileIfaceObj_IOCtx_GetBuf(gdIOCtx *ctx, void *data, Py_ssize_t size) { int err; char *value; struct PyFileIfaceObj_gdIOCtx *pctx = (struct PyFileIfaceObj_gdIOCtx *)ctx; if (pctx->strObj) { Py_DECREF(pctx->strObj); pctx->strObj = NULL; } pctx->strObj = PyObject_CallMethod(pctx->fileIfaceObj, "read", "i", size); if (!pctx->strObj) { return 0; } err = PyString_AsStringAndSize(pctx->strObj, &value, &size); if (err < 0) { /* this throws away the python exception since the gd library * won't pass it up properly. gdmodule should create its own * since the "file" couldn't be read properly. */ PyErr_Clear(); return 0; } memcpy(data, value, size); return size; } void PyFileIfaceObj_IOCtx_Free(gdIOCtx *ctx) { struct PyFileIfaceObj_gdIOCtx *pctx = (struct PyFileIfaceObj_gdIOCtx *)ctx; if (pctx->strObj) { Py_DECREF(pctx->strObj); pctx->strObj = NULL; } if (pctx->fileIfaceObj) { Py_DECREF(pctx->fileIfaceObj); pctx->fileIfaceObj = NULL; } /* NOTE: we leave deallocation of the ctx structure itself to outside * code for memory allocation symmetry. This function is safe to * call multiple times (gd should call it + we call it to be safe). */ } struct PyFileIfaceObj_gdIOCtx * alloc_PyFileIfaceObj_IOCtx(PyObject *fileIfaceObj) { struct PyFileIfaceObj_gdIOCtx *pctx; pctx = calloc(1, sizeof(struct PyFileIfaceObj_gdIOCtx)); if (!pctx) return NULL; pctx->ctx.getC = PyFileIfaceObj_IOCtx_GetC; pctx->ctx.getBuf = PyFileIfaceObj_IOCtx_GetBuf; pctx->ctx.gd_free = PyFileIfaceObj_IOCtx_Free; Py_INCREF(fileIfaceObj); pctx->fileIfaceObj = fileIfaceObj; return pctx; } void free_PyFileIfaceObj_IOCtx(struct PyFileIfaceObj_gdIOCtx *pctx) { if (!pctx) return; assert(pctx->ctx.gd_free != NULL); pctx->ctx.gd_free((gdIOCtxPtr)pctx); // free its internal resources free(pctx); } /* ** Code to create the imageobject */ static imageobject *newimageobject(PyObject *args) { imageobject *self, *srcimage; int xdim=0, ydim=0, i, trueColor=0; char *filename,*ext=0; FILE *fp; PyObject *readObj; if(!(self = PyObject_NEW(imageobject, &Imagetype))) return NULL; self->current_tile = self->current_brush = NULL; self->origin_x = self->origin_y = 0; self->multiplier_x = self->multiplier_y = 1; self->imagedata = NULL; if(PyArg_ParseTuple(args, "")) { PyErr_SetString(PyExc_ValueError, "image size or source filename required"); Py_DECREF(self); return NULL; } else if(PyErr_Clear(), PyArg_ParseTuple(args, "O!|(ii)i", &Imagetype, &srcimage, &xdim, &ydim, &trueColor)) { if(!xdim) xdim = gdImageSX(srcimage->imagedata); if(!ydim) ydim = gdImageSY(srcimage->imagedata); #if GD2_VERS <= 1 trueColor = 0; #endif if (!trueColor){ if(!(self->imagedata = gdImageCreate(xdim,ydim))) { Py_DECREF(self); return NULL; } } #if GD2_VERS > 1 else if(!(self->imagedata = gdImageCreateTrueColor(xdim,ydim))) { Py_DECREF(self); return NULL; } #endif if(xdim == gdImageSX(srcimage->imagedata) && ydim == gdImageSY(srcimage->imagedata)) gdImageCopy(self->imagedata,srcimage->imagedata,0,0,0,0,xdim,ydim); else gdImageCopyResized(self->imagedata,srcimage->imagedata, 0,0,0,0,xdim,ydim,gdImageSX(srcimage->imagedata), gdImageSY(srcimage->imagedata)); } else if(PyErr_Clear(), PyArg_ParseTuple(args, "(ii)|i", &xdim, &ydim, &trueColor)) { if(!xdim || !ydim) { PyErr_SetString(PyExc_ValueError, "dimensions cannot be 0"); Py_DECREF(self); return NULL; } #if GD2_VERS <= 1 trueColor = 0; #endif if (!trueColor){ if(!(self->imagedata = gdImageCreate(xdim,ydim))) { Py_DECREF(self); return NULL; } } #if GD2_VERS > 1 else if(!(self->imagedata = gdImageCreateTrueColor(xdim,ydim))) { Py_DECREF(self); return NULL; } #endif } else if(PyErr_Clear(), PyArg_ParseTuple(args, "s|s", &filename, &ext)) { if(!ext) { if(!(ext = strrchr(filename,'.'))) { PyErr_SetString(PyExc_IOError, "need an extension to determine file type (.png|.jpeg|.jpg|.gd|.gd2|.xpm|.xbm)"); Py_DECREF(self); return NULL; } ext++; } if(strcmp(ext, "xpm") == 0) { #ifndef HAVE_LIBXPM PyErr_SetString(PyExc_NotImplementedError, "XPM Support Not Available"); Py_DECREF(self); return NULL; #else /* gdImageCreateFromXpm takes a filename rather than a FILE * */ if(!(self->imagedata = gdImageCreateFromXpm(filename))) { PyErr_SetString(PyExc_IOError, "corrupt or invalid image file"); Py_DECREF(self); return(NULL); } return self; #endif } if(!(fp = fopen(filename,"rb"))) { PyErr_SetFromErrno(PyExc_IOError); Py_DECREF(self); return(NULL); } for(i = 0; ext_table[i].ext != NULL; i++) { if(strcmp(ext, ext_table[i].ext) == 0) { if(!(self->imagedata = ext_table[i].func(fp))) { fclose(fp); PyErr_SetString(PyExc_IOError, "corrupt or invalid image file (may be unsupported)"); Py_DECREF(self); return(NULL); } fclose(fp); return self; } } /* if we fall out, we didn't find the file type */ PyErr_SetString(PyExc_IOError, "unsupported file type (only .gif|.png|.jpeg|.jpg|.gd|.gd2|.xbm|.xpm accepted)"); Py_DECREF(self); return(NULL); } else if(PyErr_Clear(), PyArg_ParseTuple(args, "Oz", &readObj, &ext)) { struct PyFileIfaceObj_gdIOCtx *ourIOCtx = NULL; if (!PyObject_HasAttrString(readObj, "read")) { PyErr_SetString(ErrorObject, "non-Image objects must have a read() method"); Py_DECREF(self); return NULL; } ourIOCtx = alloc_PyFileIfaceObj_IOCtx(readObj); if (!ourIOCtx) { PyErr_NoMemory(); Py_DECREF(self); return(NULL); } for(i = 0; ext_table_ctx[i].ext != NULL; i++) { if(strcmp(ext, ext_table_ctx[i].ext) == 0) { if(!(self->imagedata = ext_table_ctx[i].func((gdIOCtxPtr)ourIOCtx))) { free_PyFileIfaceObj_IOCtx(ourIOCtx); PyErr_SetString(PyExc_IOError, "corrupt or invalid image data (may be unsupported)"); Py_DECREF(self); return(NULL); } free_PyFileIfaceObj_IOCtx(ourIOCtx); return self; } } /* if we fall out, we didn't find the file type */ PyErr_SetString(PyExc_IOError, "unsupported file type (only png, jpeg, gd, & gd2 can be read from an object)"); free_PyFileIfaceObj_IOCtx(ourIOCtx); Py_DECREF(self); return(NULL); } else { PyErr_SetString(PyExc_ValueError, "invalid argument list"); Py_DECREF(self); return(NULL); } return self; } static void image_dealloc(imageobject *self) { if(self->current_brush) { Py_DECREF(self->current_brush); } if(self->current_tile) { Py_DECREF(self->current_tile); } if(self->imagedata) gdImageDestroy(self->imagedata); PyObject_DEL(self); } static PyObject *image_getattr(PyObject *self, char *name) { return Py_FindMethod(image_methods, self, name); } static PyObject *image_print(PyObject *self, FILE *fp, int flags) { gdImagePtr im; im = ((imageobject *)self)->imagedata; fprintf(fp,"<%dx%d image object at 0x%lx>",gdImageSX(im),gdImageSY(im), (unsigned long)self); return 0; } static PyTypeObject Imagetype = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "image", /*tp_name*/ sizeof(imageobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)image_dealloc, /*tp_dealloc*/ (printfunc)image_print, /*tp_print*/ (getattrfunc)image_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call */ 0, /*tp_str */ 0,0,0,0, /*tp_xxx1-4 */ }; static PyObject *gd_image(PyObject *self, PyObject *args) { return (PyObject *)newimageobject(args); } static PyObject *gd_fontSSize(PyObject *self, PyObject *args) { int font; char *str; int len; if(!PyArg_ParseTuple(args, "is", &font, &str)) return NULL; if(font < 0 && font >= (sizeof(fonts)-1)) { PyErr_SetString(PyExc_ValueError, "Font value not valid"); return NULL; } len = strlen(str); return Py_BuildValue("(ii)", len*(fonts[font].func()->w), fonts[font].func()->h); } /* ** List of methods defined in the module */ static struct PyMethodDef gd_methods[] = { {"image", gd_image, 1, "image(image[,(w,h)] | file | file,type | (w,h))\n" "create GD image from file of type gif, png, jpeg, gd, gd, gd2, xbm, or xpm.\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" "return a tuple containing the size in pixels of the given string in the\n" "given font"}, {NULL, NULL} /* sentinel */ }; /* Initialization function for the module (*must* be called init_gd) */ void DLLEXPORT init_gd(void) { PyObject *m, *d, *v; int i=0; /* Create the module and add the functions */ m = Py_InitModule("_gd", gd_methods); /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); ErrorObject = PyString_FromString("gd.error"); PyDict_SetItemString(d, "error", ErrorObject); /* add in the two font constants */ while(fonts[i].name) { v = Py_BuildValue("i", i); PyDict_SetItemString(d, fonts[i++].name, v); } /* and the standard gd constants */ v = Py_BuildValue("i", gdAntiAliased); PyDict_SetItemString(d, "gdAntiAliased", v); v = Py_BuildValue("i", gdBrushed); PyDict_SetItemString(d, "gdBrushed", v); v = Py_BuildValue("i", gdMaxColors); PyDict_SetItemString(d, "gdMaxColors", v); v = Py_BuildValue("i", gdMaxColors); PyDict_SetItemString(d, "gdMaxColors", v); v = Py_BuildValue("i", gdStyled); PyDict_SetItemString(d, "gdStyled", v); v = Py_BuildValue("i", gdStyledBrushed); PyDict_SetItemString(d, "gdStyledBrushed", v); v = Py_BuildValue("i", gdDashSize); PyDict_SetItemString(d, "gdDashSize", v); v = Py_BuildValue("i", gdTiled); PyDict_SetItemString(d, "gdTiled", v); v = Py_BuildValue("i", gdTransparent); PyDict_SetItemString(d, "gdTransparent", v); #if GD2_VERS > 1 v = Py_BuildValue("i", gdArc); PyDict_SetItemString(d, "gdArc", v); v = Py_BuildValue("i", gdChord); PyDict_SetItemString(d, "gdChord", v); v = Py_BuildValue("i", gdPie); PyDict_SetItemString(d, "gdPie", v); v = Py_BuildValue("i", gdNoFill); PyDict_SetItemString(d, "gdNoFill", v); v = Py_BuildValue("i", gdEdged); PyDict_SetItemString(d, "gdEdged", v); v = Py_BuildValue("i", GD_CMP_IMAGE); PyDict_SetItemString(d, "CMP_IMAGE", v); v = Py_BuildValue("i", GD_CMP_NUM_COLORS); PyDict_SetItemString(d, "CMP_NUM_COLORS", v); v = Py_BuildValue("i", GD_CMP_COLOR); PyDict_SetItemString(d, "CMP_COLOR", v); v = Py_BuildValue("i", GD_CMP_SIZE_X); PyDict_SetItemString(d, "CMP_SIZE_X", v); v = Py_BuildValue("i", GD_CMP_SIZE_Y); PyDict_SetItemString(d, "CMP_SIZE_Y", v); v = Py_BuildValue("i", GD_CMP_TRANSPARENT); PyDict_SetItemString(d, "CMP_TRANSPARENT", v); v = Py_BuildValue("i", GD_CMP_BACKGROUND); PyDict_SetItemString(d, "CMP_BACKGROUND", v); v = Py_BuildValue("i", GD_CMP_INTERLACE); PyDict_SetItemString(d, "CMP_INTERLACE", v); v = Py_BuildValue("i", GD_CMP_TRUECOLOR); PyDict_SetItemString(d, "CMP_TRUECOLOR", v); #endif /* Check for errors */ if(PyErr_Occurred()) Py_FatalError("can't initialize module gd"); } /* end of file. */ gdmodule-0.58/demo/000077500000000000000000000000001216105026500141705ustar00rootroot00000000000000gdmodule-0.58/demo/Pacifico SIL OFL Font License 1.1.txt000066400000000000000000000104561216105026500221770ustar00rootroot00000000000000Copyright (c) 2011, Vernon Adams (vern@newtypography.co.uk), with Reserved Font Name Pacifico. This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. gdmodule-0.58/demo/Pacifico.ttf000066400000000000000000002234601216105026500164330ustar00rootroot000000000000000FFTM\tn'GDEF$&@(GPOS,&GSUBlt&h OS/2t`cmap($cvt  $zfpgm/egasp&8glyfN t0head7<6hheat$hmtx]kkern8ZBloca`ɢ maxp  name%~IGpost_)$0prepU9 DLr_<əəK^  , AZ aK (33f/HKnewt@  A A @ !yllayC =5  a?^@ k ^4V?.#`I! 5@:] pPyg`y @yP`kb^@|KkPP`yZ`@y`5 C5?A]a@@I@56ZDK5u`v` `^@^^ ^^[^p H54@@`@ @N4k@G@ %Baf `@j7F77# PPPPPP ` @ @ @ @^^^^ PP`P`P`P`P```y`y`y`y`^@@@@@@@@@ZZZZ``DA@^@^@^@^@^@_i@[[[[@@`K? `@^5" `q`m^_@fA`?a `@ a^AQAVAtDD@6 ~1BSax~    " & 0 : D t !"" 1AR`x}    & 0 9 D t !""pdNJ7m64bcdefghijklm  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aocdhunjsipftky~bmlzԶv݁w˰,K*PXJvY#?+X=YK*PX}Y ԰.-, ڰ +-,KRXE#Y!-,i @PX!@Y-,+X!#!zXYKRXXY#!+XFvYXYYY-, \Z-,"PX \\Y-,$PX@\\Y-, 9/- , }+XY %I# &JPXea PX8!!Ya RX8!!YY- ,+X!!Y- , Ұ +- , /+\X G#Faj X db8!!Y!Y- , 9/ GFa# #JPX#RX@8!Y#PX@e8!YY-,+X=!! ֊KRX #I UX8!!Y!!YY-,# /+\X# XKS!YX&I## I#a8!!!!Y!!!!!Y-, ڰ+-, Ұ+-, /+\X G#Faj G#F#aj` X db8!!Y!!Y-, %Jd# PX<Y-,@@BBKcKc UX RX#b #Bb #BY @RX CcB CcB ce!Y!!Y-,Cc#Cc#-KPXYF+X!YKRX!Y+\X E+D E&++D E%++D E$++D E ++D E+D E l+Fv+D E D+Fv+D E $+Fv+D E +Fv+D Ek+Fv+D E++Fv+D E+Fv+DY+KXB  / (1%:>..^  \ t , @JJ2^VB ^ #N$%%&(()*+,x-.///011N12H345D56789:<@==>? ?@AVABCDxE^EGlH IJHKKLMO\P&PRFS7>32 #"&54#".54>32 (4;:5 1+$E6 TN@=d+;3 ++2>/ֱ  +&+0 8 +?+9 98&;90+9014>7674>32#"&%4>7674>32#"& 0<.$!#! ? 0 0<.$!#! ? 09EM%Wd/! * 0srg$0/119EM%Wd/! * 0srg$0/1Uc{Y+l3 +633A22 +@  +)2cl +E33cPu22/!ֱ6 K2!6 +@! ++6!BE99cY^q99K}9901".54>;>32263>7>3232+3+#".547##".5467"&#".54>7>;!3:3>70&'CX05 &5B&  4@E!: !1@&  *~ 9_G$1W 9_F#M*  !&aJW,^3!"!#|0&& >&="KM4 )&.23( $$ 3xF]93( ## 3zG  #;,DL  ";+_f"$+E_f"?( )$ EMGIxhs+"h+|A/]U/M/FֱZ Zc +tti+( (i+ 鱂+6?>+ >. . +. +. +. +". +?+ #. +-. +>?>+@>+A>+]>+>+ ^>+h>+?+ .n. +o. +>y>+z>+{>+|>+?> #9@9^9y9z9{9-. 9o9n9#9 999@#-.>^noy ?@z{.................@"#-.>A]^hnoy| ?@z{.......................@tZM;R999i699 9(9]AB9U(Fi999"Mct$901>32#".54&'#"&#".5467>7.54>32#".54>74.'>>7)$4!QoB ).$h^`Gi@Oz  kP!7PkF+++5-tNyKKܑ.?&[ZtF&7$&7#2Q)\nRoM ( $ :dc$QPJ8"# 2 'E9_h )XiPMT,$@944H[f%A<6zd(9Dlp+UmE+ +"1+b+x+VnEb +VEb +/ֱ' '+ [+} }s+g 鱃+' EJO$9[=RS999}:199s49Vb$9nVMJ99NO[s}$9=g99bxR9"':S$9 9901".54>32'2>54.#">32 #".5467>".54>32'2>54.#"Y\.7SoT^W) +J+Tf/ z/Oֱa a+kku+ +u+/ / +@/9 +{+kJT\$9u W$9#(E$9/2>99TJ9E99f2O\p$901.54>32>54.'4>322#"'.5#".54>267.'"3>54.)#FvVI{X1&Va 9GM! !. 8BF8$CP$.- *3 10$/=5^z|?3fA|6+B?D,0L4<\#4-1Q8 4Y#^hi/QrC-Pl@8{~;[p{9 !&64;+ -?N[1=A$$ 5- 36)$(6^}H?~-#3U]qP$QTS'&A00A&!\U;-SRT-(@9+ +/ֱ  + +9 9014>7674>32#"& 0<.$!#! ? 09EM%Wd/! * 0srg$0/1CDBG0+0 +08 ++"C/ֱ+ + ++= +D+"099901".54>32#"'.#"32>7>32SyN&$C^wX@uU +12  # QvtʔT,H\0,'63%MYFvU/ &MD %. v=~=J + ++,, +,4 +>/'ֱ ' +'9 +?+, 99012 #".'4&54>3232>54.#"#".5476$d]-+RveAuU +12767>32#"'&'.'#".5467>7#".5467>7.'&54>32467674>32  U'./  ,!")HIGBDB%.#*("H$,!  U&-/+"")FJFBCB6%.#*("H",$9KKG0$,)     &('& E#c.69"  IJF. $,(    +( '& F#c/7:# &)<W+U/3 2 +@& +  +@  +,/+ְ 2! +2!+ +@! ++! +@+ +-+01#".54>;54>3232+#".58 1 !2! & 340,#""#,043 & !2! 1 AA /+ ++ +!/+ +"+01>767>32#"&54% %,8- --+:!0H )053` " 2*a &' )!!& @a2+ + / ִ++2+01%#".54>32 *@.%<+,F0SV */('=+$E6 T@)+*/++01>32 #".5467> /BR0  5{+-,*";Q`gi`S9.!#()tn2!&# F.عka"/E+$/ 0/ֱ+ ++ 1++ $$9$9901!".54>32'2>54.#"MsL&4Md{HSyA%+Qg|74.' 5-# CqSI_7?lPJb91Rjqp/'D21Phom.*G5: 5&'+/ +  +@  +6/++7+6>g+ 03# ?+ 4#   + + + +>>+ #!# +"# +0103+203+103 #929"# 9!9  #9999@ 4!"#0123...............@ 4!"#0123...............@,901#"&54632>320#".5467>76@#!^d*, ,=JNP&6$  +!:* R!! !2:2!,$$t5 09;1 :}~{7 IVc+3WH2\//9d/4ֱ$ $4 +@$) +4 _ +$+@ e+_4.9$W\$99Y$9@EK999W9\EK P$9M99.4@$901%".'".54>32>54.#"#.#.54>3232>32%27.#";;;:I4ZC&/I4Oy35(-6 9-9?.ER$*&?mSIUWG-7Q3"I,  1*;+-% %,7%=P*!E9$. $SXY+I]4'6!& "O*8X6 1PO,w=&+@,%* 4]lJ++6+^/Oִ + +2E;2_+OT99 @ ,6JX$9E>?99,>@T$901732>76.'.7>32>76&#"#".7>32#".7>32 M/"4U9  (C4&.$5 '# 7Rd48jP.+O9&3   V:Z4+L/ 3D.+.L +@.9 +[/ֱS S +@SG +\+6<+ *(>+ )'=v%+ +>}.+ ++*()()'+)'*)*(+ #9 #99@ '()*..........@ '()*..........@S "15$9L$9.9DAG99901"#".5467"#"&5467>7>322;>7>32>32#"&'+Y) 0">h\S( #!%4=-! )AC%& (!*-/! 2P &S- "& -$(h:F'7_YZuI MSA{6% 6DP*+4  =.-& .Le+5+5 +5& +A//3OP\22f/!ִ0 +0! +0+ +0:+g+6c+ .PS+ +PQPS+RPS+QPS #9R99QRS.....PQRS.......@0!AIM999:OT$9\_a$9A59OIV_`a$901.#"632#".54>3232>54.'.'.54>32323267>324*9* <4`Y2&3   "01D(1C* 3>3MM   G: #j=s+9)+) + + +>/!ֱ4 4+  + +?+49),09999!4999)09014&#"#"&54>32#".54>7>3232>q,"" -H\0.VD)>tiInC_~#,2 YP#8*+I3AE%,%/#7X=! ChHP~N+`m|ϫ; - 05e'F61M^IwXE+%+&32% + +F/G+6{++ . &) + + +4+ &'&)+(&)+'&) #9(9 999 '().......@ &'().........@<9%259901".5<7>7.#"#"&5467>32232>32(+!IgJ0<+% ** 8EK %HKN*!(/ #'( BZE<#(148)"\f   0-  Wl;1*Zv! A|%9K+G+&+L/ֱ+ B++ /B +:+  5 5/ M++B#G99:&0=$9599&G 0=$9014>32#".54>7.">54.4&'32>GpE:jP02Rm:,R@&9eR:|gC/Lb3QK_5' "?2!+1#'C1$;/;fnI$0H0W`G!GP\6FsS.@qYLu]H 4$3=::7AHe% 3L#*4A) 0!/E5Rc@?m#+ /== += +3/@/ֱ8 8 +8 +8.+ A+8#&*999.9 #*93=.99901632#".54>32#"&5467>54.#"3263G*Ba>2JbxG=nG]z$-2 dv@ 5()D1&# G<':[s94lfZC'.cm͙6 '13}}1ZE)3Ob/$8'@'?+% / (/ ִ+ +)+ %$901#".54>32#".54>32 *@.%<+,F0SV< *@.%<+,F0SV_ */('=+$E6 T */('=+$E6 TA 43+ +(/2 5/-ִ!+6+!-9901>767>32#"&54#".54>32% %,8- --+:!0 *@.%<+,F0SVH )057>7632#".킩b&3Tk8Irx%% *$-(70+isy,LP[<:E/% 1;8. $)%'( +8!#, .3]~U_'/ 2 22/+901".54>3:6:32#0&'CX0+E 9_G~ )&.  #;,jn=+#"&54>7%.54>32;ysi+07 .$* %!ixyc@8kT3%`3. ,#!8+ ('%)$ &02)%/E:?aTQB1E9+C /&& + +F/>ִ2+2>+ +/ +2 ++ G+>999C999219  &0$9C9901#"&54>54.#"#".547>32#".54>327!#5;XgX;1<2, +%R_f2=oH2QddZ *@.%<+,F0SVH02"ZiX^oJ*:%&) #/-F/'SXjpUQX= */('=+$E6 TpZ 8|+| +| +//d<  /Hp//ֱwwA+  4+2a +_2a4 +@aX +ak+% 鱔+6=v&+ ._ Z[_Z+\_Z+]_Z+^_Z+]_Z #9^9\9[9_Z[\]^........Z[\]^......@ A9474>32#".5467#".54>3232>54.#"32$7632#"$.3@zn\C%?C-QE9+%0[ap@ 7WtX-$&_ls9Bw[67es30+!" %JE;,UqҦt=>o`hcBk:KQ%=LNIrĥwB"Go~6DoC(F86 MtP(,WVWO   >4(enqk^$- -Niy@Ё9hnYf7I> !/9V9ZPH_+X+A+"+L`/ֱUU +_2< < +@<2 +a+6=Z+ _.I84584+684+784+784 #96959I_45678.......I45678......@ U9<"'*+L$9AX 99L2HU$9".901%#".5467#".54>3232>7.#"32>7PAQ^bc. A5" 8U]K-Vz}")860$&//, =EKE<Z#K#Qu^D$qwJr_G. 896*;hS#Q/qukG>ey,gn$+G +ii +i +]$ +]+o/,ֱAAL+ L +@LU +bL+ p+A,n199L $35]i$9G$,9?Q999]U9i135$901#"54>322#".'.546763232>54.54>3232>54.#"ZAf ,8eaqҶMCߜcd2"DfgA?+4XQG:I1.A"=FU|K,G[_[G,% +G)`m;.SpKyC\{2vvebyU7!vS/snm2)Yl:M4%7, /Pk=(C5(  +D`@Rq +K+=3#  +33# +3. +S/ֱFF8+ T+8F #)K$9P99#KFR$9=3901#".54>32#"&54&54>3232>54.#"32>71\^euzٚS(KloHvK/RoE[Z  @iC6U=H~q`M63^UjZRER[YQ=$m\ȫH3jnJzY41. ' 8fU-Q=%?lHgf25Vlmc"N_+2+>> +>F +O/ֱ- -9+ P+-99!>$929>99012#".'.54763232>54.#"#"54>%R%8j/b\R 4bQmU%.>* '!dyU.LsTkI^ ,3[}6`\~Ԟ[ \ow>>WBbJ#%2 O^tC*A-q{ebyU7@W+P+/F +F%+X/ ֱKK +4 4 +@4@ +K'+ Y+'4/FP$9 *W999FP W999@9%:9/ 499901%#".54>7".54>32#"5467.#"#"&#"32>7QkvМ[Inl64[|Quj1DKhHCz]7'ATZWI2*=M#PzK+Kf;G~`VW,7qweX?kPK|cJ13ff$F7!%!hN,$7ZB6J4!,!+83)QwOKd=1CMU+tt+E+V+3" 2" +" +2/;E +>3//E+u/ ֱv+6>+ >.@][>+ lp,)?+ mo-+}+  . `?+ +  + + + +?c)+ ,*,)+-++,)+-,-++>T+ @?@>+[\[]+molmlp+?j+ nlp+lpmnmo+lolp+\[] #9?@>9*,) #9 #9 9999@]p)*+,-?@[\lmno.....................@>]p )*+,-?@[\lmno.........................@ ETVc$9VEL9;Q^99/ck99" 901#".546,32#"&'.#"!2#"##".54>3232>7#".5467>7>7-+:A{M3' % A[K#(+  + *Np}g.E^n@FE6" )!INR*!>72,&{2. 8TA2 WT( Ո@4*$   2N{x!00yàr?"-1."5]}O   kr@FPV` &k#"+R+ 32.+FF. +F9 +]g". +]l/'ֱMMC+23 C3 +@C> +CX  X +Xb +m+6a+ .   +++ #99 #9 ..... .......@CM".R$9XU99"9R9]9gM'9901#".54>3232>7#".54>$32#".54>54&#"32$7>54.#".54>32&BH*/[QC0ktSUPe9 <$ XBQvE3U u %&9((=)a}GUt֢_"-1."``,O;#mCW0fl*S*/'$-$$'ddCgf2UM7# *'(Nqb +,3y+f+TTf +T\ +7Gf +7G7 +@GA +/Oֱk Ok +O_ +k+ +@ ++6<+ su4+ <+ stsu+-+ +++++++++tsu #9 #999999999@stu..................@stu..................@kO#p99 9(1997 %'5$9G# $9T?kp$9y~90132>7#".54>7#".5476767".'.5432>;6767>54.#"#"&54>326$767>32>7>32)9BFZoD K7?lO. #z73+E/%.$$;:*7eVC.$/^6`$!) 2%O`qB'1Rkqp/Fa9$1g3{EK3' 455?^ %   $E1jNDM>bDMCOxQ)/ZTXpJ Tu),**J9,)-]Vp:5j0'B.-I65'4^OA-&T`-[e9D '=#>M JL.+=!2.+ +K/L+6=+ =.C!> + @=CC++++!!+ !+=>=C+?=C+@C@=C+=-+ @A@C+=B=C+=C@B@C+>=C #9?9!9 9A@C99999@ >?@ABC..............@!= >?@ABC................@=D99 9010"&54>32#"'2*.54>7>76>754Usco8 *TI!!*" )7$+8?4"H]~h?@Ze'?=;84%8,'*1|G< ',,$)*!mՈ  *( "ά@ @6FZ2+:T+[/ֱ7 7 +G GO+N2 2\+6?+ N.L +LMLN+MLN #99LMN......LM....@G 2:99O?@$9+9T: (+@$90146$7.54>32#.'#".%32>'654.#"@g Un?-Ol|DZN=}@ '%8Y,{LOd9OAB5%f[1@F~i3E&%LH@/3EPfY0\ۆ&H$   *&x<@=fitvc@PJ3vf-$?T_e|faC+U5+(UC +UP +x+]+  +@ +/nֱdd + 鱁+6? + ].Z~ ?+ ~+~+~+~+?mr+ Z[Z]+\Z]+?+ ~+[Z] #9\9~ #99999@ \Z[~.........@ \]Z[~...........@dnCPU999  (5>x}$9(C./99 U%-<>$9] i$9xv9012>54>72#32>74#".'#".5467>3232>?"#".=47>32 hmI%55'1 Coݐv;M B2>&\_^(t&D]p}AHoWl:?9B*5q'jaD #G!ZtYB/ XpQ51+8A! mC'1 WIVP 'Iy{2;  K qpK%pD6*'6 '-(-Nx~u0ݺW &-n'=S*H_hm1 ÆR,")AKPK_<+$$< +$+ +Y/ `/Aֱ A +@AI +V+ a+6[+ &': 57:5+8:5+9:5+9:5 #98979&'5789:.......&'5789:.......@A<99VL9 099$<D9YAIL$901>?6>32327%67632#".5#".546>7>54&#" >Ta/bE2T<"8gm$,MO $ $bf,aeg0J_7Vx H3omeQ7 V^`R=G )8C"D_ԏG&LrL]C=U$%  ` *&!'  3W@?J&/%j5}<%94C| fp+33_P+>3+2- +!P+3/ֱ2 322 +& +2+C +C+~2U V2\U+u u/y3\ [2+6>[+  ?e9+ 3.5>+ =+ !?+ y.V.y[ V~ >>+  +?+ +5453+>+ [W[V+X[V+Y[V+Z[V+yzy~+{y~+|y~+}y~+++>+ ++>+ +++>++ ++  #999 #94539 #9zy~9{9|9}9Z[V9Y9X9W9@# 345VWXYZ[yz{|}~...................................@ 45WXYZz{|}..............................@279>999CJK99u9\P9U_p99_p 9!7JKfku$9(2CGU$901%#".5467>7<.#"#".547>32>327>3232>767#".5467>54.#"#".54>54.#"*01&*ELL  $[ei0>R0  Wgt{~>.N8 'rX=_@""'"+)33254  2jnq86gP0!$"5^TIA80*!+0)%+%)"HSXWQD4b& !)E#uɴh !8K+  v_(/UxI8Hխ|D(TX",3bD$LzZH+)++<\2<pd)+{/Wֱu v2Wu +Wi +u0+70+ |+6>,+ PSy"w>+ v.xU#PSS>+ PRPS+?3+ STSU+ywxwxv+xvyxyw+RPS #9TSU #9@ PRSTUvwxy.........PRSTUwxy........@uWEFz$970<99 )9HEM99d!"04$9< Y7ku$9016>3232>5#".54>54.#"#".5467>7<.#"#".547>32Eysk2:R5" !1"0kg]G)< R^ino6FjM4 $,$ (UYZYWQL!I-1&+$9=? !U_b/Ga<&0/׉N8Xj332 '2>54.#"Z9UqpW5fvPs_J7$*UV\~Z29kz/`i;lq>lB`}HYhqÎQZ`%h-++b?+G5? + 3GX2i/ֱ&&3+ 23 +@3: +]+ j+3&I99Nb999]SX995-999G&:99b?NS]$9012#".54>32>=.54>324>32>54.#"UL7OiMRaC*:l( +A13H0S_0    !6 2P;&= b]-+je^=[ibvI=4+ Fa9U\&ԘS)SGq./!2.3"# MclZ; OBZl98u`>M`s`@:Tf#/ + # +@  +I/6U//ֱPPD+V+DP #*6$9999 #9I(/;$901 326767>3#".'.54>322>54.#"`)S݇/IFL10[%+' $ "=Ugu?LjK1($؊@3eWLnYF4"(R|TUtS.4b(u/XE*2#.*/#4=3":[ojY  jrf?lBrÏP^ovɓS@@@{+,+M:+A^+d3r&,^ +'3rr& +@rk +|/3ֱH Hc+ef22o co +@cY +ow+ }+6?A+ f.Qr#(+ $"  ]+ #!   +   +#"#!+#!$#$"+('(r+?+ QRQf+SQf+TQf+cQf+eQf+RQf #9S9T9@c !"#$(QRSTef................@'r !"#$(QRST...............@cH,V99wo:A$99M999&3H999rVY$9A^w990132>74#".+#".546,32%"32>5.54>3237>32>54. BgsF^?%,%"QUS$t&D]p}AIgH0$&4'?3232>54.54>32#"&5467>54.#"MM:eY}o)=H + @jJWVMMQhǜ_'+*c(&7aQZY+ BhYPUazcZx\<={|@aA!#%&-6 FfB *RwMGp_TV_rZTP>r`9xA?=##G.,M!3M4)AP?#++/2/ +@/ +;#+@/ֱ6A+6=+ (++++++()(++*(++)(+ #9*999999@ ()*+...........@ ()*+...........@;#-9/ 99014>32#".' #"&547>7#"&'&E}}0'(Mf8CID;!),9J +:JZi=5mgYC'A</ְ20 0 +0 +@0& +?+6>+ ..$,> P+ -%)<1+ -),)+++=+ ,*,)+-+-)+-),+,)+,,)+.-.,+*,) #9@ )*+,-............@ )*+,-...........@5  99901>32 #".54>7>3232> 1=*Bx}y30='&&&;( )02(GrTAug[L=. 3># 4(${jywS:@% %}WZrAG.^IgC+7/,J/ ֱ  I I/ <+' +'< +@' +K+IGH999C9,7499014.54>32>3232>767#".547#".[ ,0%/ ,"0:$)&?T[]* ?aC'*,03SHDiJ&;g`Z,=+ /1DA?;+ 04B&?04/0/1+/10104+?H+ 204+304+B@B?+DAAB?+DBDA+>+ CDA+CDA #9204 #939@B?9@ 4/0123?@ABCD............@ 4/0123?@ABCD............@b jy$9&99J PX990132>7>3232>7>3232>7#".'#".5467#".54>7>32`!2:2!(<))MHB=6TA !.=(&1  2%@iWE5'0= )%+%%3=8/JE!:-2sK_S& $msBx[7-B*245$ "WG{[40TtL U7J,"gXZf6d٭13>" -#a֬v'7$0C)Ub,F0]i9d0T!ͺOWjh:A#ug+V+E+g+v/4ֱ- w+6B+ [!B[+[+!@!B+A!B+\[+][+@!B #9A9[99]9\9@ !]@AB[\..........@ !]@AB[\..........@-4(HJ999E>JOq$907999(901.#"#".54>32>32#".6.#"3267632#".'#"&547> -=O2)5:  (Ha92ggbXK1nqpeX!4%kT  9FQVW* *" ,?0=Y"Bv08ZJ?;:!l^(RI:Y1ED/NcqpeN-7zxmS1$?S.*41) JnH$-TćJqS/-I^0`a")")Hbr|>x̥}U+x#+OxQ);i曢7.#"#".54>32>7>32fBm[TP,(RD/  <Kx`Lo/#JPSWZ-   ';*rB;m\I E((SqL SxO-$0/ 5Tkc#Xe9   0Pg7$skϴ- +*=5wacP+=_/2 32d/e+6›+ ..++++ #9999.............@=P[9_ 4 DI$9.9(9%901.#"#"&5467>32232>32232>7632#".'#"&5467"#"{5R@3"#&:CSX',VY]2%A[k9*%tß|Z9 3?B>QiU%) $yWBne3e*6C3<1 !'A1=-! [  80!qԼ`"17&/"PH2'?/-'81&d:<@9*//:/;+6?EY+ 25'+++2325+425+325 #949999@ 2345.........@ 2345.........@*/9901>3!2#!5!2#!".5467>7"7&:R8>% '-   *:"6E' $#!,785( %+!RʷM 0-!'2;[rH#+$/%+01#".'& '.54>32VfongV>>,52+{̨4)*SB澋.F1-'It#=-4?=8)+/9/$ִ/+$/ +@$ +:+6?+ 3+++++++43+53+63+73+ #9999999739596949@73456...............@73456...............@/$9901%+".54>;4>!".54>3!2&:R8(#*   % /Z6E' %"!!9785("'( RٳM;+&'2<[h]@,#".'#".5467>7>32  2'B%#+.,"-q59769t**.3)( *BSVTB+cY "=1n.+ 2+ 22/+9013".54>3:6:32#0&'CX0+E 9_G )&.  #;,@@ !/ +!/+ +"+01#"&'.'&54>32"# (2751%)45 .'"  %2=DE?4-2$"hZ&NC5@8J +>+1+DK/ֱ9 L+6>a+ D.C+(--,-++,-+ #9C+,-....CD+,-.....@9 9>9D189$9)901%#"&'#".54>323263232>76732>7"M`n7BX FSZ-0[F**XexE    ".//12%<,K)NE:8 VN6UQ:/'IiBKd;$0u{7/5"+6D/%@Z` G)FZdI<YnI+NI2_+2=2 +=o/Zִ7 +U  p+6?+ I.C&)(?R+ ,.h*d,-,.+IEIC+GIC+>+ hehd+fhd+ghd+GIC #9E9-,. #9fhd9g9e9@ &(,CEGh-.defg.............@&(,CEGIh-.defg..............@UZ97 99N$L999= $9<99_7j9901>32>7#"'&'&'676767676>32"632>54.4.#">8].;\@"%$JKL(M7ms}F;!& x95   5QcuDL\2GrFj#F<- !!@"8,  3; +*(&!CDA5#%FU4Vp=3[WV.(0;(2J7("!%'QfYXcx\n4YxD_UT=0]v-#(#  (CV][&-"9ak!4py@9R+- +!:/ֱ( (+ ;+( -$99!-23$901!".54>32#"'&7676'4&#"32>7\^0(/E[pC9aE'410  ):)( '>10tuj&EKW%W_gDrQ:ynS1#>U1"BY ': '?sNG$NA+;Zl0tkT$D5!6ZsD)+ +S`/<t/.ֱ +62m Nm]+A +u+6>{"+ 6.8d+b=@q+ prF,D6768+FEFD+dcdb+pqpr+768 #9cdb9qpr #9EFD9@ 678DEFbcdpqr............@ 78DEFbcdpqr...........@ )99m$99Nf9]S99A<9 )$99`S.AZm$90132>767.#".'#".54>7>3232>767654&#"67>8BgE$ ,##  GE@>;7AA%SY[.A_?!?ML(BYjx@/B) F^7T -237< 4( 90)"& i|2( %.:=}PB*7+# %F:$A08]v?@{n8O1Qk9#%u@(/14)!(3F)6*Q~r1[K8 7yzvZ9'6N+ +07/ֱ( (-+ +8+-( $90 !($901!".54>3232>72>54&#"^^/*-D[qE8`G(QlW!<~p'Xc+cmu$UIF!+=)!DsS8xmS1$A\9>nV$0HU&[F:-%:b -: 3A`>D@?Wi+/ 2+ +@+9 + + +@  +f/ j/ְ2G E2GQ+0 0c+ +k+6?+ .EB+ECEB+DEB+ #9DEB9C9BCDE.......BCD.....@G>9Q9]^$90 +2`$9c f99 +&@V999f%^999014>>32>32326767#"."32>54.>54&#"D'5I^uV"K>)%C[lw>   c4=-B=GF$) #2CW77R:'     ")-8$!!=dG#4&ph6YA;O /!,$( BG=M :TfhaK.2Uq~J-GUIZ>_q4#fxN6xn7sڿ&51K`IVf9+Sb+/+Ng/h+6?+ ZW  + +ZXZW+YZW+YZW #9X9 99 WXYZ........ WXYZ........@9b<99S;999N$9/$%99012>767>767676767'>76'&'&#".'&#"3276763#"'&#"7>O?jL=& +` 2HGAv!- -,   4szTj49'HI8YĠ6  mK˜}F^kx7_O&_4Bvi8T/J;WVm*AeF6AD$ _ruRf!+83! +@ +X+FJ+g/VִK +K & &/ h+6?X+ @Bb]@A@B+b^b]+_b]+`b]+A@B #9`b]9^9_9`b@AB]^_........`b@AB]^_........@V&X9!-.F$9!5=999X&.K$901>3232>767#".54>7'#".546>32>54#">)fm0 &j%664757CNOO$7Q4Qfm, !&7Swh6E)*EX\Y"m;5fE @>7n6|G +"DI(0 )3A*/0%;[l0 OPL<& Z[-C+&?P*C$t :Q2Jǻ?\2L7vuq3wr?`*<D+%+:/0 =/ ְ 2" !2" +" +2+" +5+>+6>1+  .. !--=S+ .  + +>%+ !!+!+>%+ !!+!+!!+>%+ !+ ! #9@  !.......... .......@+ 95"%0:999% *99901%#".54767676767>3232>74>32#"&$k|:4G,*"59*.$XZV!A-K8#>.0I3XT!K?*4K-?T,~& Siys.-52GLM:3#!6%"@2S`3GYi+//<W/M Z/ֱ7 627A+( +'2(A +@( +((R+H+H/R+[+6?<$+ 6.4/h+ '.%C0F? q+ +f+ %&%'+?t+ 6564+K4+ FDFC+EFC+ #95649&%' #9DFC9E9@ %4F&'56CDE.............@ %4F&5CDE...........@A7/999(#MW$9<(990114>7>32>7#".32>54.'&4>32#"&  !&-1# 88h|lB6?<)GkMFb=$!'  [-K8#>.0I3XTQsb * 4< -0$' AF3+_/Qy/wִV +z+6?Gi+ HJi1f=|+ HJJLiff2d>r+ HIHJ+=+ JKJL+fefd+?@8+ igif+hif+IHJ #9gif9h9KJL #9efd9@ HdiIJKLefgh...........@ HdiIJKLefgh...........@Vw$06Q3$9$);99@ 06:C^k$9_n9QV901>7>3232>7#".54>7>54&#"#".54>7>32">7>54$VSTZ73&7/+ .B@=w)+  A3? + +A@A?+A?BAB@+ ?@AB........ ?@AB.......@ 99%99,-999%-9<,4$9901!".54>3232>767>74&#"_6]E'2EWfpz?+8 +I`hi.  17:?ERYW&QRN!-eZB CC=0_tYγL'@Q*^ýZ %*1'#*7@2)  P[)K`yYh+u33[!+8P33z/mִX +{+XmPhpq$9[h c$9!@ 0Hbmpq$901%4>767##".54>7>32>7>32>7>3232>767#".5467##".    8WE5 )2   &+ 19BA-*<  4=E:*/A.0.10,WatI$1 @* & 0>E"P\  cbl)(71-E|{E6D%.:#K='/TrC?H*#7BN>+J3*+3O/ֱ  +@ + A+' +'A +@' +P+ J999A99'>DE$9*>89945ADE$90174>7>323>7>32327676767#"&5467##". ?66* "'" R22;  ! ! ,@Po2X N277K !)2 BϦ;.>B73=AS) 1\GA2 6(TJ 4HrZX%>P ")3J&/D#32.'2>54.#"1G[l=X}P%B{o_}6\gd$"@0,)J8 "8:Q;xpbH*M|PQ;cD$TfGEi:.O:"FmS*J7!N4H` ++N)+Ba/ִI +IZ+X2 ?+. +b+ZI"R999$5GS$9? )4B$9 NIX999YZ999B"$.5$901%2>7#".'#".54>767>32'67676767>.#"32>7>767em, [lw:4aS=fG9L-,7DW #IStR=jP._Zx<,* 1! %!%8)%$  (D[4'I7!  r8_G)gqu7NfNRN6K!W^^Q;  2CR+L+5, += +=+S/ֱ9 9+ 3I +9Q+ +T+6=+  .HF  +HGHF+  #9GHF9FG .....FG ....@I999Q5=>3$9#(+$9L Q999D9,19=(95#&/0$901%#"'&5467"'&'&54767622>7&"&>7&62767654#(TJ8>P8[89(T,,?LB! ;]b\! WS9( )YO  b8MM6p;Ade)W2gf^^<OEr(:hQQA*2GL 2MyGK!M5I'[E(IdcD=@+ +34)@ +4E/F+4@9)/9 .9:$90174>7>323>32326767#".'##". $   7>32>7#".'#".54>232>54&6&'`8FF)8P@ '/04&.)  $SZ_0>R;fM0   &2 '3  0@U6JkP"! :6- 317H~@'*3$0T@%/L6 ) y$+98S-Qc+J#+W4:# +412 d/ ֱE >@22 E +@  +ER+( +(R +@(7 +2e+E  99R#.;-J\$9(/099J9: Q994 .7999-/\_$9W(R99901%#".5467.'.54>7>322#!32>74.#">`u[%LtN' !%96 '=IC5 SgzC+G20A$ *7@<4(;&7"?KSQJ 51+A4"8T8\<7626J/#09?! \Q3wsd[U])+3H 29+S3V/.ֱC B2C. +C< +=2CP+ W+6?&+ B.4B0 4= ?*+ P.O-+++0204+304+B>B=+?B=+@B=+AB=+204 #939AB=9@9?9>9999@02OP34=>?@AB.................@02O34>?@A..............@C.)9P$9 99H)$999990132>7#".'#".56767>732676767>32w !  ?GJC7AOYZX&&6' $PSU(!:- &3 5.  .nG-3<]ofM/#%/43!614 22.#6K./O:!4U?Ff3<>2 5b<! )!!$pFEb@+ + 3336-@ +6F/ֱ + G+ @999-63;E$9 299901.546?072327>32326767#".'#".' x "%' ':F - 4)O#)+B@6U;!JOO#:@ DKoZL(s(i /%3l+.%*2!8F&<~fA;Zj0HV+O3!+*33!+E<! +%33EW/ְ 2 T+% +X+6?+   + + +  #9 99  ......  .....@9T99%O97>327>327>32326767#".'#".53OZ`.NI'5%,/P ,K73C7$#fцdB!#>+/%@7'(l',# *24S;P`6+Ialr64V<I+Q38I++W/X+8DL993?BV$90132>7&'&'&54>32'&6767>3232>7#"&'#".'  #, 3P'/7< >K,# V>b^-*'?GJC7!hH)}H+ND<2@'7'0B':hu(" W(62 * ;68Xb,N:!%/43!614 !QG1o|2U@$4Q_,@^dt+!! +! +G+j+V-+u/ ְ 2 2 + +v+6>[+  . 4?+ rePL?9+ &'7 2  +++7372+472+572+PNPL+OPL+?q+ rsre+tre+ #999sre9t9OPL9N947295939@&'27LNe 345OPrst......................@&'27LNe 345OPrst....................@ Z[ij$9!9EF$9->?99017#".54>7>3232>767>32>7#".'&7>767>32>7>6u70[F**0V)#2#%%<,P6:* FVjB0"2Bp &>Kj?3WH.B% #F[BF(!B&  y0;'IiBW{?-/#% .}~0/%@Z` v!% Zr?2T_ " .5K_%/Wo]\A(0S8jvB30/&O`2r` %CA6Fe^@S+@ /  +  +_/`+@S9 3GL$9.90174>7.#"#"&5467>32232>32232>32#".'#"."A ** 8EK 0/1!(0 #$* 8IYG5 ".3*E;3/. ,Jbko1"8J,&,  0-  Wl;1*" Pb|[C &+&#?<6) $. `&0+13C0C +05 +42G++ + +S[0 +S #+a/Nֱ& &+ HH/++H ++: +b+6G+ 1.?1A?4ğ+ 1214+314++ A@A?+214 #939@A? #923?@A.....1234?@A.......@NH\9+!`$9S0&9[!99901>32#".#"32>32#".5467>54.#"&54>7>7HgH$fnm, !,CMO$ 4*$ 1QB(6  #$@=;";Vf`N=`B#!$<-)$ -@Q2 hau@&! /& EyaKb .AQ-9zk#*6!  ("7+ 0Y{KTX$E6"=*A5#!@_?@-+./"+%&22 + 22/+6?W+ %., ?+  *  +?EZ+  + + + +  +?EZ+  +  + +?K+  + + + +%&%,+?:+ '%,+(%,+)%,+**%,+?-+ *+*+*%+%,+*,*+?-+ -*+'%, #9(9)9 9999-*9 999@% &'()*+,-.......................@'()*+,-...................@01>32#".5467>,?)$  ""!)36'"%%#9.%(   :0,<',:!"ع@a0+++[+Z+IIZ +@IN + [ + #+b/?ְ@2 2? +?S +?D C3`2c+6>@+ 37?\+ @..@!C!?2+ +++++3437+537+637+@A@C+B@C+437 #9596999A@C #9B9999@53467@ABC..................@53467AB..............@D:9 :9I?`99ZS901#"#".54>3232>7>7.54>54.#"#".5467>32 %?/'$-/D/  HgHHVZI.*.459$ 4,# 2Q@(5  $$SOG 6yug$=`C#+``Z$#4$B-?3 1;?r?bwC (3 '9%H|aCxV2BP,5{wh#)6 "4!&/VyK5//* +0/1+0167>7>32#"./#"&547>32  ;"1 &9L1/05%f  ;"1 &9L1/05% $ &#GC0$7$e# &#GC0$7$@"8 +4/* 9/7ְ%2/+:+6=r+ +++++ #99999@ .........@ .........@/7!994 901#".5467>7>32>32#"&54A (4;:60gĬE0;! %/uC  =*.'(>+$E6 TN@9voQ`Y+a/JֱR RB+CD224 +4+ +,2b+6?K+ C.55 5 + 5 +5 +5 + 5 +!5 +"5 +CDC+?+ QC+WC+XC+YC+ZC+[C+\C+WC #9X9Y9Z9[9\9Q9"5 9 9!999 9 9@ "5QW\ !CDXYZ[...................@ "5QW\ !XYZ[.................@4 99%901>32#".'>7632#"&#".5467.54>7>7    8[A$*#  !5l&  &.'h;    Z[/3LcyH 0& 9D# (! 5);K*"B5 ,51'v=# !5'$"ErQ6vskT9 G>.=DXd_ c!&+%32>+34 322\/Fd/?ֱc c? +@c +c ++/2+ + ++ +@+9 +cW+M e+6?o+ . .3c+ .%6! c+ $ %!!?b$+   +  + + + ++ + ++K+ $"$!+#$!+$!%#%!+$%!+?#+ ./.3+0.3+1.3+2.3+/.3 #9091929 999 9 9"$! #9@!. "#$/012..................@ !.3 "#$%/012.....................@&+9949\>MR99012+2>32#".5467>7#".54>;4>32#".54.#"70 #>1 [pe;7. 1#+S>P/ t#* 3)p0SoC)WRH7 &%*:""JG@0 0'$6zzpW6 &.&-;!(R#&x3%% ( ՠpF .FaA$2 !(. %Bjh@[uWLb/MY/%c/ְ2^ ^ +@ +^T+8 d+^$9T"%I$98*(6=@E$9M =IJ$9Y68$9%"(*2$901"&'#".546?&5467'.54>32>32>32#".''2>54.#"M3$MG<%).JK_$'2x:QN3#B:0%)s%.D,c9#29=3t#9[G4!1H-TZ/;S+(7-!0ibzy[V+$,j #(&.#"0OViBu1Y4&%-9,Kbkl0.R<#Dw`<_B#N|z^+!+%/ 3/22/x3<m2D/Q{/|+!9D<GLVl$9QZ`e999012+#".54>323267#".54>;7#".54>;.#"&'.'>32>7>3232+0* 'I=;<@DG&4' * +^.8 8/0: :0#&+05#_ 2*<|wl,T~_HO~d #(&`|Kv2+ (L?#!"X~U3(& lZ ` U\4]d 0,GmI&֨s1  !?(-i"`4^(>%N=+O/Hִ  + 2P+6?f<+ H.N71?t+  .3% &3 3 +?Z+ 3 +3 +3 +3 +3 +3 +&&%+ &%+!&%+"&%+#&%+$&%+7271+471+571+671+HIHN+JHN+KHN+LHN+MHN+IHN #9J9K9L9M96719295949&%9 9!9"9#9$93 99999 9@ &3H  !"#$%124567IJKLMN..............................@&3  !"#$%124567IJKLMN...........................@ H099901>32#".5<7>>32#"&#".5467>?A#+   !'0&$,+" "  ' @>/F-  F\kke('7#(9" *hptj[#5#)>) twK ',:!"*?=D\}[m +  +  +C/N/9n/ֱ  + +.+d 4 S I+F2> +>I+% %/ > \ \/ o+d19S*a99% 9NW`i$9\k9IC99C .ak$9N14>W$901#".54>3232>54.5467.54>32#"&54654.#"4.'>H?QUWN,3$/*F[1$I;%0OeidO0IL&/:ttFrG ("4 'BV.2F,2RhmhR2HpB #*FBC&> ,)),18l#2+3! 2+$/ֱ +%+01#"&54>32#"&54>32 $7(>O';*GJ- $7'@M&<*FK'*$EO!?0LH'*$EO!?0Lk Z1p>+QQ> +QH +/2/]]2 +]d +&/ q/ִ- +-7+X X7 +Xi +XN+C +C!+ +r+NX>999C& H999Q]!-7$901%"$.54>32'2>54.#"7".54>32#"&54654&#"32>7632BY3drfA/]zceD"6vjqM'A΄PxQ(-BVj?2T<"!0' (:'  5):<8   +3,r hy^o@/SqL_sC6^~IZzH4[zKZ~J9`~F2nlcK,6I* >2'#1'322632>76732>?"BT^09L=GN'*N<%$@Xgs<  ())++F&  55aK,KC/JF2)!?[:AsW3"*ejk/).&.;{) *563MsI,Y+D3Z/[+01%.'.54>7>7>32 #"%.'.54>7>7>32 #"~MlSC#($3F(.@J@, )21 +()MlSC#($3F(.@J@, )21 +()W-PHD!&J$"B=: .5-%9# &0 -PHD!&J$"B=: .5-%9# &0  8/ + +/ ֱ  +@  + + 901#".54657!".54>3!2$  ."4#w2-a!2!,!%.G&1+V+/r/g 5+&/ /ִ- +-v+e +e+[ +[!+ ++v-R$9e&SV r$9g9[lo99!m95ro99g2mn999@ !-$32'2>54.#"32>7.54>3237>367>3232>74#".+#"&'32>54&#Wa5hyėmG!2`ikH$4p{|ԭY.H  )" #'%!=CeB!'MqK"# (,,'3Sh6./:DS5@ 1P7FK&udǶtB1XwQiī~I=kT^K8bQdT*+DRN>  >HK<'%?Q,*TE.4=@4!#q(0(=\k\=en:)(#M%-(;@`%K+/+&/ִ +#+ +'+#99 99014>32#".%"32>54&@Ip;*SB)Ae{;*[M2]2J2),E//%MvO)9V:YW*=d 1>( #6A)<W'%aT_/3EE +@EJ +UZ/++//6`/1ֱ 1 +@ & +1 ] + +=a+]1+9 UZ$96W$9=BE999UP99E O99ZBW]999M99+1=99901"&'".54>32>54.#"#.#.54>3232>32%27.#";x:7~G3W@%,E1Ls2.?%,-!(./GS$%#99C990132>54.'.54>32>54&#"#".54>32#".54>32++#.E/ /! '    (CV./[G, %B69Q40UvFKkC (.(!+%).>' !)-  $*=(/D+0/+ 3DP**TC*!;R2)  f@  !/ +!/+ +"+01>767>32#"&546p!'. 54)%1572) "" 5CN&Zh"$2/2?ED=2%  X'/M 2M' +@MV +MM +@. +Y/1ְ22Z+6?+ 2.4+ )?)+ 37+)+4B>+ RS(++++*+)++)*+B+372324+3437+?@+ 537+637++C+B+D+B+E+B+F+B+G+B+537 #969F+B9G9E9D9C9999@)RS*+234567BCDEFG......................@)RS*+34567BCDEFG.....................@M'$90132>7#".'#"'#"&54>7>732>7>32l   ?GJC7AOYZX&&6' 1w;  945+!! 7012  .) cG-3<]ovfM/#%/43!614 22.#6K.HS R{R)?A0ʷ* , 5}b<!+?(!$`L+H3.+M/N+6>+ "'>D+ B(@>+ A>++?DV+ ++ + + + ++"+"+"+"+ "+A?A>+B@@A>+BAB@+" #9999 9 99 9 9 999?A>9@  " >?@AB.........................@  " >?@AB.........................@01%>7#".547>767".54>32#"&54!$[*  !(-#  !x88egv19!%*%%&! !)-)<nϽNB< ! QwJBjB32 *@.%<+,F0SV */('=+$E6 Tj` / +/++01%#".54>7>32 !-6(":N,$.g}G %8&-*[j|K7`@0/+ +@ +21/+ֱ+ +2+6>+ +.0!7!+!+!+ !++,+0+-+0+.+0+,+0 #9-9.9 !9999@ +.0 !,-...........@ .0 !,-..........@+9901"#7#".54>7>327#"&5467#>767  Np',#.% 0%5B*F!"! '943&-3 aSa[F!_'F //(/ִ# +#+ +)+# 9999012#".54>2>54.#"=[;1]XLlE Cr7) &$?0 0_6[wBW[BlE_zFh;[n2(D3=^r5$@0I,YC+3Z/[+01%#".54>7-.54>32#".54>7-.54>32")(+  12) ,@J@-(F3$(#CSmt")(+  12) ,@J@-(F3$(#CSmW 0& #9%-5. :=B"$J&!DHP- 0& #9%-5. :=B"$J&!DHP7@!RV+/^33鴂+ +@c + +@ +@ +%/&+%& +@%( +"2/Mֱ@+A +A[+ 鰤 ^ +^/ +^ +@ +^ +@^f ++6>+ M.RC7<>++ mp|zC=C<+>C<+?C<+BC<+MNMR+OMR+PMR+mnmp+omp+|{|z+NMR #9O9P9BC<9?9=9>9nmp9o9{|z9@?MPRpz<=>BCNOmno{|..................@?PRpz<=>BCNOmno{|.................@@M15$9[ :aq$9^u9V999V[af$9i99j999%@  FLu$901>32#"&5467>"#7#".54>7>327#"&5467#>767"#".5467"#"&5467>7>32;>7>32>32#"&'$( /,qg8#5 1DQVXQF  Np',#.% 0%5B*(R&-9aUM%  "09* &3>"#/ %'),  .J #M* &;#Kئ!0,1Xxy!"! '943&-3 aSa[[( #]3>#1TOPZh@  DI9m0! 0=G% &.=.)'" 7!RS+Y3S+鲘S +@ +/3c+n/@2%/&+%& +@%( +"2/Mֱ@+A +A+s s +@sy +^  +si+鱴+6>+ M.RC7<=C<+>C<+?C<+BC<+MNMR+OMR+PMR+NMR #9O9P9BC<9?9=9>9@ ?MPR<=>BCNO...........@ ?PR<=>BCNO..........@@M15$9^:999 ~99s Yc$9iVf$9S999SV99^99999cf999ni~$9FL99% 99901>32#"&5467>%"#7#".54>7>327#"&5467#>767"&'".54>32>54.#"#.#.54>3232>32%27.#"$( /,qg8#5 1DQVXQF  Np',#.% 0%5B*;x:7~G3W@%,E1Ls2.?%,-!(./GS$%#+ .=v%+ +>+ ++++ #9 #99@ .........@ ..........@"Q09<%/7j$9*V9[`$9e $9$9Ɂ$999$9j$9%9t eo$9?/[`$901>32#"&5467>32>54.'.54>32>54&#"#".54>32#".54>32"#".5467"#"&5467>7>3273>7>32>32#"&'$( /,qg8#5 1DQVXQF++#.E/ /! '    (CV./[G, %B69Q40UvFKkC (.(!c+Y) 0">h\S( #%4=-! )7C%&4 (!*-/! 2P &S- " &;#Kئ!0,1Xxy+%).>' !)-  $*=(/D+0/+ 3DP**TC*!;R2)   -$(h:F'7_YZeuI MSA{6% 6DP*+4  =.-& B4Hr)++F/< I/.ֱ . +! +5+A+A5+ +J+5 399493232>7>32#".54>4>32#"&L7!#5"8GKG8"$0<90$$R_g1=oH2QddY *@.%<+,F0SV02"DkYJDDLY80?&"+ )  -F/'SYjpUQW */('=+$E6 TP 'C|H$P 'sH$P ,'$P'i$P'ic$P '$ k}+d+vK+I3ST2H+=/<3)*2=) +=6 +=l ~/ֱss +_ _ +@_N ++6>+ I.DT2YC+ <.:*".+*.+,*.+<;<:+-+ DFDI+GDI+HDI+q(+ YUYT+VYT+WYT+XYT+FDI #9G9XYT9W9V9U9+*. #9,9;<:9@ .DF+,:;GUVWXY.............@.DF*+,:;32#"'.#"67>32#"#32>7"32>7 QkiR8L]KV 4 E9%'Xag6IF  "tDLuW:$d\'RLC--. GcqeL  +Kf;G~`hŕXqwJ|kT: VW,5kj]zFAd 2$ C\7#38 #1(;2"Ciyc 5!&2<3OKd=1CMU+H􀍛U+` &&wb @ 'CH(@ 's*H(@ ,'(@'i( 'CH,$ 'sH, ,',G'i, 2Y+3 +?2+D3('P22Z/"ֱU"U +@"- +UD /DD +@DJ +U:+ [+6>+ '.%P8R%&%'+RQRP+&%' #9QRP9%&QR....'P%&QR......@DU39: 9993"9?2:99 901>767>32#".'.54>7#".54>32>54.#"32+%^pJ4ha?8j/b\R  7"*'Vg}X/:`|C=gUE  6,'~5^\~Ԟ[ M] "!Tdfp;Tf-%Wq!%2 '"i1`@` 'CBH2`@` 'siH2`@` ,'^2`@`'Ri2`@`'i*2`\.'//+2(+ 20+( $9901#"&546?'.54>327>32#"&'1$0 %%& 0$20$5,$$$+5$0`G`>;Sf+3<Q2< +@ ++g/ֱb bE+5 h+6=l+ .XM=+ XX MM"-M+=+ XX +M.M-+/M-+0M-+JM-+KM-+LM-+NM+OM+PM+QM+=+ TX+UX+VX+WX+XYX +ZX +[X +TX #9U9V9W9OM9P9N9YX 9Z9[99LM-9K9J909.9/9@ 0JT[-./KLMNOPUVWXYZ......................@ 0JQT[-./KLMNOPUVWXYZ.........................@Eb($901"&'#".5467.54>327>32 '2>54.' 2'>7!)   _g73d!  '/ `f65fvPs_J7$1J1>FMPT) ENRPK YyV06O%,'"!fC*l\ <.%7>5>32%32>5.54>3234>7%4.'>Ekt?cJ5 ] "3G0GdžCLB '=.  17     `W)K|]7b]-NKQD-8 ]hgR3 f]M{YG$uoE>bytb #/Nhv~=}/eXE '4>@b >V+'/./A+K/W/ ֱ3+" 3" +@3< +3F  X+  93'*AK$9'V9.*T99"+<999KA901#".'6>322#"&'732>54.54>32>54.#"L(2,#5Rr|pt<5r|mm7Hؐ9{?(T)NqD&=OQO=&)$Ob7$>V1ZiJ2'- "*!ǏP>fBGoGAlMNR BjK=N1-' , %Fe?*A+EzV;a@'CD@'sD@']D@':D@'iD@b'_D@+ #iz2+)?+^+L32j/Dֱ +c +k+D?9@ $)2:LX$9?:9)$-.D$9^RU990132767"4&#"27>32767#".'#"&'&5467>763232632367632@NB5* KOJ5X +  JS"I 'm{[~"?72*& @|/--Tu,*R +\/+ֱW W5+ ]+5W &2O$999RJ+92599>9$9 901".54>327>32#".54>3254&'#".546?.2>7.#" #7(Oxe)  $1x )Lm[NQ0SqEEp.-[0% &:5_O<!Y@@kD<` (' #@[8H &54Q_կ}E/enCpS0H{5( %$ (G><``8`G-Q=%'7Q@g&C}R@g'sR@g'TR@g'1R@g&ieR_yz&y@Lg=FQ8+ +'+R/ִC +CO+ +S+6= + F 9J=R+ >$I:.  J+==+ >">$+#>$+I/I.+0I.+1I.+2I.+GI.+HI.+">$ #9#9HI.9G92919/909@ "12>FGJ#$./0HI................@ "12>FGJ#$./0HI.................@C9O9',=$901##".5467.54>7>32.'%>54&1G[l="   2H.>ti "3) Juh.\gd$*I6 G*%E3:;;xpbH*lD6Wly>jU)[L1  _D[n:$TPG Khx80RrIfx74W['CX['sX['bX[&ixX@^'s&\KRmk+b'+S/n/iֱ o+6?"+ 2@".!"+232@+42@+52@+62@+72@+82@+92@+:2@+;2@+=2@+>2@+?2@+"X"+Y"+Z"+["+32@ #9495969798999:9;9=9>9?9!"9[9Y9Z9X9@!"2;=X[3456789:>?@YZ.....................@!"2;=X[3456789:>?@YZ.....................@i 99b9S $901>32>7#"&'#"&#".5467>707>7>32"32>54.P@;\@"%$JKL(M7ms}F;!&A;|   %  -+..$!K#F<. !!@"8,  3%FU4Vp=3[WV.(0;(2J7("g#/ uuuՏ^P2'"$ |=_C6[#(#  (CV][&-"@^&i\`&+!! +! +'/ ֱ  + +2(+6>&+ .6  + ++++  #99999@  ......... ........@ 901%#".54>7>3232>7$k|:4G,*/*59*"$XZV!!K?*4K-?K% Siyys.-52GLKP t+]]t +]c +///ֱ4 鱚+6 w+ #<Is+ _`r mI+I+I+I+#$#<+%#<+8#<+:#<+JI+KI+LI+}+ rorm+prm+qrm+ z+ ##<+#<+$#< #9%99989:9I9999K9L9J9qrm #9p9o9@#8:765>?67#".54>7>76767>326767>32327%>32#".5".54667>7>54&#"6763o6*+52 >Ta/  L+ $yW,:BE2T<" `NO,  )}iHm$-LO$ $bf,aeg0J_7Vx"  )7 V^`)LPH5}D d6 )8C"Dwl %& yԏG&LrL]fIK  &&hC=G%  ` *&!'  3Wr@?J&/%JG<%94C|l*-$ FN+ /)O/ֱCK2C++ P+6 t+  /5  /+5+ ! /+" /+- /+75+M5+! / #9"99-959M979@ -/57M !"...........@ -/57M !"...........@C&9 =G999+ )9$9  9 &K$9)+9014#"67627#"'&54"#"&'&467>72376326763267 9I1$WU,bRĭjKJD,$  FXkxy/E*Qh B3?N3  $  hFH:F^p#㯪 ! - B℟ `P ')d 2O. d7;f``@ @Qhh+J+R#+, ]2># +2i/ֱd j+JR 9>QWd$9,2 'X999]&901%#".'#".54>32>32.#"!2#!32>72>7.#" QkIze$$tRZ3dTs$X情`,hqt9BybD @ /! +Kf;G~`%CxiY% 5VvK\~Z29kVW,0H03263232>7%2>54.#"2>54&#"4ZH2 FRZ,X}P%!;O]f3F5_8`G(=lW!<~p'Xc+cmu"@0,)J8 "8$UI2!+=) "|nV$0HU&[F:-Ei:.O:"Fm=*J7!%:D -: 3AB> ,'c6'_Vm'i< ,'x=&=o] a-H*+99* +94 +@/"32/ + +I/J+6>+ =%==+>x+ =+%%+%+>+ $%+=>=+?=+>= #9?99$%99@ $%=>?.........@ $%=>?...........@@D901>32#".#"!2#!#".54>3232>7#"&54>6*72-*3-=v jǮf9#:,1.";Ԛ0000ܵF#:,1."Cp00))q3; /*3 +4/ִ'+5+' $*999 $/99901#".767>32#".'.'&$ *+*   01>-,:&   >9# QIA<4/4 !I4P6!@]<"* (9-/B 3'g.6m6+/- +7/(++8+- 990167>7>32#".'.'.54>32 ')* +.<-,<*  +# QIA<4/4 !5P6!@]32#".%"32>54&_4CKM#%K:%:Zo4%RD-7-B+ $'>**-.N?0!4N4PvN&7[-7%1;&5@= )< /'' +' +' +*/ֱ$ $ +$ +$ +++01632#".54>7>32326 =CF"+<'!$("!<*$ !+9AGG0CI(@|-/) +.//+0167>7>32#".'#"&547>32t  ;"1 &9L13B_K  ;"1 &9L13B_ $ &#GC0,L;# &#GC0,Lf@@;/3* + 2A/B+01>767>32#"&546%>767>32#"&546$*1;@#-$%:?A:0"""!'. 54)%1572) "" 3DM&Zj"$2-4?DD=2%%  5CN&Zh"$2/2?ED=2% A`/  2 2/+01".54>3!2#!!-l%/ 0# )&. 1$? `/  2 2/+01".54>3!2#!!-%/ 0# )&. 1$?F + +/ֱ  +/ + + 9901#".5467>7>32 0<.$ "#! ? 0:EM%Wc0! ) 0srg$0/1@9+ +/ֱ  + +9 9014>7674>32#"& 0<.$!#! ? 09EM%Wd/! * 0srg$0/1AA /+ ++ +!/+ +"+01>767>32#"&54% %,8- --+:!0H )05/0ֱ&& 8 +8/ +&+  +/ +?+80+9&;9 9901#".5467>7>32#".5467>7>32h 0<.$ "#! ? 0 0<.$ "#! ? 0:EM%Wc0! ) 0srg$0/11:EM%Wc0! ) 0srg$0/1h@=d+;3 ++2>/ֱ  +&+0 8 +?+9 98&;90+9014>7674>32#"&%4>7674>32#"& 0<.$!#! ? 0 0<.$!#! ? 09EM%Wd/! * 0srg$0/119EM%Wd/! * 0srg$0/1A&A A=+3- + 2B/C+01>767>32#"&54%>767>32#"&54 %,8- --+:!0 %,8- --+:!0H )05HE+ /< <+>^+ <+ <+ <+ <+/+/+/+/+ /+,/+>]+ -/+./+=<+><+?<+/ #9999-9.9 <9 9 9 9=9>9@/< -.=>................@  ,/....................@012#!#".5467>7#".54>;>7>32%0%.*# ',-)0#'& '7# '(!eк**- ) e " P3*" 2(nB FUp4+5H33*)R224* +@4= +/ 33'(U22' +@ +V/W+6>=+ 8 E E+>^+ E+ E+8+8+8+(8+)8+58+>]+ 68+78+ F E+G E+H E+R E+>^+ S E+T E+U E+8 #996979 E9 9S9T9F9G9@ 8E 67FGST..............@ ()58EHRU 67FGST......................@012#!#".5467>7#".54>;#".54>;>7>3232#!K%0% ',-#'&E#'& '7# %0%'(!N}%*- ) `A "  " P3*" 2(nB'(!GF`./ + +/ִ + ++014>32#".GpA.R=#>c@/[I- UY.3W@cl:Dp@a';N/+339 %22/+9 32#".54>32#".54>32@ *@.%<+,F0SV *@.%<+,F0SV *@.%<+,F0SV */('=+$E6 TN */('=+$E6 TN */('=+$E6 T^ +UmE+ +"1+b+3x鰤2+VnEb +3V鰂2Eb +/ֱ' '+ [+} }s+g g+ 鰩+ 鱯+' EJO$9[=RS999}:199s49Vb$999nVMJ99NO[s}$9=g999bxR9"':S$9 9901".54>32'2>54.#">32 #".5467>".54>32'2>54.#"".54>32'2>54.#"Y\.7SoT^W) 7%>32 #"PgSJC$).1L5 )-6+')W730.-Q-A>9%C(4 I$+%/&+01%#".54>7-.54>32~")'+6-) j_ 8/oW 4(C%)p7776?@)+*/++01>32 #".5467> /BR0  5{+-,*";Q`gi`S9.!#()tn2!&# F.عV:@$'+' + +S+ooS +o] +2<'S +32 2KA'S +3Kt2/.ֱ. +@ +@ +@z +. +@.7 +@.F +j+X jX +@jb ++.=@L999jSt999X]92.9012#!32>7632#".5<7#".54>;>7#".54>;>32#".5<7>54.#"!2#!! " 2*:cMK<$IhMrS.A &' Y 8 &' ~+odg+!081."8_HW}0Y " 2* )!  qa,&AY3%/@uY5Cj|!&  ?!!& bi;CmHGjA BIL$$A1Yl)!!? t|+%39+9 +@ + 22 3@+D+U+z/k+/4ֱ* * +2 +V +V+2i +h2i+3d +e2+6=3+ !#= + .K;I=+ 3>+ .e.h+ hfhe+ghe+++=+ ++"!# #9 #999JKI #9 #9999ghe9f9@K!"#IJefgh...........................@K!"#IJfg......................@ * %9$9<>L$9@E$9VS9_99iz9dk9kz  $9@ $*/LVZdrw$901"#"&54>7.'#"&54>7#"&'&'4>323632>32>3232>72#".54>54&#"#"&5<7>54&39<:5; -B'1+*_.9M  ,)>K!,[J0/,!$ \x@I &I *OKF?8APEQ\43D) $'*% GG4(  #A;4.(!%&$ 6SbbZ"8<@/  /+01".54>3!2#;."4#V2- %@!%.#- D@d|+_+&+/GG +@GR +@GB +/ 鰊/2/'ְ)2l j2lv+tu22 2 +\ 鰇 7 +\ +++6?5+ ).,j ?o+ u3s+)*),++),+jgj+ij+stsu+?Y+ jj+*), #9+9ij9g999@)*+,gijstu..............@ *+,gis..........@l'%9v> ?999BG$92997  L999\RU_$9_l9 \c$9G ?de$9>X99979901%#".5467#".54>>32>3232>?>3232>7%"32>54.>54&#"4>32#"&$k|:4G,;r-50$) #2CW77R:' '5I^uV"K>)%C[lw>   ?kXF+*59*"$XZV!   ") :B"=|d?.0-K8#>.0I3XT!K?*4K-3HBG=M :TfhaK.2Uq~=ph6YA;O &% Siyys.-52GL-GXUIZ>_q4#fonW6C۪7s߿&511:3#!6%"@2SD:p+b++ /?72 ? +@  +? +@?: +y/K鰩 */ְ!2 鰉2+22 2+B2] q2 / +]v+P 鱭+6?5+ !.$ ?o+ 3+!"!$+#!$++++?Y+ +"!$ #9#99999@!"#$..............@ "#$..........@967999 :?$9*99]/9vVb99PKij999bj99? i999/BVq$9*yP901!".'#".54>>32>323267>3232>767>74&#""32>54.>54&#"2.QA. 7h)0+$) #2CW77R:' '5I^uV"K>)%C[lw>   Q23FUcmw>+8 +I`hi.  17:?ERYW&QRN-`T= !UQD    ") :B"=|d?.0Ex^BG=M :TfhaK.2Uq~=ph6YA;O  G̵O'@Q*^ýZ %*1'#*7@2) P[)` 0G-GXUIZ>_q4#fonW6C۪7s߿&511@SgwB+m +T^/%2x/ֱc cY+ +r+4 4r +@4* +y+Yc 99S99rBGNh$94.%/7$9^T@ .7=GS32>7>32>7#".5467#>54.'2>54.#"%32>54.'1G[l=X}P%B{o4y|u]?&3F3 '/04&.) % HtS ) .&WQAEi:.O:"Fm=*J7!@$+983->07D7F7G7H7J7R7S7T&8rD i( ' N 8 p   6 2 M w P   4 p[ Copyright (c) 2011 by vernon adams. All rights reserved.Copyright (c) 2011 by vernon adams. All rights reserved.PacificoPacificoRegularRegularvernonadams: Pacifico: 2011vernonadams: Pacifico: 2011PacificoPacificoVersion 1.000Version 1.000PacificoPacificoPacifico is a trademark of vernon adams.Pacifico is a trademark of vernon adams.vernon adamsvernon adamsvernon adamsvernon adamsCopyright (c) 2011 by vernon adams. All rights reserved.Copyright (c) 2011 by vernon adams. All rights reserved.PacificoPacificoff  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghjikmlnoqprsutvwxzy{}|~ foursuperiorEuroo_s  latn ,latnkernL(0k7DDFHJJRT7<ɉo1z!|əgdmodule-0.58/demo/gddemo.py000066400000000000000000000020001216105026500157710ustar00rootroot00000000000000#!/usr/bin/env python import gd, os, cStringIO, urllib2 os.environ["GDFONTPATH"] = "." FONT = "Pacifico" def simple(): im = gd.image((200, 200)) white = im.colorAllocate((255, 255, 255)) black = im.colorAllocate((0, 0, 0)) red = im.colorAllocate((255, 0, 0)) blue = im.colorAllocate((0, 0, 255)) im.colorTransparent(white) im.interlace(1) im.rectangle((0,0),(199,199),black) im.arc((100,100),(195,175),0,360,blue) im.fill((100,100),red) print im.get_bounding_rect(FONT, 12.0, 0.0, (10, 100), "Hello Python") im.string_ttf(FONT, 20.0, 0.0, (10, 100), "Hello Python", black) f=open("xx.png","w") im.writePng(f) f.close() f=open("xx.jpg", "w") im.writeJpeg(f,100) f.close() f=cStringIO.StringIO() im.writePng(f) print "PNG size:", len(f.getvalue()) f.close() f = urllib2.urlopen("http://www.gnu.org/graphics/gnu-head-sm.jpg") im = gd.image(f, "jpg") f.close() print "GNU Image Size:", im.size() simple() gdmodule-0.58/gd-ref.html000066400000000000000000000371771216105026500153150ustar00rootroot00000000000000 Python GD Module Reference

Python GD Module Reference

Description

GD module is an interface to the GD library written by Thomas Boutell.
'gd is a graphics library. It allows your code to quickly draw images complete with lines, arcs, text, multiple colors, cut and paste from other images, and flood fills, and write out the result as a PNG or JPEG file. This is particularly useful in World Wide Web applications, where PNG and JPEG are two of the formats accepted for inline images by most browsers.'
It has been extended in some ways from the original GD library.

This documentation is slightly out of date. In particular, the patch by Mike Romberg adds a lot of methods to the image object, which may not be fully documented here. Use the Source, Luke.

Constants

gdFontGiant, gdFontLarge, gdFontMediumBold, gdFontSmall, gdFontTiny
Fonts for use with the string() and stringUp() methods.
gdMaxColors(256)
Maximum number of colors in an image; GD will likely change this figure in a future version.
gdStyled, gdStyledBrushed, gdBrushed
Draw mode for line() and lines() method.
gdTiled
Fill mode for fill(), fillToBorder()
gdTransparent, gdStyledBrushed
Special entries for setStyle()

Image Object

image(image[,(w,h)] | file | file,type | (w,h))
create GD image from
  • file.(png|jpeg|gd|gd2|xbm|xpm),
  • file (a filename or file-like object with a read method), type (png|jpeg|gd|gd2|xbm|xpm)
  • the existing image,
    • optionally resized to width w and height h
  • or blank with width w and height h

Image Object Methods

writePng(f)
write the image to f as a PNG, where f is either an open file-like object or a file name.
writeJpeg(f, [ q ])
write the image to f as a JPEG file, where f is either an open file-like object or a file name, and q is the quality value as an integer from 0 to 100. If q is 0 or omitted, a default is used.
writeGd(f)
write the image to f as a GD file, where f is either an open file-like object or a file name.
writeGd2(f, [ c, [ fmt ] ])
write the image to f as a GD2 file, where f is either an open file-like object or a file name, c is the chunksize and fmt is the format. See the GD 1.8.3 or later documentation for an explanation. Defaults will be supplied if omitted.
writeWbmp(f, [ fg ])
write the image to f as a WBMP file, where f is either an open file-like object or a file name, and fg is the index of the color to "set" in the result image (see the GD 1.8.3 or later documentation for details). fg defaults to 0 if omitted.

All of the above write methods accept either a filename, file object or a python object with a write() method. Use a StringIO object if you want to get the image data without writing it to a file (useful for web scripts that return generated images to the client).
 
setPixel((x,y), color)
set the pixel at (x,y) to color
line((x1,y1), (x2,y2), color)
draw a line from (x1,y1) to (x2,y2) in color
lines(((x1,y1), (x2,y2), ..., (xn, yn)), color)
draw a line along the sequence of points in the list or tuple using color
polygon(((x1,y1), (x2,y2), ..., (xn, yn)), color[, fillcolor])
draw a polygon using the list or tuple of points (minimum 3) in color, optionally filled with fillcolor
rectangle((x1,y1), (x2,y2), color[, fillcolor])
draw a rectangle with upper corner (x1,y1), lower corner (x2,y2) in color, optionally filled with fillcolor
filledPolygon(((x1,y1), (x2,y2), ..., (xn, yn)), color)
draw a filled polygon using the list or tuple of points (minimum 3) in color
filledRectangle((x1,y1), (x2,y2), color)
draw a rectangle with upper corner (x1,y1), lower corner (x2,y2) in color
arc((x,y), (w,h), start, end, color)
draw an ellipse centered at (x,y) with width w, height h from start degrees to end degrees in color.
fillToBorder((x,y), border, color)
flood from point (x,y) to border color in color
fill((x,y), color)
flood from point (x,y) in color for those pixels with the same color as the starting point
setBrush(image)
set the drawing brush to image (use gdBrushed when drawing)
setTile(image)
set the fill tile to image (use gdTiled when filling)
setStyle(tuple|list)
set the line bit-style to tuple or list of colors (use gdStyled when drawing)
getPixel((x,y))
color index of image at (x,y)
boundsSafe((x,y))
returns true if (x,y) is within image
size()
return the 2-tuple size of image
string(font, (x,y), s, color)
draw string s at (x,y) using one of the pre-defined gdmodule fonts
stringUp(font, (x,y), s, color)
vertically draw string s at (x,y) using one of the pre-defined gdmodule fonts
get_bounding_rect(font, pointsize, angle, (x,y), s)
Get bounding rect of string s using the TrueType font at the given pointsize and angle. Returns the bounding box of the given text as an eight-tuple: lower left X, lower left Y, lower right X, lower right Y, upper right X, upper right Y, upper left X, upper left Y.
string_ttf(font, pointsize, angle, (x,y), s, color)
draw string s at (x,y) using the TrueType font at the given pointsize and angle. Returns the bounding box of the given text as an eight-tuple: lower left X, lower left Y, lower right X, lower right Y, upper right X, upper right Y, upper left X, upper left Y.
string_ft(font, pointsize, angle, (x,y), s, color)
Functional equivalent of string_ttf, which may be deprecated.
colorAllocate((r,g,b))
allocate a color index to (r,g,b) (returns -1 if unable to)
colorClosest((r,g,b))
return the color index closest to (r,g,b) (returns -1 if unable to)
colorExact((r,g,b))
return an exact color index match for (r,g,b) (returns -1 if unable to)
colorsTotal()
returns the number of colors currently allocated
colorComponents(color)
returns a 3-tulple of the (r,g,b) components of color
getInterlaced()
returns true if the image is interlaced
getTransparent()
returns transparent color index or -1
colorDeallocate(color)
deallocate color from the image palette
colorTransparent(color)
set the transparent color to color
copyTo(image[, (dx,dy)[, (sx,sy)[, (w,h)]]])
copy from (sx,sy), width sw and height sh to destination image (dx,dy)
copyResizedTo(image[, (dx,dy)[, (sx,sy)[, (dw,dh)[, (sw,sh)]]]])
copy from (sx,sy), width sw and height sh to destination image (dx,dy), width dw and height dh
interlace()
set the interlace bit
origin((x,y)[,xmult,ymult])
set the origin of the image to (x,y) and multiply all x, y, width and height factors by xmult and ymult (typically either 1 or -1)
getOrigin()
returns the origin parameters ((x,y),xmult,ymult)

Other Module-level functions

fontstrsize(font, string)
return a tuple containing the size in pixels of the given string in the given font

Copyright © 1995 Richard Jones, Bureau of Meteorology Australia.
richard@bofh.asn.au

With Richard's blessing, I have taken over support for this module; so, send all bug reports, etc. to chris.gonnerman@newcenturycomputers.net

This module is a python wrapper for the GD library (version 1.1.1 and later)

From the GD docs:
"COPYRIGHT 1994 BY THE QUEST CENTER AT COLD SPRING HARBOR LABS.
Permission granted for unlimited use, provided that the Quest Center at Cold Spring Harbor Labs is given credit for the library in the user-visible documentation of your software. If you modify gd, we ask that you share the modifications with us so they can be added to the distribution. See gd.html for details.

  • Version 0.56
    Revised 03/10/2005 by Chris Gonnerman
    • added support for GIF files.
    • the minimum gd library version for this gdmodule version is 2.0.23.
  • Version 0.55
    Revised 03/10/2005 by Chris Gonnerman
    • corrected error in the gd.image() constructor, pointed out by Betty Li.
    • corrected yet another obvious error reported by Greg Hewgill, regarding an incorrect call to gdImagePolygon when fillcolor is not equal to 1.
    • implemented the saveAlpha and alphaBlending features as suggested by Christopher Stone.
    • fixed memory management issue regarding image deallocation reported by Matti Jagula.
    • fixed memory management issue in image_filledpolygon reported by Sadruddin Rejeb.
    • the minimum gd library version for this gdmodule version is 2.0.22.
  • Version 0.54
    Revised 03/03/2005 by Chris Gonnerman
    • this version has been withdrawn and replaced with 0.55, above.
  • Version 0.53
    Revised 06/10/2004 by Chris Gonnerman
    • corrected obvious error in image_settile(), as pointed out by Dan Mosedale.
    • applied some patches provided by John Hunter. Several are for Windows compatibility, but this should be considered a "work in progress" in this version.
    • corrected another obvious error (and an ancient one too) reported by Greg Hewgill, regarding the foreground color being used rather than the fill color in the image_polygon function.
    • the minimum gd library version for this gdmodule version is 2.0.22.
  • Version 0.52
    Revised 02/03/2004 by Chris Gonnerman
    • incorporated new functions from the matplotlib project (provided by John Hunter)
    • corrected error in PyObject_HEAD_INIT() call noted by Stefan R Kuzminski (thanks!)
  • Version 0.50
    Revised 09/13/2003 by Chris Gonnerman
    • Documentation change: version 2.0.8 or higher of GD has been required since version 0.41 of gdmodule.
    • The library search order has been changed; /usr/local/lib is now the first in the search path. This is intended to support those trying to build against newer versions of GD which might conflict with an older version installed with the Linux or BSD distibution.
  • Version 0.42
    Revised 06/10/2003 by Chris Gonnerman
    • implemented patch by Gregory P. Smith to support writing to arbitrary objects, superceding the patch in 0.41 from Andreas Rottman. gddemo.py contains Rottman's example (which works with Smith's patched version) as well as an example (by me) of reading an image from a URL. The documentation was updated to reflect these changes.
  • Version 0.41
    Revised 05/29/2003 by Chris Gonnerman
    • implemented big patch by Andreas Rottmann to support writing images to memory via StringIO/CStringIO. Currently the only documentation is an example in gddemo.py.
    • implemented patch by Bob Galloway to remove the "specialness" of negative coordinates in the string_ttf/string_ft methods.
    • implemented patch by Nathan Robertson to enable MacOSX fink builds.
    • fixed bugs in the proxy class with regard to passing of _gd.image types.
  • Version 0.40
    Revised 09/18/2002 by Chris Gonnerman
    • updated to deal with incomplete library installs
  • Version 0.30
    Revised 06/12/2002 by Chris Gonnerman
    • initial conversion to two-tier design
  • Version 0.26
    Revised 12/10/2001 by Chris Gonnerman
    • made unicode optional via define Py_UNICODEOBJECT_H
  • Version 0.25
    Revised 09/15/2001 by Chris Gonnerman
    • implemented patch by Mike Romberg:
      • adds additional image methods, available only if GD 2.0.1+ is installed.
  • Version 0.24
    Revised 08/08/2001 by Chris Gonnerman
    • implemented patch by Mike Romberg:
      • supports GCC 3.0 and GD 2.0.1
      • adds public C function makeGDImage()
        • It allows C or C++ code which uses the gd library directly to make an imageobject instance.
  • Version 0.23
    Revised 11/22/2000 by Chris Gonnerman
    • included the patch from Tanimoto Osamu
    • updated support to GD version 1.8.3
    • cleaned up code, added ANSI prototypes
gdmodule-0.58/gd.py000066400000000000000000000041501216105026500142100ustar00rootroot00000000000000""" GD module is an interface to the GD library written by Thomas Bouttel. It allows your code to quickly draw images complete with lines, arcs, text, multiple colors, cut and paste from other images, and flood fills, and write out the result as a .GIF, .PNG, .JPEG, or .WBMP file. This is particularly useful in World Wide Web applications, where .JPEG is universally supported and PNG is the up-and-coming format used for inline images. It has been extended in some ways from the original GD library. """ import _gd from _gd import * del image # proxy the _gd.image type as a class so we can override it. class image: def __init__(self, *args): if isinstance(args[0], image): args = list(args) args[0] = args[0]._image self.__dict__["_image"] = _gd.image(*args) def __getattr__(self, name): return getattr(self._image, name) def __setattr__(self, name, value): return setattr(self._image, name, value) def lines(self, points, color): "draw a line along the sequence of points in the list or tuple using color" prev = tuple(points[0]) for p in points[1:]: p = tuple(p) self._image.line(prev, p, color) prev = p def copyTo(self, im, *args): return self._image.copyTo(im._image, *args) def copyResizedTo(self, im, *args): return self._image.copyResizedTo(im._image, *args) def copyResampledTo(self, im, *args): return self._image.copyResampledTo(im._image, *args) def copyMergeTo(self, im, *args): return self._image.copyMergeTo(im._image, *args) def copyMergeGrayTo(self, im, *args): return self._image.copyMergeGrayTo(im._image, *args) def copyPaletteTo(self, im, *args): return self._image.copyPaletteTo(im._image, *args) def compare(self, im, *args): return self._image.compare(im._image, *args) def setBrush(self, im, *args): return self._image.setBrush(im._image, *args) def setTile(self, im, *args): return self._image.setTile(im._image, *args) # end of file. gdmodule-0.58/install_notes.html000066400000000000000000000034501216105026500170120ustar00rootroot00000000000000 gd module install notes

gd module install notes

I'm going to assume that you've got the GD library installed, which is pretty trivial to do. If you're having troubles with that, I suggest you have a look at that package's instructions.

Starting with version 0.40 of gdmodule, the Setup.py script tries rather hard to identify installed libraries. Assuming you have GD installed normally, with development versions of all the libraries it uses, you are in good shape. If you have build problems or runtime errors mentioning unknown functions, you probably either (a) don't have all the supporting libraries installed as development versions, or (b) have libraries installed that weren't used to build GD!

Libraries looked for are: X11, Xpm, png, z, jpeg, ttf, and/or freetype. If both libttf and libfreetype are found, the libfreetype wins. If either libpng or libz are missing, png support is not built; likewise for Xpm and X11.

Installation is done via the standard Distutils. Do this (as root if necessary):

python Setup.py install

This should build the _gd.so extension and install it along with the gd.py module in the standard location on your system.

If you have had a previous version of gdmodule installed, in particular one which creates a monolithic gdmodule.so or gd.so, please remove it before building this one.

As of right now, I don't have a build for Windows. If I get time I might put one together... don't hold your breath. (If someone wants to build one for me I wouldn't cry about it...)