diff options
Diffstat (limited to 'Imaging/libImaging/Negative.c')
-rw-r--r-- | Imaging/libImaging/Negative.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Imaging/libImaging/Negative.c b/Imaging/libImaging/Negative.c new file mode 100644 index 0000000..1255525 --- /dev/null +++ b/Imaging/libImaging/Negative.c @@ -0,0 +1,42 @@ +/* + * The Python Imaging Library + * $Id: Negative.c 2134 2004-10-06 08:55:20Z fredrik $ + * + * negate image + * + * to do: + * FIXME: Maybe this should be implemented using ImagingPoint() + * + * history: + * 95-11-27 fl: Created + * + * Copyright (c) Fredrik Lundh 1995. + * Copyright (c) Secret Labs AB 1997. + * + * See the README file for information on usage and redistribution. + */ + + +#include "Imaging.h" + + +Imaging +ImagingNegative(Imaging im) +{ + Imaging imOut; + int x, y; + + if (!im) + return (Imaging) ImagingError_ModeError(); + + imOut = ImagingNew(im->mode, im->xsize, im->ysize); + if (!imOut) + return NULL; + + for (y = 0; y < im->ysize; y++) + for (x = 0; x < im->linesize; x++) + imOut->image[y][x] = ~im->image[y][x]; + + return imOut; +} + |