Changeset 6778 for trunk/psLib/src/imageops/psImagePixelExtract.c
- Timestamp:
- Apr 4, 2006, 3:49:41 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImagePixelExtract.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImagePixelExtract.c
r6770 r6778 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-04-0 4 22:04:45$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-04-05 01:49:40 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 333 333 return NULL; 334 334 } 335 /* 336 if (col1 < 1) { 337 col1 += input->numCols; 338 } 339 340 if (row1 < 1) { 341 row1 += input->numRows; 342 } 343 344 if ( col0 < 0 || 345 row0 < 0 || 346 col1 > input->numCols || 347 row1 > input->numRows || 348 col0 >= col1 || 349 row0 >= row1) { 350 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 351 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID, 352 col0, col1, row0, row1, 353 input->numCols, input->numRows); 354 psFree(out); 355 return NULL; 356 } 357 */ 335 358 336 //Make sure x0 of region is inside image. If so, set col0 to corresponding index number. 359 337 if (col0 >= input->col0 && col0 < (input->col0 + input->numCols) ) { … … 709 687 return NULL; 710 688 } 711 /*712 //Make sure x1 of region is valid. If negative, index from tail (if valid).713 if (col1 < 0) {714 col1 += input->numCols;715 if (col1 < 0) {716 psError(PS_ERR_BAD_PARAMETER_VALUE, true,717 "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",718 region.x1, col1+input->col0, input->col0, input->col0+input->numCols);719 psFree(out);720 return NULL;721 }722 } else if (col1 >= input->col0 && col1 < (input->col0 + input->numCols) ) {723 col1 -= input->col0;724 } else {725 psError(PS_ERR_BAD_PARAMETER_VALUE, true,726 "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",727 region.x1, col1, input->col0, input->col0+input->numCols);728 psFree(out);729 return NULL;730 }731 //Make sure y1 of region is valid. If negative, index from tail (if valid).732 if (row1 < 0) {733 row1 += input->numRows;734 if (row1 < 0) {735 psError(PS_ERR_BAD_PARAMETER_VALUE, true,736 "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",737 region.y1, row1+input->row0, input->row0, input->row0+input->numRows);738 psFree(out);739 return NULL;740 }741 } else if (row1 >= input->row0 && row1 < (input->row0 + input->numRows) ) {742 row1 -= input->row0;743 } else {744 psError(PS_ERR_BAD_PARAMETER_VALUE, true,745 "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",746 region.y1, row1, input->row0, input->row0+input->numRows);747 psFree(out);748 return NULL;749 }750 */751 /* //Now make sure that the region makes sense.752 if (col0 > col1 || row0 > row1) {753 if (col0 > col1) {754 psError(PS_ERR_BAD_PARAMETER_VALUE, true,755 "Invalid psRegion specified. x0=%f=%f is greater than x1=%f=%f.\n",756 region.x0, col0, region.x1, col1);757 } else {758 psError(PS_ERR_BAD_PARAMETER_VALUE, true,759 "Invalid psRegion specified. y0=%f=%f is greater than y1=%f=%f.\n",760 region.y0, row0, region.y1, row1);761 }762 psFree(out);763 return NULL;764 } else if (col0 == col1 && row0 == row1) {765 psError(PS_ERR_BAD_PARAMETER_VALUE, true,766 "Invalid psRegion specified. Region contains only 1 pixel.\n");767 psFree(out);768 return NULL;769 }770 */771 689 if (col1 < 0 || row1 < 0 || col0 < 0 || row0 < 0 || col0 >= numCols || col1 >= numCols || 772 690 row0 >= numRows || row1 >= numRows) { … … 778 696 float endCol = col1; 779 697 float endRow = row1; 780 /*781 float startCol = region.x0;782 float startRow = region.y0;783 float endCol = region.x1;784 float endRow = region.y1;785 if (startCol < 0 || startCol >= numCols ||786 startRow < 0 || startRow >= numRows ||787 endCol < 0 || endCol >= numCols ||788 endRow < 0 || endRow >= numRows) {789 psError(PS_ERR_BAD_PARAMETER_VALUE, true,790 PS_ERRORTEXT_psImage_LINE_NOT_IN_IMAGE,791 startCol,startRow,endCol,endRow,792 numCols-1,numRows-1);793 psFree(out);794 return NULL;795 }796 */797 698 798 699 if (mode < PS_INTERPOLATE_FLAT ) {
Note:
See TracChangeset
for help on using the changeset viewer.
