Index: trunk/psLib/src/image/psImageManip.c
===================================================================
--- trunk/psLib/src/image/psImageManip.c	(revision 2105)
+++ trunk/psLib/src/image/psImageManip.c	(revision 2204)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-14 01:22:59 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-27 00:57:31 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +18,4 @@
 #include <math.h>                          // for isfinite(), etc.
 #include <stdlib.h>
-#include <stdbool.h>
 #include <string.h>                        // for memcpy, etc.
 
@@ -29,13 +28,13 @@
 #include "psImageErrors.h"
 
-int psImageClip(psImage* input,
-                psF64 min,
-                psF64 vmin,
-                psF64 max,
-                psF64 vmax)
+psS32 psImageClip(psImage* input,
+                  psF64 min,
+                  psF64 vmin,
+                  psF64 max,
+                  psF64 vmax)
 {
-    int numClipped = 0;
-    unsigned int numRows;
-    unsigned int numCols;
+    psS32 numClipped = 0;
+    psU32 numRows;
+    psU32 numCols;
 
     if (input == NULL) {
@@ -72,7 +71,7 @@
                            (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
-            for (unsigned int row = 0;row<numRows;row++) { \
+            for (psU32 row = 0;row<numRows;row++) { \
                 ps##type* inputRow = input->data.type[row]; \
-                for (unsigned int col = 0; col < numCols; col++) { \
+                for (psU32 col = 0; col < numCols; col++) { \
                     if ((psF64)inputRow[col] < min) { \
                         inputRow[col] = (ps##type)vmin; \
@@ -103,7 +102,7 @@
                            (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
-            for (unsigned int row = 0;row<numRows;row++) { \
+            for (psU32 row = 0;row<numRows;row++) { \
                 ps##type* inputRow = input->data.type[row]; \
-                for (unsigned int col = 0; col < numCols; col++) { \
+                for (psU32 col = 0; col < numCols; col++) { \
                     if (absfcn(inputRow[col]) < min) { \
                         inputRow[col] = (ps##type)vmin; \
@@ -144,10 +143,10 @@
 }
 
-int psImageClipNaN(psImage* input,
-                   psF64 value)
+psS32 psImageClipNaN(psImage* input,
+                     psF64 value)
 {
-    int numClipped = 0;
-    unsigned int numRows;
-    unsigned int numCols;
+    psS32 numClipped = 0;
+    psU32 numRows;
+    psU32 numCols;
 
     if (input == NULL) {
@@ -161,7 +160,7 @@
         #define psImageClipNaNCase(type) \
     case PS_TYPE_##type: \
-        for (unsigned int row = 0;row<numRows;row++) { \
+        for (psU32 row = 0;row<numRows;row++) { \
             ps##type* inputRow = input->data.type[row]; \
-            for (unsigned int col = 0; col < numCols; col++) { \
+            for (psU32 col = 0; col < numCols; col++) { \
                 if (! isfinite(inputRow[col])) { \
                     inputRow[col] = (ps##type)value; \
@@ -190,16 +189,16 @@
 }
 
-int psImageOverlaySection(psImage* image,
-                          const psImage* overlay,
-                          int col0,
-                          int row0,
-                          const char *op)
+psS32 psImageOverlaySection(psImage* image,
+                            const psImage* overlay,
+                            psS32 col0,
+                            psS32 row0,
+                            const char *op)
 {
-    unsigned int imageNumRows;
-    unsigned int imageNumCols;
-    unsigned int overlayNumRows;
-    unsigned int overlayNumCols;
-    unsigned int imageRowLimit;
-    unsigned int imageColLimit;
+    psU32 imageNumRows;
+    psU32 imageNumCols;
+    psU32 overlayNumRows;
+    psU32 overlayNumCols;
+    psU32 imageRowLimit;
+    psU32 imageColLimit;
     psElemType type;
 
@@ -257,8 +256,8 @@
         #define psImageOverlayCase(DATATYPE) \
     case PS_TYPE_##DATATYPE: \
-        for (unsigned int row=row0;row<imageRowLimit;row++) { \
+        for (psU32 row=row0;row<imageRowLimit;row++) { \
             ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \
             ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-row0]; \
-            for (unsigned int col=col0;col<imageColLimit;col++) { \
+            for (psU32 col=col0;col<imageColLimit;col++) { \
                 switch (*op) { \
                 case '+': \
@@ -315,13 +314,13 @@
 }
 
-int psImageClipComplexRegion(psImage* input,
-                             psC64 min,
-                             psC64 vmin,
-                             psC64 max,
-                             psC64 vmax)
+psS32 psImageClipComplexRegion(psImage* input,
+                               psC64 min,
+                               psC64 vmin,
+                               psC64 max,
+                               psC64 vmax)
 {
-    int numClipped = 0;
-    unsigned int numRows;
-    unsigned int numCols;
+    psS32 numClipped = 0;
+    psU32 numRows;
+    psU32 numCols;
     psF64 realMin = creal(min);
     psF64 imagMin = cimag(min);
@@ -374,7 +373,7 @@
             break; \
         } \
-        for (unsigned int row = 0;row<numRows;row++) { \
+        for (psU32 row = 0;row<numRows;row++) { \
             ps##type* inputRow = input->data.type[row]; \
-            for (unsigned int col = 0; col < numCols; col++) { \
+            for (psU32 col = 0; col < numCols; col++) { \
                 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
                     inputRow[col] = (ps##type)vmax; \
@@ -411,11 +410,11 @@
                       const psImage* restrict mask,
                       psMaskType maskVal,
-                      unsigned int scale,
+                      psU32 scale,
                       const psStats* stats)
 {
-    int inRows;
-    int inCols;
-    int outRows;
-    int outCols;
+    psS32 inRows;
+    psS32 inCols;
+    psS32 outRows;
+    psS32 outCols;
     psVector* vec;                     // vector to hold the values of a single bin.
     psVector* maskVec = NULL;          // vector to hold the mask of a single bin.
@@ -491,18 +490,18 @@
         ps##type* vecData = vec->data.type; \
         psMaskType* inRowMask = NULL; \
-        for (int row = 0; row < outRows; row++) { \
+        for (psS32 row = 0; row < outRows; row++) { \
             outRowData = out->data.type[row]; \
-            int inCurrentRow = row*scale; \
-            int inNextRow = (row+1)*scale; \
-            for (int col = 0; col < outCols; col++) { \
-                int inCurrentCol = col*scale; \
-                int inNextCol = (col+1)*scale; \
-                int n = 0; \
-                for (int inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
+            psS32 inCurrentRow = row*scale; \
+            psS32 inNextRow = (row+1)*scale; \
+            for (psS32 col = 0; col < outCols; col++) { \
+                psS32 inCurrentCol = col*scale; \
+                psS32 inNextCol = (col+1)*scale; \
+                psS32 n = 0; \
+                for (psS32 inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \
                     ps##type* inRowData = in->data.type[inRow]; \
                     if (mask != NULL) { \
                         inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \
                     } \
-                    for (int inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
+                    for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
                         if (maskData != NULL) { \
                             maskData[n] = inRowMask[inCol]; \
@@ -555,9 +554,9 @@
 psImage* psImageResample(psImage* out,
                          const psImage* in,
-                         int scale,
+                         psS32 scale,
                          psImageInterpolateMode mode)
 {
-    int outRows;
-    int outCols;
+    psS32 outRows;
+    psS32 outCols;
     float invScale;
 
@@ -597,8 +596,8 @@
 case PS_TYPE_##TYPE: { \
         out = psImageRecycle(out,outCols, outRows, PS_TYPE_##TYPE); \
-        for (int row=0;row<outRows;row++) { \
+        for (psS32 row=0;row<outRows;row++) { \
             ps##TYPE* rowData = out->data.TYPE[row]; \
             float inRow = (float)row * invScale; \
-            for (int col=0;col<outCols;col++) { \
+            for (psS32 col=0;col<outCols;col++) { \
                 rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \
             } \
@@ -637,10 +636,10 @@
 psImage* psImageRoll(psImage* out,
                      const psImage* in,
-                     int dx,
-                     int dy)
+                     psS32 dx,
+                     psS32 dy)
 {
-    int outRows;
-    int outCols;
-    int elementSize;
+    psS32 outRows;
+    psS32 outCols;
+    psS32 elementSize;
 
     if (in == NULL) {
@@ -669,9 +668,9 @@
     }
 
-    int segment1Size = elementSize * (outCols - dx);
-    int segment2Size = elementSize * dx;
-
-    for (int row = 0; row < outRows; row++) {
-        int inRowNumber = row + dy;
+    psS32 segment1Size = elementSize * (outCols - dx);
+    psS32 segment2Size = elementSize * dx;
+
+    for (psS32 row = 0; row < outRows; row++) {
+        psS32 inRowNumber = row + dy;
 
         if (inRowNumber >= outRows) {
@@ -706,7 +705,7 @@
     if (fabsf(angle - 90.0f) < FLT_EPSILON) {
         // perform 1/4 rotate counter-clockwise
-        int numRows = in->numCols;
-        int numCols = in->numRows;
-        int lastCol = numCols - 1;
+        psS32 numRows = in->numCols;
+        psS32 numCols = in->numRows;
+        psS32 lastCol = numCols - 1;
         psElemType type = in->type.type;
 
@@ -716,7 +715,7 @@
     case PS_TYPE_##TYPE: { \
             ps##TYPE** inData = in->data.TYPE; \
-            for (int row=0;row<numRows;row++) { \
+            for (psS32 row=0;row<numRows;row++) { \
                 ps##TYPE* outRow = out->data.TYPE[row]; \
-                for (int col=0;col<numCols;col++) { \
+                for (psS32 col=0;col<numCols;col++) { \
                     outRow[col] = inData[lastCol-col][row]; \
                 } \
@@ -752,8 +751,8 @@
     } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
         // perform 1/2 rotate
-        int numRows = in->numRows;
-        int lastRow = numRows - 1;
-        int numCols = in->numCols;
-        int lastCol = numCols - 1;
+        psS32 numRows = in->numRows;
+        psS32 lastRow = numRows - 1;
+        psS32 numCols = in->numCols;
+        psS32 lastCol = numCols - 1;
         psElemType type = in->type.type;
 
@@ -762,8 +761,8 @@
         #define PSIMAGE_ROTATE_180_CASE(TYPE) \
     case PS_TYPE_##TYPE: { \
-            for (int row=0;row<numRows;row++) { \
+            for (psS32 row=0;row<numRows;row++) { \
                 ps##TYPE* outRow = out->data.TYPE[row]; \
                 ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
-                for (int col=0;col<numCols;col++) { \
+                for (psS32 col=0;col<numCols;col++) { \
                     outRow[col] = inRow[lastCol - col]; \
                 } \
@@ -799,7 +798,7 @@
     } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
         // perform 1/4 rotate clockwise
-        int numRows = in->numCols;
-        int lastRow = numRows - 1;
-        int numCols = in->numRows;
+        psS32 numRows = in->numCols;
+        psS32 lastRow = numRows - 1;
+        psS32 numCols = in->numRows;
         psElemType type = in->type.type;
 
@@ -809,7 +808,7 @@
     case PS_TYPE_##TYPE: { \
             ps##TYPE** inData = in->data.TYPE; \
-            for (int row=0;row<numRows;row++) { \
+            for (psS32 row=0;row<numRows;row++) { \
                 ps##TYPE* outRow = out->data.TYPE[row]; \
-                for (int col=0;col<numCols;col++) { \
+                for (psS32 col=0;col<numCols;col++) { \
                     outRow[col] = inData[col][lastRow-row]; \
                 } \
@@ -847,6 +846,6 @@
     } else {
         psElemType type = in->type.type;
-        int numRows = in->numRows;
-        int numCols = in->numCols;
+        psS32 numRows = in->numRows;
+        psS32 numCols = in->numCols;
         float centerX = (float)(numCols) / 2.0f;
         float centerY = (float)(numRows) / 2.0f;
@@ -859,8 +858,8 @@
         // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
 
-        int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
-        int outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
+        psS32 outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
+        psS32 outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
         float minX = (float)outCols / -2.0f;
-        int intMinY = outRows / -2;
+        psS32 intMinY = outRows / -2;
 
         out = psImageRecycle(out, outCols, outRows, type);
@@ -906,9 +905,9 @@
             float inY; \
             ps##TYPE* outRow; \
-            for (int y = 0; y < outRows; y++) { \
+            for (psS32 y = 0; y < outRows; y++) { \
                 inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
                 inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
                 outRow = out->data.TYPE[y]; \
-                for (int x = 0; x < outCols; x++) { \
+                for (psS32 x = 0; x < outCols; x++) { \
                     outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,NULL,0,unexposedValue); \
                     inX += cosT; \
@@ -993,7 +992,7 @@
                       psImageInterpolateMode mode)
 {
-    int outRows;
-    int outCols;
-    int elementSize;
+    psS32 outRows;
+    psS32 outCols;
+    psS32 elementSize;
     psElemType type;
 
@@ -1030,8 +1029,8 @@
         break; \
     } \
-    for (int row=0;row<outRows;row++) { \
+    for (psS32 row=0;row<outRows;row++) { \
         ps##TYPE* outRow = out->data.TYPE[row]; \
         float y = dy+(float)row; \
-        for (int col=0;col<outCols;col++) { \
+        for (psS32 col=0;col<outCols;col++) { \
             outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \
                           in,dx+(float)col,y,NULL,0,unexposedValue); \
