Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 78 lines (54 sloc) 2.136 kb
bea65b1f » Tony Cook
2007-12-03 - the hardinvert filter no-longer inverts the alpha channel.
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 » Tony Cook
2010-04-12 huge spelling update and spell checking patch
10 =item i_img_has_alpha(C<im>)
bea65b1f » Tony Cook
2007-12-03 - the hardinvert filter no-longer inverts the alpha channel.
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 » Tony Cook
2010-04-12 huge spelling update and spell checking patch
22 =item i_img_color_channels(C<im>)
bea65b1f » Tony Cook
2007-12-03 - the hardinvert filter no-longer inverts the alpha channel.
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
836d9f54 »
2012-01-30 add psamp(), psampf() to C image API
33 /*
34 =item i_psamp(im, left, right, y, samples, channels, channel_count)
35 =category Drawing
36
37 Writes sample values from C<samples> to C<im> for the horizontal line
38 (left, y) to (right-1, y) inclusive for the channels specified by
39 C<channels>, an array of C<int> with C<channel_count> elements.
40
41 If C<channels> is C<NULL> then the first C<channels_count> channels
42 are written to for each pixel.
43
44 Returns the number of samples written, which should be (right - left)
45 * channel_count. If a channel not in the image is in channels, left
46 is negative, left is outside the image or y is outside the image,
47 returns -1 and pushes an error.
48
49 =cut
50 */
51
52 #define i_psamp(im, l, r, y, samps, chans, count) \
53 (((im)->i_f_psamp)((im), (l), (r), (y), (samps), (chans), (count)))
54
55 /*
56 =item i_psampf(im, left, right, y, samples, channels, channel_count)
57 =category Drawing
58
59 Writes floating point sample values from C<samples> to C<im> for the
60 horizontal line (left, y) to (right-1, y) inclusive for the channels
61 specified by C<channels>, an array of C<int> with C<channel_count>
62 elements.
63
64 If C<channels> is C<NULL> then the first C<channels_count> channels
65 are written to for each pixel.
66
67 Returns the number of samples written, which should be (right - left)
68 * channel_count. If a channel not in the image is in channels, left
69 is negative, left is outside the image or y is outside the image,
70 returns -1 and pushes an error.
71
72 =cut
73 */
74
75 #define i_psampf(im, l, r, y, samps, chans, count) \
76 (((im)->i_f_psampf)((im), (l), (r), (y), (samps), (chans), (count)))
77
bea65b1f » Tony Cook
2007-12-03 - the hardinvert filter no-longer inverts the alpha channel.
78 #endif
Something went wrong with that request. Please try again.