Changeset 1918 for trunk/psLib/src/image/psImageExtraction.c
- Timestamp:
- Sep 27, 2004, 4:27:58 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageExtraction.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageExtraction.c
r1897 r1918 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09-2 5 02:06:12$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-28 02:27:58 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 27 27 psImage* psImageSubset(psImage* image, 28 unsigned int numCols,29 unsigned int numRows,30 unsigned int col0,31 unsigned int row0)28 int col0, 29 int row0, 30 int col1, 31 int row1) 32 32 { 33 33 psImage* out; … … 49 49 } 50 50 51 if (numCols < 1 || numRows < 1) { 52 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset", 53 PS_ERR_BAD_PARAMETER_VALUE, true, 54 PS_ERRORTEXT_psImage_AREA_NEGATIVE, 55 numCols,numRows); 56 return NULL; 57 } 58 59 if ( col0 >= image->numCols || 51 if (col1 < 1) { 52 col1 = image->numCols + col1; 53 } 54 if (row1 < 1) { 55 row1 = image->numRows + row1; 56 } 57 58 if ( col1 <= col0 || 59 row1 <= row0 || 60 col0 >= image->numCols || 60 61 row0 >= image->numRows || 61 col 0 + numCols >=image->numCols ||62 row 0 + numRows >=image->numRows ) {62 col1 > image->numCols || 63 row1 > image->numRows ) { 63 64 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset", 64 65 PS_ERR_BAD_PARAMETER_VALUE, true, 65 66 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID, 66 col0, col 0 + numCols, row0, row0 + numRows,67 col0, col1, row0, row1, 67 68 image->numCols, image->numRows); 68 69 return NULL; 69 70 } 71 int numRows = row1-row0; 72 int numCols = col1-row0; 70 73 71 74 elementSize = PSELEMTYPE_SIZEOF(image->type.type); … … 123 126 return NULL; 124 127 } 125 return psImageSubset(image,x 2-x1+1,y2-y1+1,x1,y1);128 return psImageSubset(image,x1,y1,x2,y2); 126 129 } 127 130
Note:
See TracChangeset
for help on using the changeset viewer.
