~edwin-grubbs/python-imaging/trunk

« back to all changes in this revision

Viewing changes to libImaging/Fill.c

  • Committer: effbot
  • Date: 2006-03-01 19:11:48 UTC
  • Revision ID: svn-v4:be285980-f00d-0410-a9fe-d4747b46ecd0:pil:18
Load Imaging-1.1.3 into pil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * The Python Imaging Library
3
 
 * $Id$
 
3
 * $Id: //modules/pil/libImaging/Fill.c#3 $
4
4
 *
5
5
 * fill image with constant pixel value
6
6
 *
30
30
    c = 0L;
31
31
    memcpy(&c, colour, im->pixelsize);
32
32
 
33
 
    if (im->image32 && c != 0L)
 
33
    if (im->image32 && c != 0L) {
34
34
        for (y = 0; y < im->ysize; y++)
35
35
            for (x = 0; x < im->xsize; x++)
36
36
                im->image32[y][x] = c;
37
 
    else
 
37
    } else {
 
38
        unsigned char cc = (unsigned char) *(UINT8*) colour;
38
39
        for (y = 0; y < im->ysize; y++)
39
 
            memset(im->image[y], (unsigned char) c, im->linesize);
 
40
           memset(im->image[y], cc, im->linesize);
 
41
    }
40
42
 
41
43
    return im;
42
44
}