summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Imager/include/immacros.h
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-05-12 16:54:37 +0000
committerNorbert Preining <preining@logic.at>2010-05-12 16:54:37 +0000
commit661c41a09e39a182865e0b51e34cc995a0dc96e8 (patch)
tree2f79bb1406e22fdcb2587be8ffda6c0c609d7932 /Master/tlpkg/tlperl/lib/Imager/include/immacros.h
parentb645030efc22e13c2498a1522083634ab91b2de1 (diff)
move tlperl.straw to tlperl
git-svn-id: svn://tug.org/texlive/trunk@18210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Imager/include/immacros.h')
-rwxr-xr-xMaster/tlpkg/tlperl/lib/Imager/include/immacros.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/Imager/include/immacros.h b/Master/tlpkg/tlperl/lib/Imager/include/immacros.h
new file mode 100755
index 00000000000..9d5757445bf
--- /dev/null
+++ b/Master/tlpkg/tlperl/lib/Imager/include/immacros.h
@@ -0,0 +1,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