]>
Commit | Line | Data |
---|---|---|
b13a3ddb | 1 | #define PERL_NO_GET_CONTEXT |
88666683 TC |
2 | #ifdef __cplusplus |
3 | extern "C" { | |
4 | #endif | |
5 | #include "EXTERN.h" | |
6 | #include "perl.h" | |
7 | #include "XSUB.h" | |
8 | #include "ppport.h" | |
9 | #ifdef __cplusplus | |
10 | } | |
11 | #endif | |
12 | ||
13 | #include "imext.h" | |
14 | #include "imperl.h" | |
15 | ||
16 | unsigned char | |
17 | static | |
18 | saturate(int in) { | |
19 | if (in>255) { return 255; } | |
20 | else if (in>0) return in; | |
21 | return 0; | |
22 | } | |
23 | ||
ac575c5f | 24 | static void |
88666683 TC |
25 | flines(i_img *im) { |
26 | i_color vl; | |
8d14daab | 27 | i_img_dim x,y; |
ac575c5f | 28 | |
88666683 | 29 | for(y = 0; y < im->ysize; y ++) { |
ac575c5f TC |
30 | float yf, mf; |
31 | if (!(y%2)) { | |
32 | yf = y/(double)im->ysize; | |
33 | } | |
34 | else { | |
35 | yf = (im->ysize-y)/(double)im->ysize; | |
36 | } | |
37 | mf = 1.2-0.8*yf; | |
38 | ||
88666683 TC |
39 | for(x = 0; x < im->xsize; x ++ ) { |
40 | i_gpix(im,x,y,&vl); | |
ac575c5f TC |
41 | vl.rgb.r = saturate(vl.rgb.r*mf); |
42 | vl.rgb.g = saturate(vl.rgb.g*mf); | |
43 | vl.rgb.b = saturate(vl.rgb.b*mf); | |
44 | i_ppix(im,x,y,&vl); | |
88666683 TC |
45 | } |
46 | } | |
47 | } | |
48 | ||
49 | ||
50 | DEFINE_IMAGER_CALLBACKS; | |
51 | ||
52 | MODULE = Imager::Filter::Flines PACKAGE = Imager::Filter::Flines | |
53 | ||
8343cc76 TC |
54 | PROTOTYPES: ENABLE |
55 | ||
88666683 TC |
56 | void |
57 | flines(im) | |
58 | Imager::ImgRaw im | |
59 | ||
60 | BOOT: | |
61 | PERL_INITIALIZE_IMAGER_CALLBACKS; | |
62 |