]> git.imager.perl.org - imager.git/blobdiff - image.c
0.92 release
[imager.git] / image.c
diff --git a/image.c b/image.c
index 6cb49d48a4062327f0f5a8f89ab6466f5e2db84c..a8045f24f884e845c8a7477293234ad1b9b50eb4 100644 (file)
--- a/image.c
+++ b/image.c
@@ -318,7 +318,7 @@ i_img_info(i_img *im, i_img_dim *info) {
 /*
 =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>.
@@ -1236,7 +1236,7 @@ int i_gpixf_fp(i_img *im, i_img_dim x, i_img_dim y, i_fcolor *pix) {
   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;
@@ -1728,19 +1728,24 @@ i_img_is_monochrome(i_img *im, int *zero_is_white) {
 
 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;
 }
 
 /*
@@ -1753,20 +1758,23 @@ floating point color.
 
 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;
 }
 
 /*