Index: trunk/psLib/src/imageops/Makefile.am
===================================================================
--- trunk/psLib/src/imageops/Makefile.am	(revision 5224)
+++ trunk/psLib/src/imageops/Makefile.am	(revision 5227)
@@ -10,5 +10,6 @@
 	psImagePixelManip.c \
 	psImageStats.c \
-	psImageStructManip.c
+	psImageStructManip.c \
+    psImageMaskOps.c
 
 EXTRA_DIST = imageops.i
@@ -21,3 +22,4 @@
 	psImagePixelManip.h \
 	psImageStats.h \
-	psImageStructManip.h
+	psImageStructManip.h \
+    psImageMaskOps.h
Index: trunk/psLib/src/imageops/psImagePixelManip.c
===================================================================
--- trunk/psLib/src/imageops/psImagePixelManip.c	(revision 5224)
+++ trunk/psLib/src/imageops/psImagePixelManip.c	(revision 5227)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-05 03:51:43 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-10-06 02:41:07 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -396,194 +396,2 @@
 }
 
-// mask the area contained by the region
-// the region is defined wrt the parent image
-void psImageMaskRegion(psImage *image,
-                       psRegion region,
-                       const char *op,
-                       psMaskType maskValue)
-{
-    for (int j = 0; j < image->numRows; j++) {
-        for (int i = 0; i < image->numCols; i++) {
-            if ( (j + image->row0) >= region.y0 &&
-                    (j + image->row0) <= region.y1 &&
-                    (i + image->col0) >= region.x0 &&
-                    (i + image->col0) <= region.x1 ) {
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] ^= maskValue;
-                } else {
-                    psError(PS_ERR_BAD_PARAMETER_VALUE,true,
-                            "The logical operation specified is incorrect\n");
-                    return;
-                }
-            }
-        }
-    }
-    /*
-        for (int iy = 0; iy < image->numRows; iy++) {
-            for (int ix = 0; ix < image->numCols; ix++) {
-                if (ix + image->col0 >=  region.x0)
-                    continue;
-                if (ix + image->col0 <= region.x1)
-                    continue;
-                if (iy + image->row0 >=  region.y0)
-                    continue;
-                if (iy + image->row0 <= region.y1)
-                    continue;
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] ^= maskValue;
-                }
-            }
-        }
-    */
-}
-
-// mask the area not contained by the region
-// the region is defined wrt the parent image
-void psImageKeepRegion(psImage *image,
-                       psRegion region,
-                       const char *op,
-                       psMaskType maskValue)
-{
-    for (int j = 0; j < image->numRows; j++) {
-        for (int i = 0; i < image->numCols; i++) {
-            if ( (j + image->row0) < region.y0 ||
-                    (j + image->row0) > region.y1 ||
-                    (i + image->col0) < region.x0 ||
-                    (i + image->col0) > region.x1 ) {
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[j][i] ^= maskValue;
-                } else {
-                    psError(PS_ERR_BAD_PARAMETER_VALUE,true,
-                            "The logical operation specified is incorrect\n");
-                    return;
-                }
-            }
-        }
-    }
-    /*
-        for (int iy = 0; iy < image->numRows; iy++) {
-            for (int ix = 0; ix < image->numCols; ix++) {
-                if (ix + image->col0 <  region.x0)
-                    goto maskit;
-                if (ix + image->col0 > region.x1)
-                    goto maskit;
-                if (iy + image->row0 <  region.y0)
-                    goto maskit;
-                if (iy + image->row0 > region.y1)
-                    goto maskit;
-                continue;
-    maskit:
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] ^= maskValue;
-                }
-            }
-        }
-    */
-}
-
-// mask the area contained by the region
-// the region is defined wrt the parent image
-void psImageMaskCircle(psImage *image,
-                       double x,
-                       double y,
-                       double radius,
-                       const char *op,
-                       psMaskType maskValue)
-{
-    if (image == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                "Invalid image input.  Image is NULL.\n");
-        return;
-    }
-
-
-    double dx, dy, r2, R2;
-
-    R2 = PS_SQR(radius);
-
-    for (int iy = 0; iy < image->numRows; iy++) {
-        for (int ix = 0; ix < image->numCols; ix++) {
-            dx = ix + image->col0 - x;
-            dy = iy + image->row0 - y;
-            r2 = PS_SQR(dx) + PS_SQR(dy);
-            if (r2 <= R2) {
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] ^= maskValue;
-                } else {
-                    psError(PS_ERR_BAD_PARAMETER_VALUE,true,
-                            "The logical operation specified is incorrect\n");
-                    return;
-                }
-            }
-        }
-    }
-}
-
-// mask the area contained by the region
-// the region is defined wrt the parent image
-void psImageKeepCircle(psImage *image,
-                       double x,
-                       double y,
-                       double radius,
-                       const char *op,
-                       psMaskType maskValue)
-{
-
-    double dx, dy, r2, R2;
-
-    R2 = PS_SQR(radius);
-
-    for (int iy = 0; iy < image->numRows; iy++) {
-        for (int ix = 0; ix < image->numCols; ix++) {
-            dx = ix + image->col0 - x;
-            dy = iy + image->row0 - y;
-            r2 = PS_SQR(dx) + PS_SQR(dy);
-            if (r2 > R2) {
-                if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] &= maskValue;
-                } else if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] |= maskValue;
-                } else if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] = maskValue;
-                } else if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
-                    image->data.PS_TYPE_MASK_DATA[iy][ix] ^= maskValue;
-                } else {
-                    psError(PS_ERR_BAD_PARAMETER_VALUE,true,
-                            "The logical operation specified is incorrect\n");
-                    return;
-                }
-            }
-        }
-    }
-}
-
Index: trunk/psLib/src/imageops/psImagePixelManip.h
===================================================================
--- trunk/psLib/src/imageops/psImagePixelManip.h	(revision 5224)
+++ trunk/psLib/src/imageops/psImagePixelManip.h	(revision 5227)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-16 23:56:48 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-10-06 02:41:07 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -87,55 +87,4 @@
     const char *op                     ///< the operation to perform for overlay
 );
-/** Sets the bits inside the region, ignoring pixels outside.
- *
- *  The pixels are set by combining the existing pixel value and the given maskValue
- *  with a logical operation.  The allowed operations are =, AND, OR, and XOR.
- */
-void psImageMaskRegion(
-    psImage *image,                    ///< the image to set
-    psRegion region,                   ///< the specified region
-    const char *op,                    ///< the logical operation
-    psMaskType maskValue               ///< the specified bits
-);
-
-/** Sets the bits outside the region, ignoring pixels inside.
- *
- *  The pixels are set by combining the existing pixel value and the given maskValue
- *  with a logical operation.  The allowed operations are =, AND, OR, and XOR.
- */
-void psImageKeepRegion(
-    psImage *image,                    ///< the image to set
-    psRegion region,                   ///< the specified region
-    const char *op,                    ///< the logical operation
-    psMaskType maskValue               ///< the specified bits
-);
-
-/** Sets the bits inside the circle, ignoring the pixels outside.
- *
- *  The pixel values are set by combining the existing pixel value and the given maskValue
- *  with a logical operation.  The allowed operations are =, AND, OR, and XOR.
- */
-void psImageMaskCircle(
-    psImage *image,                    ///< the image to set
-    double x,                          ///< the x coordinate of the circle's center
-    double y,                          ///< the y coordinate of the circle's center
-    double radius,                     ///< the radius of the specified circle
-    const char *op,                    ///< the logical operation
-    psMaskType maskValue               ///< the specified bits
-);
-
-/** Sets the bits outside the circle, ignoring the pixels inside.
- *
- *  The pixel values are set by combining the existing pixel value and the given maskValue
- *  with a logical operation.  The allowed operations are =, AND, OR, and XOR.
- */
-void psImageKeepCircle(
-    psImage *image,                    ///< the image to set
-    double x,                          ///< the x coordinate of the circle's center
-    double y,                          ///< the y coordinate of the circle's center
-    double radius,                     ///< the radius of the specified circle
-    const char *op,                    ///< the logical operation
-    psMaskType maskValue               ///< the specified bits
-);
 
 #endif // #ifndef PS_IMAGE_PIXEL_MANIP_H
