Changeset 746 for trunk/psLib/src/image/psImage.c
- Timestamp:
- May 19, 2004, 3:49:47 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImage.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r745 r746 3 3 * @brief Contains basic image definitions and operations. 4 4 * 5 * This file defines the basic type for an image struct and functions useful in manupulating images. 5 * This file defines the basic type for an image struct and functions useful 6 * in manupulating images. 6 7 * 7 8 * @author Robert DeSonia, MHPCC 8 9 * @author Ross Harman, MHPCC 9 10 * 10 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-05-20 01: 27:01$11 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-05-20 01:49:47 $ 12 13 * 13 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 28 /*****************************************************************************/ 28 29 29 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type) 30 psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, 31 const psElemType type) 30 32 { 31 33 int area = 0; … … 36 38 37 39 if (area < 1) { 38 psError(__func__, "Invalid value for number of rows or columns (numRows=%d, numCols=%d).",39 numRows, numCols);40 psError(__func__, "Invalid value for number of rows or columns " 41 "(numRows=%d, numCols=%d).", numRows, numCols); 40 42 return NULL; 41 43 } … … 79 81 } 80 82 81 psImage* psImageRealloc(psImage* old,unsigned int numCols, unsigned int numRows, const psElemType type) 83 psImage* psImageRealloc(psImage* old,unsigned int numCols, unsigned int numRows, 84 const psElemType type) 82 85 { 83 86 int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes … … 95 98 96 99 /* image already the right size/type? */ 97 if (numCols == old->numCols && numRows == old->numRows && type == old->type.type) { 100 if (numCols == old->numCols && numRows == old->numRows && 101 type == old->type.type) { 98 102 return old; 99 103 } … … 116 120 117 121 psImage *psImageSubset(psImage *out,psImage *image,unsigned int numCols, 118 unsigned int numRows, unsigned int col0, unsigned int row0) 122 unsigned int numRows, unsigned int col0, 123 unsigned int row0) 119 124 { 120 125 unsigned int elementSize; // size of image element in bytes … … 139 144 140 145 if (col0 >= image->numCols || row0 >= image->numRows) { 141 psError(__func__,"Can not subset image because col0,row0 (%d,%d) is not a valid pixel "142 "location.",col0,row0);146 psError(__func__,"Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.", 147 col0,row0); 143 148 return NULL; 144 149 } … … 164 169 // add output image as a child of the input image. 165 170 image->nChildren++; 166 image->children = (psImage **) psRealloc(image->children,image->nChildren*sizeof(psImage *)); 171 image->children = (psImage **) psRealloc(image->children, 172 image->nChildren * sizeof(psImage*) ); 167 173 image->children[image->nChildren-1] = out; 168 174 … … 171 177 172 178 for (int row = 0; row < numRows; row++) { 173 memcpy(out->data.v[row],image->data.U8[row0+row] + inputColOffset,outputRowSize); 179 memcpy(out->data.v[row],image->data.U8[row0+row] + inputColOffset, 180 outputRowSize); 174 181 } 175 182 … … 201 208 } 202 209 203 psImage *psImageCopy(psImage* restrict output, const psImage *input, psElemType type) 210 psImage *psImageCopy(psImage* restrict output, const psImage *input, 211 psElemType type) 204 212 { 205 213 psElemType inDatatype; … … 214 222 215 223 if (input == output) { 216 psError(__func__,"Can not copy image because given input and output parameter reference the same"217 "p sImage struct.");224 psError(__func__,"Can not copy image because given input and output " 225 "parameter reference the same psImage struct."); 218 226 return NULL; 219 227 }
Note:
See TracChangeset
for help on using the changeset viewer.
