Changeset 25585
- Timestamp:
- Sep 27, 2009, 10:21:09 AM (17 years ago)
- Location:
- branches/eam_branches/20090715/psLib/src/imageops
- Files:
-
- 2 edited
-
psImageMaskOps.c (modified) (1 diff)
-
psImageMaskOps.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psLib/src/imageops/psImageMaskOps.c
r21183 r25585 223 223 psError(PS_ERR_BAD_PARAMETER_VALUE,true, 224 224 "The logical operation specified is incorrect\n"); 225 return; 226 } 227 228 // perform the mask operation on the image pixels 229 void psImageMaskPixels(psImage *image, 230 const char *op, 231 psImageMaskType maskValue) 232 { 233 if (image == NULL) { 234 psError(PS_ERR_BAD_PARAMETER_NULL, true, "Invalid image input. Image is NULL.\n"); 235 return; 236 } 237 238 # define MASK_IT_IMAGE(OP) \ 239 for (int iy = 0; iy < image->numRows; iy++) { \ 240 for (int ix = 0; ix < image->numCols; ix++) { \ 241 image->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] OP maskValue; \ 242 } } 243 244 if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) { 245 MASK_IT_IMAGE (&=); 246 return; 247 } 248 if ( !strncmp(op, "|", 2) || !strncmp(op, "OR", 5) ) { 249 MASK_IT_IMAGE (|=); 250 return; 251 } 252 if ( !strncmp(op, "=", 2) || !strncmp(op, "EQUAL", 5) ) { 253 MASK_IT_IMAGE (=); 254 return; 255 } 256 if ( !strncmp(op, "^", 2) || !strncmp(op, "XOR", 5) ) { 257 MASK_IT_IMAGE (^=); 258 return; 259 } 260 261 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "The logical operation specified is incorrect\n"); 225 262 return; 226 263 } -
branches/eam_branches/20090715/psLib/src/imageops/psImageMaskOps.h
r21183 r25585 22 22 #include "psStats.h" 23 23 #include "psPixels.h" 24 25 /** Perform the mask opertion on all image pixels 26 * 27 * The pixels are set by combining the existing pixel value and the given maskValue 28 * with a logical operation. The allowed operations are =, AND, OR, and XOR. 29 */ 30 void psImageMaskPixels(psImage *image, 31 const char *op, 32 psImageMaskType maskValue); 24 33 25 34 /** Sets the bits inside the region, ignoring pixels outside.
Note:
See TracChangeset
for help on using the changeset viewer.
