[IMAGE-SIG] First official patch for PIL 0.3a3

Fredrik Lundh fredrik@pythonware.com
Wed, 4 Feb 1998 17:36:02 +0100


This is the first set of patches for PIL 0.3a3.  This fixes an import
error in Image.py ("Types" instead of "types"), a critical bug in the
Tk interface that caused compilation errors or segmentation violations
if you use Tk 8.0 final or a later patch release (note: after applying
this patch, you *must* use Tk 8.0 final or later), and a few minor
type mismatches that some compilers didn't like.

Many thanks to Case Roole and the folks at SMHI.

Cheers /F
fredrik@pythonware.com
http://www.pythonware.com

NOTE: if your patch utility cannot find the files, try "patch -p0".

*** Tk/tkImaging.c	Wed Feb  4 15:25:42 1998
--- Tk/tkImaging.c	Wed Feb  4 15:17:01 1998
***************
*** 73,79 ****
      }
  
      /* get Tcl PhotoImage handle */
!     photo = Tk_FindPhoto(argv[1]);
      if (photo == NULL) {
          Tcl_AppendResult(interp, "destination photo must exist", (char *) NULL);
          return TCL_ERROR;
--- 73,79 ----
      }
  
      /* get Tcl PhotoImage handle */
!     photo = Tk_FindPhoto(interp, argv[1]);
      if (photo == NULL) {
          Tcl_AppendResult(interp, "destination photo must exist", (char *) NULL);
          return TCL_ERROR;
***************
*** 145,152 ****
  
          /* Copy opaque runs to photo image */
          for (y = 0; y < block.height; y++) {
!             char* p = block.pixelPtr + y*block.pitch;
!             char* s = p;
              int   w = 0;
              for (x = 0; x < block.width; x++) {
                  if (p[3]) {
--- 145,152 ----
  
          /* Copy opaque runs to photo image */
          for (y = 0; y < block.height; y++) {
!             unsigned char* p = block.pixelPtr + y*block.pitch;
!             unsigned char* s = p;
              int   w = 0;
              for (x = 0; x < block.width; x++) {
                  if (p[3]) {
*** libImaging/Quantize.c	Wed Feb  4 15:22:16 1998
--- libImaging/Quantize.c	Wed Feb  4 15:22:36 1998
***************
*** 187,193 ****
      } else if (strcmp(imIn->mode, "P") == 0 && imIn->palette &&
  	       strcmp(imIn->palette->mode, "RGB") == 0) {
  	/* Palette image */
! 	char* p = imIn->palette->palette;
  	for (y = 0; y < imIn->ysize; y++) {
  	    UINT8* in = imIn->image8[y];
  	    for (x = 0; x < imIn->xsize; x++) {
--- 187,193 ----
      } else if (strcmp(imIn->mode, "P") == 0 && imIn->palette &&
  	       strcmp(imIn->palette->mode, "RGB") == 0) {
  	/* Palette image */
! 	unsigned char* p = imIn->palette->palette;
  	for (y = 0; y < imIn->ysize; y++) {
  	    UINT8* in = imIn->image8[y];
  	    for (x = 0; x < imIn->xsize; x++) {
*** _imagingmodule.c	Wed Feb  4 15:23:46 1998
--- _imagingmodule.c	Wed Feb  4 15:24:13 1998
***************
*** 829,836 ****
  static PyObject* 
  _getprojection(ImagingObject* self, PyObject* args)
  {
!     char* xprofile;
!     char* yprofile;
      PyObject* result;
  
      xprofile = malloc(self->image->xsize);
--- 829,836 ----
  static PyObject* 
  _getprojection(ImagingObject* self, PyObject* args)
  {
!     unsigned char* xprofile;
!     unsigned char* yprofile;
      PyObject* result;
  
      xprofile = malloc(self->image->xsize);
***************
*** 1251,1257 ****
  static PyObject* 
  _crc32(PyObject* self, PyObject* args)
  {
!     char* buffer;
      int bytes;
      int hi, lo;
      UINT32 crc;
--- 1251,1257 ----
  static PyObject* 
  _crc32(PyObject* self, PyObject* args)
  {
!     unsigned char* buffer;
      int bytes;
      int hi, lo;
      UINT32 crc;
*** Lib/Image.py~	Mon Feb  2 09:42:56 1998
--- Lib/Image.py	Wed Feb  4 12:57:02 1998
***************
*** 45,51 ****
  import os, string
  
  # type stuff
! from Types import IntType, StringType, TupleType
  isStringType = lambda t: type(t) == StringType
  isTupleType  = lambda t: type(t) == TupleType
  isImageType  = lambda t: hasattr(t, "im")
--- 45,51 ----
  import os, string
  
  # type stuff
! from types import IntType, StringType, TupleType
  isStringType = lambda t: type(t) == StringType
  isTupleType  = lambda t: type(t) == TupleType
  isImageType  = lambda t: hasattr(t, "im")

_______________
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________