1 /* XPaint-filter */
2
3 #include <Xpaint.h>
4
5 /*
6 * The key-word "FilterProcess" is reserved for user-defined filter routines;
7 * Such a filter processes an "input" image and renders an "output" image.
8 *
9 * Pixels are unsigned char arrays p[0]=red, p[1]=green, p[2]=blue
10 * (thus each value should be in the range 0..255)
11 *
12 * In the example below, ip = input pixel, op = output pixel
13 * the procedure just rotates the image to the left
14 */
15
FilterProcess(Image * input,Image * output)16 void FilterProcess(Image * input, Image * output)
17 {
18 unsigned char *ip, *op;
19 int x, y;
20
21 if (input->height < input->width)
22 for (y = 0; y < input->height; y++) {
23 for (x = 0; x < input->height; x++) {
24 ip = ImagePixel(input, input->height-1-x, y);
25 op = ImagePixel(output, y, x);
26 memcpy(op, ip, 3);
27 }
28 } else
29 for (y = 0; y < input->width; y++) {
30 for (x = 0; x < input->width; x++) {
31 ip = ImagePixel(input, input->width-1-x, y);
32 op = ImagePixel(output, y, x);
33 memcpy(op, ip, 3);
34 }
35 }
36 }
37
38
39