Changeset 4367 for trunk/psLib/src/imageops/psImageGeomManip.c
- Timestamp:
- Jun 22, 2005, 5:50:29 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageGeomManip.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageGeomManip.c
r4316 r4367 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06- 18 03:13:02$12 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-23 03:50:29 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 36 36 const psImage* restrict mask, 37 37 psMaskType maskVal, 38 psU32scale,38 int scale, 39 39 const psStats* stats) 40 40 { … … 303 303 304 304 psImage* psImageRotate(psImage* out, 305 const psImage* in ,305 const psImage* input, 306 306 float angle, 307 psC64 unexposedValue,307 _Complex exposed, 308 308 psImageInterpolateMode mode) 309 309 { 310 if (in == NULL) {310 if (input == NULL) { 311 311 psError(PS_ERR_BAD_PARAMETER_NULL, true, 312 312 PS_ERRORTEXT_psImage_IMAGE_NULL); … … 319 319 if (fabsf(angle - M_PI_2) < FLT_EPSILON) { 320 320 // perform 1/4 rotate counter-clockwise 321 psS32 numRows = in ->numCols;322 psS32 numCols = in ->numRows;321 psS32 numRows = input->numCols; 322 psS32 numCols = input->numRows; 323 323 psS32 lastCol = numCols - 1; 324 psElemType type = in ->type.type;324 psElemType type = input->type.type; 325 325 326 326 out = psImageRecycle(out, numCols, numRows, type); … … 328 328 #define PSIMAGE_ROTATE_LEFT_90(TYPE) \ 329 329 case PS_TYPE_##TYPE: { \ 330 ps##TYPE** inData = in ->data.TYPE; \330 ps##TYPE** inData = input->data.TYPE; \ 331 331 for (psS32 row=0;row<numRows;row++) { \ 332 332 ps##TYPE* outRow = out->data.TYPE[row]; \ … … 364 364 } else if (fabsf(angle - M_PI) < FLT_EPSILON) { 365 365 // perform 1/2 rotate 366 psS32 numRows = in ->numRows;366 psS32 numRows = input->numRows; 367 367 psS32 lastRow = numRows - 1; 368 psS32 numCols = in ->numCols;368 psS32 numCols = input->numCols; 369 369 psS32 lastCol = numCols - 1; 370 psElemType type = in ->type.type;370 psElemType type = input->type.type; 371 371 372 372 out = psImageRecycle(out, numCols, numRows, type); … … 376 376 for (psS32 row=0;row<numRows;row++) { \ 377 377 ps##TYPE* outRow = out->data.TYPE[row]; \ 378 ps##TYPE* inRow = in ->data.TYPE[lastRow-row]; \378 ps##TYPE* inRow = input->data.TYPE[lastRow-row]; \ 379 379 for (psS32 col=0;col<numCols;col++) { \ 380 380 outRow[col] = inRow[lastCol - col]; \ … … 410 410 } else if (fabsf(angle - (M_PI+M_PI_2)) < FLT_EPSILON) { 411 411 // perform 1/4 rotate clockwise 412 psS32 numRows = in ->numCols;412 psS32 numRows = input->numCols; 413 413 psS32 lastRow = numRows - 1; 414 psS32 numCols = in ->numRows;415 psElemType type = in ->type.type;414 psS32 numCols = input->numRows; 415 psElemType type = input->type.type; 416 416 417 417 out = psImageRecycle(out, numCols, numRows, type); … … 419 419 #define PSIMAGE_ROTATE_RIGHT_90(TYPE) \ 420 420 case PS_TYPE_##TYPE: { \ 421 ps##TYPE** inData = in ->data.TYPE; \421 ps##TYPE** inData = input->data.TYPE; \ 422 422 for (psS32 row=0;row<numRows;row++) { \ 423 423 ps##TYPE* outRow = out->data.TYPE[row]; \ … … 454 454 } 455 455 } else if (fabsf(angle) < FLT_EPSILON) { 456 out = psImageCopy(out, in , in->type.type);456 out = psImageCopy(out, input, input->type.type); 457 457 } else { 458 psElemType type = in ->type.type;459 psS32 numRows = in ->numRows;460 psS32 numCols = in ->numCols;458 psElemType type = input->type.type; 459 psS32 numRows = input->numRows; 460 psS32 numCols = input->numCols; 461 461 float centerX = (float)(numCols) / 2.0f; 462 462 float centerY = (float)(numRows) / 2.0f; … … 497 497 498 498 #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \ 499 if (creal( unexposedValue) < PS_MIN_##TYPE || \500 creal( unexposedValue) > PS_MAX_##TYPE || \501 cimag( unexposedValue) < PS_MIN_##TYPE || \502 cimag( unexposedValue) > PS_MAX_##TYPE) { \499 if (creal(exposed) < PS_MIN_##TYPE || \ 500 creal(exposed) > PS_MAX_##TYPE || \ 501 cimag(exposed) < PS_MIN_##TYPE || \ 502 cimag(exposed) > PS_MAX_##TYPE) { \ 503 503 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 504 504 PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \ 505 " unexposedValue", \506 creal( unexposedValue),cimag(unexposedValue), \505 "exposed", \ 506 creal(exposed),cimag(exposed), \ 507 507 PS_TYPE_##TYPE##_NAME, \ 508 508 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 519 519 outRow = out->data.TYPE[y]; \ 520 520 for (psS32 x = 0; x < outCols; x++) { \ 521 outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in ,inX,inY,NULL,0,unexposedValue); \521 outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(input,inX,inY,NULL,0,exposed); \ 522 522 inX += cosT; \ 523 523 inY -= sinT; \ … … 594 594 595 595 psImage* psImageShift(psImage* out, 596 const psImage* in ,596 const psImage* input, 597 597 float dx, 598 598 float dy, 599 psC64 unexposedValue,599 _Complex exposed, 600 600 psImageInterpolateMode mode) 601 601 { … … 605 605 psElemType type; 606 606 607 if (in == NULL) {607 if (input == NULL) { 608 608 psError(PS_ERR_BAD_PARAMETER_NULL, true, 609 609 PS_ERRORTEXT_psImage_IMAGE_NULL); … … 613 613 // create an output image of the same size 614 614 // and type 615 outRows = in ->numRows;616 outCols = in ->numCols;617 type = in ->type.type;615 outRows = input->numRows; 616 outCols = input->numCols; 617 type = input->type.type; 618 618 elementSize = PSELEMTYPE_SIZEOF(type); 619 619 out = psImageRecycle(out, outCols, outRows, type); … … 621 621 #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \ 622 622 case PS_TYPE_##TYPE: \ 623 if (creal( unexposedValue) < PS_MIN_##TYPE || \624 creal( unexposedValue) > PS_MAX_##TYPE || \625 cimag( unexposedValue) < PS_MIN_##TYPE || \626 cimag( unexposedValue) > PS_MAX_##TYPE) { \623 if (creal(exposed) < PS_MIN_##TYPE || \ 624 creal(exposed) > PS_MAX_##TYPE || \ 625 cimag(exposed) < PS_MIN_##TYPE || \ 626 cimag(exposed) > PS_MAX_##TYPE) { \ 627 627 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 628 628 PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \ 629 " unexposedValue", \630 creal( unexposedValue),cimag(unexposedValue), \629 "exposed", \ 630 creal(exposed),cimag(exposed), \ 631 631 PS_TYPE_##TYPE##_NAME, \ 632 632 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ … … 640 640 for (psS32 col=0;col<outCols;col++) { \ 641 641 outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \ 642 in ,dx+(float)col,y,NULL,0,unexposedValue); \642 input,dx+(float)col,y,NULL,0,exposed); \ 643 643 } \ 644 644 } \ … … 647 647 #define PSIMAGE_SHIFT_ARBITRARY_CASE(MODE) \ 648 648 case PS_INTERPOLATE_##MODE: \ 649 switch (in ->type.type) { \649 switch (input->type.type) { \ 650 650 PSIMAGE_SHIFT_CASE(MODE,U8); \ 651 651 PSIMAGE_SHIFT_CASE(MODE,U16); \ … … 694 694 int inputMaskVal, 695 695 const psPlaneTransform *outToIn, 696 constpsRegion region,696 psRegion region, 697 697 const psPixels* pixels, 698 698 psImageInterpolateMode mode, 699 intexposedValue)699 double exposedValue) 700 700 { 701 701 if (input == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.
