Changeset 6579
- Timestamp:
- Mar 13, 2006, 5:35:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/mathtypes/psImage.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r6578 r6579 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.9 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-03-14 03: 25:48$11 * @version $Revision: 1.98 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-03-14 03:35:14 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 168 168 // - flip x0,x1 if x0>x1 169 169 // - flip y0,y1 if y0>y1 170 // psRegion in refers to coordinates in the170 // XXX EAM : psRegion refers to coordinates in the *parent* image 171 171 psRegion psRegionForImage(psImage *image, 172 172 psRegion in) … … 178 178 179 179 // convert non-positive upper-limits 180 in.x1 = (in.x1 <= 0) ? (image->numCols + in.x1) : in.x1; 181 in.y1 = (in.y1 <= 0) ? (image->numRows + in.y1) : in.y1; 182 183 // force the upper-limits to be on the image 184 in.x1 = PS_MIN(image->numCols, in.x1); 185 in.y1 = PS_MIN(image->numRows, in.y1); 186 187 // force the lower-limits to be on the image 188 in.x0 = PS_MAX(0, in.x0); 189 in.y0 = PS_MAX(0, in.y0); 190 in.x0 = PS_MIN(image->numCols, in.x0); 191 in.y0 = PS_MIN(image->numRows, in.y0); 180 // XXX note that the upper limit in these cases is defined relative to the subimage 181 // also note that truncation limits to the valid subimage pixels 182 in.x1 = (in.x1 <= 0) ? (image->col0 + image->numCols + in.x1) : in.x1; 183 in.y1 = (in.y1 <= 0) ? (image->row0 + image->numRows + in.y1) : in.y1; 184 185 // force the upper-limits to be on the subimage 186 in.x1 = PS_MIN(image->col0 + image->numCols, in.x1); 187 in.y1 = PS_MIN(image->row0 + image->numRows, in.y1); 188 189 // force the lower-limits to be on the subimage 190 in.x0 = PS_MAX(image->col0, in.x0); 191 in.y0 = PS_MAX(image->row0, in.y0); 192 in.x0 = PS_MIN(image->col0 + image->numCols, in.x0); 193 in.y0 = PS_MIN(image->row0 + image->numRows, in.y0); 192 194 193 195 // flip start and end if out of order … … 300 302 return false; 301 303 } 302 304 303 305 if(x < 0) 304 306 x += image->numRows; … … 307 309 return false; 308 310 } 309 311 310 312 if(y < 0) 311 313 y += image->numCols; … … 314 316 return false; 315 317 } 316 318 317 319 */ 318 320 PS_ASSERT_IMAGE_NON_NULL(image, false); … … 422 424 return NAN; 423 425 } 424 426 425 427 if(x < 0) 426 428 x += image->numRows; … … 429 431 return NAN; 430 432 } 431 433 432 434 if(y < 0) 433 435 y += image->numCols;
Note:
See TracChangeset
for help on using the changeset viewer.
