Index: trunk/psLib/src/imageops/psImageMaskOps.c
===================================================================
--- trunk/psLib/src/imageops/psImageMaskOps.c	(revision 21183)
+++ trunk/psLib/src/imageops/psImageMaskOps.c	(revision 25753)
@@ -223,4 +223,41 @@
     psError(PS_ERR_BAD_PARAMETER_VALUE,true,
 	    "The logical operation specified is incorrect\n");
+    return;
+}
+
+// perform the mask operation on the image pixels
+void psImageMaskPixels(psImage *image,
+                       const char *op,
+                       psImageMaskType maskValue)
+{
+    if (image == NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, true, "Invalid image input.  Image is NULL.\n");
+        return;
+    }
+
+# define MASK_IT_IMAGE(OP) \
+    for (int iy = 0; iy < image->numRows; iy++) { \
+        for (int ix = 0; ix < image->numCols; ix++) { \
+	    image->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] OP maskValue; \
+	} }
+
+    if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) {
+      MASK_IT_IMAGE (&=);
+      return;
+    } 
+    if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) {
+      MASK_IT_IMAGE (|=);
+      return;
+    } 
+    if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) {
+      MASK_IT_IMAGE (=);
+      return;
+    } 
+    if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) {
+      MASK_IT_IMAGE (^=);
+      return;
+    } 
+
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "The logical operation specified is incorrect\n");
     return;
 }
