~ubuntu-branches/debian/squeeze/python-imaging/squeeze

« back to all changes in this revision

Viewing changes to libImaging/Crop.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-11-20 19:22:59 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091120192259-n3iy0f17n5akogom
Tags: 1.1.7-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * The Python Imaging Library
3
 
 * $Id: Crop.c 2134 2004-10-06 08:55:20Z fredrik $
 
3
 * $Id$
4
4
 *
5
5
 * cut region from image
6
6
 *
25
25
    Imaging imOut;
26
26
    int xsize, ysize;
27
27
    int dx0, dy0, dx1, dy1;
 
28
    INT32 zero = 0;
28
29
    
29
30
    if (!imIn)
30
31
        return (Imaging) ImagingError_ModeError();
42
43
 
43
44
    ImagingCopyInfo(imOut, imIn);
44
45
 
 
46
    if (sx0 < 0 || sy0 < 0 || sx1 > imIn->xsize || sy1 > imIn->ysize)
 
47
        (void) ImagingFill(imOut, &zero);
 
48
 
45
49
    dx0 = -sx0;
46
50
    dy0 = -sy0;
47
51
    dx1 = imIn->xsize - sx0;