Changeset 5101 for trunk/psLib/src/mathtypes
- Timestamp:
- Sep 22, 2005, 2:04:36 PM (21 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r5064 r5101 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.8 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09- 16 23:56:51$11 * @version $Revision: 1.84 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-23 00:04:36 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 267 267 } 268 268 269 bool psImageSet(const psImage *image, 270 int x, 271 int y, 272 complex value) 273 { 274 if (image == NULL) 275 return false; 276 if (x >= image->numRows || y >= image->numCols) 277 return false; 278 if(x < 0) 279 x += image->numRows; 280 if(y < 0) 281 y += image->numCols; 282 283 switch (image->type.type) { 284 case PS_TYPE_U8: 285 *(psU8*)&image->data.U8[x][y] = value; 286 break; 287 case PS_TYPE_U16: 288 *(psU16*)&image->data.U16[x][y] = value; 289 break; 290 case PS_TYPE_U32: 291 *(psU32*)&image->data.U32[x][y] = value; 292 break; 293 case PS_TYPE_U64: 294 *(psU64*)&image->data.U64[x][y] = value; 295 break; 296 case PS_TYPE_S8: 297 *(psS8*)&image->data.S8[x][y] = value; 298 break; 299 case PS_TYPE_S16: 300 *(psS16*)&image->data.S16[x][y] = value; 301 break; 302 case PS_TYPE_S32: 303 *(psS32*)&image->data.S32[x][y] = value; 304 break; 305 case PS_TYPE_S64: 306 *(psS64*)&image->data.S64[x][y] = value; 307 break; 308 case PS_TYPE_F32: 309 *(psF32*)&image->data.F32[x][y] = value; 310 break; 311 case PS_TYPE_F64: 312 *(psF64*)&image->data.F64[x][y] = value; 313 break; 314 case PS_TYPE_C32: 315 *(psC32*)&image->data.C32[x][y] = value; 316 break; 317 case PS_TYPE_C64: 318 *(psC64*)&image->data.C64[x][y] = value; 319 break; 320 default: 321 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psImage Data Type\n"); 322 return false; 323 } 324 325 return true; 326 } 327 328 complex psImageGet(const psImage *image, 329 int x, 330 int y) 331 { 332 if (image == NULL) 333 return NAN; 334 if (x >= image->numRows || y >= image->numCols) 335 return NAN; 336 if(x < 0) 337 x += image->numRows; 338 if(y < 0) 339 y += image->numCols; 340 341 switch (image->type.type) { 342 case PS_TYPE_U8: 343 return image->data.U8[x][y]; 344 break; 345 case PS_TYPE_U16: 346 return image->data.U16[x][y]; 347 break; 348 case PS_TYPE_U32: 349 return image->data.U32[x][y]; 350 break; 351 case PS_TYPE_U64: 352 return image->data.U64[x][y]; 353 break; 354 case PS_TYPE_S8: 355 return image->data.S8[x][y]; 356 break; 357 case PS_TYPE_S16: 358 return image->data.S16[x][y]; 359 break; 360 case PS_TYPE_S32: 361 return image->data.S32[x][y]; 362 break; 363 case PS_TYPE_S64: 364 return image->data.S64[x][y]; 365 break; 366 case PS_TYPE_F32: 367 return image->data.F32[x][y]; 368 break; 369 case PS_TYPE_F64: 370 return image->data.F64[x][y]; 371 break; 372 case PS_TYPE_C32: 373 return image->data.C32[x][y]; 374 break; 375 case PS_TYPE_C64: 376 return image->data.C64[x][y]; 377 break; 378 default: 379 return NAN; 380 } 381 } 269 382 270 383 psImage* psImageRecycle(psImage* old, -
trunk/psLib/src/mathtypes/psImage.h
r5070 r5101 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.7 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09- 19 22:50:29$13 * @version $Revision: 1.71 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-23 00:04:36 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 193 193 ); 194 194 195 /** Sets the value of the image at the specified x,y position to value. 196 * 197 * A negative value for the x or y positions means index from the end. 198 * 199 * @return bool: True on success, otherwise false. 200 */ 201 bool psImageSet( 202 const psImage *image, ///< the image to set 203 int x, ///< x-position 204 int y, ///< y-position 205 complex value ///< specified value to set 206 ); 207 208 /** Returns the value of the image at the specified x,y position. 209 * 210 * A negative value for the x or y positions means index from the end. 211 * 212 * @return complex: The value at the specified x,y position. 213 */ 214 complex psImageGet( 215 const psImage *image, ///< the image from which to get 216 int x, ///< x-position 217 int y ///< y-position 218 ); 219 195 220 /** Resize a given image to the given size/type. 196 221 * -
trunk/psLib/src/mathtypes/psVector.c
r5089 r5101 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09-2 2 02:32:00$11 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-23 00:04:36 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 863 863 default: 864 864 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psVector Data Type\n"); 865 return false; 865 866 } 866 867
Note:
See TracChangeset
for help on using the changeset viewer.
