File: Negative.c

package info (click to toggle)
python-imaging 1.1.7-2%2Bdeb6u2
  • links: PTS
  • area: main
  • in suites: squeeze-lts
  • size: 2,424 kB
  • ctags: 3,401
  • sloc: ansic: 19,470; python: 11,002; makefile: 111
file content (42 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * The Python Imaging Library
 * $Id$
 *
 * 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;
}