summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Imager/include/immacros.h
diff options
context:
space:
mode:
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