]> git.imager.perl.org - imager.git/blobdiff - immacros.h
invalid quantization options now result in an error rather than defaults
[imager.git] / immacros.h
index e4a3051863efccc1c01c92630307d9f58c9e7ed7..8b45f58781ee50e888dfa10ea5b498766999791b 100644 (file)
@@ -16,19 +16,7 @@ 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(C<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)
+#define i_img_has_alpha(im) (i_img_alpha_channel((im), NULL))
 
 /*
 =item i_psamp(im, left, right, y, samples, channels, channel_count)
@@ -134,6 +122,7 @@ returns -1 and pushes an error.
 #define dIMCTXctx(ctx) pIMCTX = (ctx)
 #define dIMCTX dIMCTXctx(im_get_context())
 #define dIMCTXim(im) dIMCTXctx((im)->context)
+#define dIMCTXio(io) dIMCTXctx((io)->context)
 #define aIMCTX my_im_ctx
 #else
 #define aIMCTX im_get_context()
@@ -154,6 +143,7 @@ returns -1 and pushes an error.
 #define i_clear_error() im_clear_error(aIMCTX)
 #define i_push_errorvf(code, fmt, args) im_push_errorvf(aIMCTX, code, fmt, args)
 #define i_push_error(code, msg) im_push_error(aIMCTX, code, msg)
+#define i_errors() im_errors(aIMCTX)
 
 #define io_new_fd(fd) im_io_new_fd(aIMCTX, (fd))
 #define io_new_bufchain() im_io_new_bufchain(aIMCTX)