- a little more documentation for Imager::Probe.
+ - the i_get_file_background() and i_get_file_backgroundf() APIs now
+ return int to indicate whether the i_background tag was found.
+
Imager 0.89 - 18 Mar 2012
===========
Retrieve the file write background color tag from the image.
-If not present, returns black.
+If not present, C<bg> is set to black.
+
+Returns 1 if the C<i_background> tag was found and valid.
=cut
*/
-void
+int
i_get_file_background(i_img *im, i_color *bg) {
- if (!i_tags_get_color(&im->tags, "i_background", 0, bg)) {
+ int result = i_tags_get_color(&im->tags, "i_background", 0, bg);
+ if (!result) {
/* black default */
bg->channel[0] = bg->channel[1] = bg->channel[2] = 0;
}
/* always full alpha */
bg->channel[3] = 255;
+
+ return result;
}
/*
Implemented in terms of i_get_file_background().
-If not present, returns black.
+If not present, C<bg> is set to black.
+
+Returns 1 if the C<i_background> tag was found and valid.
=cut
*/
-void
+int
i_get_file_backgroundf(i_img *im, i_fcolor *fbg) {
i_color bg;
-
- i_get_file_background(im, &bg);
+ int result = i_get_file_background(im, &bg);
fbg->rgba.r = Sample8ToF(bg.rgba.r);
fbg->rgba.g = Sample8ToF(bg.rgba.g);
fbg->rgba.b = Sample8ToF(bg.rgba.b);
fbg->rgba.a = 1.0;
+
+ return result;
}
/*
extern i_img *i_img_to_drgb(i_img *im);
extern int i_img_is_monochrome(i_img *im, int *zero_is_white);
-extern void i_get_file_background(i_img *im, i_color *bg);
-extern void i_get_file_backgroundf(i_img *im, i_fcolor *bg);
+extern int i_get_file_background(i_img *im, i_color *bg);
+extern int i_get_file_backgroundf(i_img *im, i_fcolor *bg);
const char * i_test_format_probe(io_glue *data, int length);
Version 4 added i_psamp() and i_psampf() pointers to the i_img
structure.
+ Version 5 changed the return types of i_get_file_background() and
+ i_get_file_backgroundf() from void to int.
+
*/
-#define IMAGER_API_VERSION 4
+#define IMAGER_API_VERSION 5
/*
IMAGER_API_LEVEL is the level of the structure. New function pointers
int out_channels, i_color const * bg);
int (*f_i_gsampf_bg)(i_img *im, i_img_dim l, i_img_dim r, i_img_dim y, i_fsample_t *samples,
int out_channels, i_fcolor const * bg);
- void (*f_i_get_file_background)(i_img *im, i_color *bg);
- void (*f_i_get_file_backgroundf)(i_img *im, i_fcolor *bg);
+ int (*f_i_get_file_background)(i_img *im, i_color *bg);
+ int (*f_i_get_file_backgroundf)(i_img *im, i_fcolor *bg);
unsigned long (*f_i_utf8_advance)(char const **p, size_t *len);
i_render *(*f_i_render_new)(i_img *im, i_img_dim width);
void (*f_i_render_delete)(i_render *r);
void (*f_io_glue_destroy)(i_io_glue_t *ig);
/* IMAGER_API_LEVEL 8 functions will be added here */
-
+
} im_ext_funcs;
#define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table"
Retrieve the file write background color tag from the image.
-If not present, returns black.
+If not present, C<bg> is set to black.
+
+Returns 1 if the C<i_background> tag was found and valid.
=for comment
Implemented in terms of i_get_file_background().
-If not present, returns black.
+If not present, C<bg> is set to black.
+
+Returns 1 if the C<i_background> tag was found and valid.
=for comment