Commit | Line | Data |
---|---|---|
bea65b1f TC |
1 | /* |
2 | Imager "functions" implemented as macros | |
3 | ||
4 | I suppose these could go in imdatatypes, but they aren't types. | |
5 | */ | |
6 | #ifndef IMAGER_IMMACROS_H_ | |
7 | #define IMAGER_IMMACROS_H_ | |
8 | ||
9 | /* | |
5715f7c3 | 10 | =item i_img_has_alpha(C<im>) |
bea65b1f TC |
11 | |
12 | =category Image Information | |
13 | ||
14 | Return true if the image has an alpha channel. | |
15 | ||
16 | =cut | |
17 | */ | |
18 | ||
19 | #define i_img_has_alpha(im) ((im)->channels == 2 || (im)->channels == 4) | |
20 | ||
21 | /* | |
5715f7c3 | 22 | =item i_img_color_channels(C<im>) |
bea65b1f TC |
23 | |
24 | =category Image Information | |
25 | ||
26 | The number of channels holding color information. | |
27 | ||
28 | =cut | |
29 | */ | |
30 | ||
31 | #define i_img_color_channels(im) (i_img_has_alpha(im) ? (im)->channels - 1 : (im)->channels) | |
32 | ||
33 | #endif |