Changeset 21183 for trunk/psLib/src/imageops/psImageMaskOps.c
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageMaskOps.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageMaskOps.c
r18494 r21183 8 8 * @author David Robbins, MHPCC 9 9 * 10 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $11 * @date $Date: 200 8-07-12 21:08:33$10 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2009-01-27 06:39:37 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 37 37 psRegion region, 38 38 const char *op, 39 ps MaskType maskValue)39 psImageMaskType maskValue) 40 40 { 41 41 if (image == NULL) { … … 53 53 if ((i + image->col0) < region.x0) continue; \ 54 54 if ((i + image->col0) > region.x1) continue; /* is this correct (not >= ?) */ \ 55 image->data.PS_TYPE_ MASK_DATA[j][i] OP maskValue; \55 image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] OP maskValue; \ 56 56 } \ 57 57 } … … 84 84 psRegion region, 85 85 const char *op, 86 ps MaskType maskValue)86 psImageMaskType maskValue) 87 87 { 88 88 if (image == NULL) { … … 100 100 (i + image->col0) < region.x0 || \ 101 101 (i + image->col0) > region.x1 ) { \ 102 image->data.PS_TYPE_ MASK_DATA[j][i] OP maskValue; \102 image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] OP maskValue; \ 103 103 } } } 104 104 … … 131 131 double radius, 132 132 const char *op, 133 ps MaskType maskValue)133 psImageMaskType maskValue) 134 134 { 135 135 if (image == NULL) { … … 150 150 r2 = PS_SQR(dx) + PS_SQR(dy); \ 151 151 if (r2 <= R2) { \ 152 image->data.PS_TYPE_ MASK_DATA[iy][ix] OP maskValue; \152 image->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] OP maskValue; \ 153 153 } } } 154 154 … … 182 182 double radius, 183 183 const char *op, 184 ps MaskType maskValue)184 psImageMaskType maskValue) 185 185 { 186 186 … … 201 201 r2 = PS_SQR(dx) + PS_SQR(dy); \ 202 202 if (r2 > R2) { \ 203 image->data.PS_TYPE_ MASK_DATA[iy][ix] OP maskValue; \203 image->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] OP maskValue; \ 204 204 } } } 205 205 … … 228 228 psImage *psImageGrowMask(psImage *out, 229 229 const psImage *in, 230 ps MaskType maskVal,230 psImageMaskType maskVal, 231 231 unsigned int growSize, 232 ps MaskType growVal)232 psImageMaskType growVal) 233 233 { 234 234 if (in == NULL) { … … 237 237 return NULL; 238 238 } 239 if (in->type.type != PS_TYPE_ MASK) {239 if (in->type.type != PS_TYPE_IMAGE_MASK) { 240 240 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 241 "Invalid input image. Input image type must match ps MaskType.\n");241 "Invalid input image. Input image type must match psImageMaskType.\n"); 242 242 return NULL; 243 243 } … … 261 261 for (k = 0; k < in->numRows; k++) { 262 262 for (l = 0; l < in->numCols; l++) { 263 out->data.PS_TYPE_ MASK_DATA[k][l] = in->data.PS_TYPE_MASK_DATA[k][l];264 changed->data.PS_TYPE_ MASK_DATA[k][l] = 0;263 out->data.PS_TYPE_IMAGE_MASK_DATA[k][l] = in->data.PS_TYPE_IMAGE_MASK_DATA[k][l]; 264 changed->data.PS_TYPE_IMAGE_MASK_DATA[k][l] = 0; 265 265 } 266 266 } … … 268 268 for (int i = 0; i < in->numRows; i++) { 269 269 for (int j = 0; j < in->numCols; j++) { 270 if ( (in->data.PS_TYPE_ MASK_DATA[i][j] & maskVal) != 0 &&271 changed->data.PS_TYPE_ MASK_DATA[i][j] == 0) {270 if ( (in->data.PS_TYPE_IMAGE_MASK_DATA[i][j] & maskVal) != 0 && 271 changed->data.PS_TYPE_IMAGE_MASK_DATA[i][j] == 0) { 272 272 m = i - growSize; 273 273 if (m < 0) { … … 281 281 for (l = n; l <= (j + growSize) && l < in->numCols; l++) { 282 282 if (((k-i)*(k-i) + (l-j)*(l-j)) <= (growSize*growSize)) { 283 out->data.PS_TYPE_ MASK_DATA[k][l] |= growVal;284 if ( (in->data.PS_TYPE_ MASK_DATA[i][j] & maskVal) == 0 ) {285 changed->data.PS_TYPE_ MASK_DATA[k][l] = 1;283 out->data.PS_TYPE_IMAGE_MASK_DATA[k][l] |= growVal; 284 if ( (in->data.PS_TYPE_IMAGE_MASK_DATA[i][j] & maskVal) == 0 ) { 285 changed->data.PS_TYPE_IMAGE_MASK_DATA[k][l] = 1; 286 286 } 287 287 }
Note:
See TracChangeset
for help on using the changeset viewer.
