summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Imager/include/immacros.h
blob: 9d5757445bfc6ef1a470da333f7ce05202f2e88b (plain)
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
/* 
   Imager "functions" implemented as macros 

   I suppose these could go in imdatatypes, but they aren't types.
*/
#ifndef IMAGER_IMMACROS_H_
#define IMAGER_IMMACROS_H_

/*
=item i_img_has_alpha(im)

=category Image Information

Return true if the image has an alpha channel.

=cut
*/

#define i_img_has_alpha(im) ((im)->channels == 2 || (im)->channels == 4)

/*
=item i_img_color_channels(im)

=category Image Information

The number of channels holding color information.

=cut
*/

#define i_img_color_channels(im) (i_img_has_alpha(im) ? (im)->channels - 1 : (im)->channels)

#endif