/*
=item i_img_setmask(C<im>, C<ch_mask>)
=category Image Information
-=synopsis // only channel 0 writeable
+=synopsis // only channel 0 writable
=synopsis i_img_setmask(img, 0x01);
Set the image channel mask for C<im> to C<ch_mask>.
i_color temp;
int ch;
- if (i_gpix(im, x, y, &temp)) {
+ if (i_gpix(im, x, y, &temp) == 0) {
for (ch = 0; ch < im->channels; ++ch)
pix->channel[ch] = Sample8ToF(temp.channel[ch]);
return 0;
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;
}
/*