Index: trunk/psLib/src/imageops/psImageInterpolate.c
===================================================================
--- trunk/psLib/src/imageops/psImageInterpolate.c	(revision 12802)
+++ trunk/psLib/src/imageops/psImageInterpolate.c	(revision 13483)
@@ -7,6 +7,6 @@
  *  @author Paul Price, IfA
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-04-11 19:54:47 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-23 02:55:01 $
  *
  *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
@@ -65,6 +65,7 @@
 
 // Interpolation engine for flat mode (nearest pixel)
-static inline bool interpolateFlat(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                                   float x, float y, const psImageInterpolateOptions *options)
+static inline psImageInterpolateStatus interpolateFlat(double *imageValue, double *varianceValue,
+                                                       psMaskType *maskValue, float x, float y,
+                                                       const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -87,4 +88,6 @@
             *maskValue = options->badMask;
         }
+
+        return PS_INTERPOLATE_STATUS_OFF;
     } else {
 
@@ -115,5 +118,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     options->image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
 
@@ -122,10 +125,11 @@
         }
     }
-    return true;
+    return PS_INTERPOLATE_STATUS_GOOD;
 }
 
 // Interpolation engine using interpolation kernel
-static bool interpolateKernel(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                               float x, float y, const psImageInterpolateOptions *options)
+static psImageInterpolateStatus interpolateKernel(double *imageValue, double *varianceValue,
+                                                  psMaskType *maskValue, float x, float y,
+                                                  const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -171,5 +175,5 @@
             *maskValue = options->badMask;
         }
-        return true;
+        return PS_INTERPOLATE_STATUS_OFF;
     }
     double kernel[yNum][xNum];          // Interpolation kernel for straight interpolation
@@ -259,5 +263,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
     }
@@ -265,4 +269,5 @@
     // Check the mask value
     const psImage *mask = options->mask; // Image mask
+    psImageInterpolateStatus status = PS_INTERPOLATE_STATUS_GOOD; // Status of interpolation
     if (maskValue && mask) {
         *maskValue = 0;
@@ -285,6 +290,8 @@
             if (badContrib / totContrib >= options->poorFrac) {
                 *maskValue |= options->badMask;
+                status = PS_INTERPOLATE_STATUS_BAD;
             } else {
                 *maskValue |= options->poorMask;
+            status = PS_INTERPOLATE_STATUS_POOR;
             }
         }
@@ -321,9 +328,9 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
-        }
-    }
-
-    return true;
+            return PS_INTERPOLATE_STATUS_ERROR;
+        }
+    }
+
+    return status;
 }
 
@@ -364,6 +371,7 @@
 
 // Interpolation engine for separable interpolation kernels (either for good reasons or for practical reasons)
-static bool interpolateSeparate(double *imageValue, double *varianceValue, psMaskType *maskValue,
-                               float x, float y, const psImageInterpolateOptions *options)
+static psImageInterpolateStatus interpolateSeparate(double *imageValue, double *varianceValue,
+                                               psMaskType *maskValue, float x, float y,
+                                               const psImageInterpolateOptions *options)
 {
     // Parameters have been checked by psImageInterpolate()
@@ -406,5 +414,5 @@
             *maskValue = options->badMask;
         }
-        return true;
+        return PS_INTERPOLATE_STATUS_OFF;
     }
 
@@ -477,5 +485,5 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     image->type.type);
-            return false;
+            return PS_INTERPOLATE_STATUS_ERROR;
         }
     }
@@ -483,4 +491,5 @@
     // Check the mask value
     const psImage *mask = options->mask; // Image mask
+    psImageInterpolateStatus status = PS_INTERPOLATE_STATUS_GOOD; // Status of interpolation
     if (maskValue && mask) {
         psMaskType maskVal = options->maskVal; // Mask value
@@ -509,6 +518,8 @@
             if (badContrib / totContrib >= options->poorFrac) {
                 *maskValue |= options->badMask;
+                status = PS_INTERPOLATE_STATUS_BAD;
             } else {
                 *maskValue |= options->poorMask;
+                status = PS_INTERPOLATE_STATUS_POOR;
             }
         }
@@ -547,17 +558,17 @@
             psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unrecognised type for image: %x",
                     variance->type.type);
-            return false;
-        }
-    }
-
-    return true;
-}
-
-
-
-bool psImageInterpolate(double *imageValue, double *varianceValue, psMaskType *maskValue,
+            return PS_INTERPOLATE_STATUS_ERROR;
+        }
+    }
+
+    return status;
+}
+
+
+
+psImageInterpolateStatus psImageInterpolate(double *imageValue, double *varianceValue, psMaskType *maskValue,
                         float x, float y, const psImageInterpolateOptions *options)
 {
-    PS_ASSERT_PTR_NON_NULL(options, false);
+    PS_ASSERT_PTR_NON_NULL(options, PS_INTERPOLATE_STATUS_ERROR);
 
     const psImage *image = options->image; // Image to interpolate
@@ -565,17 +576,17 @@
     const psImage *variance = options->variance; // Variance to interpolate
 
-    PS_ASSERT_IMAGE_NON_NULL(image, false);
+    PS_ASSERT_IMAGE_NON_NULL(image, PS_INTERPOLATE_STATUS_ERROR);
     if (varianceValue && variance) {
-        PS_ASSERT_IMAGE_NON_NULL(variance, false);
-        PS_ASSERT_IMAGE_TYPE(variance, image->type.type, false);
-        PS_ASSERT_IMAGES_SIZE_EQUAL(variance, image, false);
+        PS_ASSERT_IMAGE_NON_NULL(variance, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGE_TYPE(variance, image->type.type, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(variance, image, PS_INTERPOLATE_STATUS_ERROR);
     }
     if (maskValue && mask) {
-        PS_ASSERT_IMAGE_NON_NULL(mask, false);
-        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, false);
-        PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, false);
-    }
-
-    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(options->poorFrac, 0.0, false);
+        PS_ASSERT_IMAGE_NON_NULL(mask, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, PS_INTERPOLATE_STATUS_ERROR);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, PS_INTERPOLATE_STATUS_ERROR);
+    }
+
+    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(options->poorFrac, 0.0, PS_INTERPOLATE_STATUS_ERROR);
 
     switch (options->mode) {
@@ -594,9 +605,9 @@
                 _("Specified interpolation method (%d) is not supported."),
                 options->mode);
-        return false;
+        return PS_INTERPOLATE_STATUS_ERROR;
     }
 
     psAbort("Should never reach here.");
-    return false;
+    return PS_INTERPOLATE_STATUS_ERROR;
 }
 
