Changeset 7380 for trunk/psLib/src/imageops
- Timestamp:
- Jun 6, 2006, 5:22:07 PM (20 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 2 added
- 4 edited
-
Makefile.am (modified) (4 diffs)
-
psImageBackground.c (added)
-
psImageBackground.h (added)
-
psImageGeomManip.c (modified) (3 diffs)
-
psImageGeomManip.h (modified) (2 diffs)
-
psImagePixelManip.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/Makefile.am
r7210 r7380 5 5 libpslibimageops_la_CPPFLAGS = $(SRCINC) 6 6 libpslibimageops_la_SOURCES = \ 7 psImageBackground.c \ 7 8 psImageConvolve.c \ 8 9 psImageGeomManip.c \ … … 11 12 psImageStats.c \ 12 13 psImageStructManip.c \ 13 psImageMaskOps.c 14 psImageMaskOps.c \ 15 psImageUnbin.c 14 16 15 17 EXTRA_DIST = imageops.i … … 17 19 pslibincludedir = $(includedir) 18 20 pslibinclude_HEADERS = \ 21 psImageBackground.h \ 19 22 psImageConvolve.h \ 20 23 psImageGeomManip.h \ … … 23 26 psImageStats.h \ 24 27 psImageStructManip.h \ 25 psImageMaskOps.h 28 psImageMaskOps.h \ 29 psImageUnbin.h 26 30 27 31 CLEANFILES = *~ -
trunk/psLib/src/imageops/psImageGeomManip.c
r6806 r7380 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 4-06 22:55:18$12 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-06-07 03:22:06 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psImageGeomManip.h" 24 24 25 #include "psAbort.h" 25 26 #include "psError.h" 26 27 #include "psImage.h" … … 878 879 } 879 880 881 882 #define FLIP_X_CASE(TYPENAME,TYPE) \ 883 case TYPENAME: { \ 884 long numRows = input->numRows; \ 885 long numCols = input->numCols; \ 886 for (long i = 0; i < numRows; i++) { \ 887 for (long j = 0; j < numCols; j++) { \ 888 output->data.TYPE[i][j] = input->data.TYPE[i][numCols - j - 1]; \ 889 } \ 890 } \ 891 break; \ 892 } 893 894 #define FLIP_Y_CASE(TYPENAME,TYPE) \ 895 case TYPENAME: { \ 896 long numRows = input->numRows; \ 897 long numCols = input->numCols; \ 898 for (long i = 0; i < numRows; i++) { \ 899 for (long j = 0; j < numCols; j++) { \ 900 output->data.TYPE[i][j] = input->data.TYPE[numRows - i - 1][j]; \ 901 } \ 902 } \ 903 break; \ 904 } 905 906 psImage *psImageFlip(psImage *output, const psImage *input, bool xFlip, bool yFlip) 907 { 908 PS_ASSERT_IMAGE_NON_NULL(input, NULL); 909 910 if (xFlip && yFlip) { 911 // This is equivalent to a 180 degree rotation; 912 return psImageRotate(output, input, M_PI, NAN, PS_INTERPOLATE_BILINEAR); 913 } 914 915 if (!xFlip && !yFlip) { 916 // They want something, so let's give it to them 917 return psImageCopy(output, input, input->type.type); 918 } 919 920 output = psImageRecycle(output, input->numCols, input->numRows, input->type.type); 921 922 if (xFlip) { 923 switch (input->type.type) { 924 FLIP_X_CASE(PS_TYPE_U8, U8); 925 FLIP_X_CASE(PS_TYPE_U16, U16); 926 FLIP_X_CASE(PS_TYPE_U32, U32); 927 FLIP_X_CASE(PS_TYPE_U64, U64); 928 FLIP_X_CASE(PS_TYPE_S8, S8); 929 FLIP_X_CASE(PS_TYPE_S16, S16); 930 FLIP_X_CASE(PS_TYPE_S32, S32); 931 FLIP_X_CASE(PS_TYPE_S64, S64); 932 FLIP_X_CASE(PS_TYPE_F32, F32); 933 FLIP_X_CASE(PS_TYPE_F64, F64); 934 FLIP_X_CASE(PS_TYPE_C32, C32); 935 FLIP_X_CASE(PS_TYPE_C64, C64); 936 default: 937 psFree(output); 938 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type); 939 return NULL; 940 } 941 return output; 942 } 943 if (yFlip) { 944 switch (input->type.type) { 945 FLIP_Y_CASE(PS_TYPE_U8, U8); 946 FLIP_Y_CASE(PS_TYPE_U16, U16); 947 FLIP_Y_CASE(PS_TYPE_U32, U32); 948 FLIP_Y_CASE(PS_TYPE_U64, U64); 949 FLIP_Y_CASE(PS_TYPE_S8, S8); 950 FLIP_Y_CASE(PS_TYPE_S16, S16); 951 FLIP_Y_CASE(PS_TYPE_S32, S32); 952 FLIP_Y_CASE(PS_TYPE_S64, S64); 953 FLIP_Y_CASE(PS_TYPE_F32, F32); 954 FLIP_Y_CASE(PS_TYPE_F64, F64); 955 FLIP_Y_CASE(PS_TYPE_C32, C32); 956 FLIP_Y_CASE(PS_TYPE_C64, C64); 957 default: 958 psFree(output); 959 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type); 960 return NULL; 961 } 962 return output; 963 } 964 965 psAbort(__func__, "Should never get here.\n"); 966 return NULL; 967 } -
trunk/psLib/src/imageops/psImageGeomManip.h
r6750 r7380 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 4-01 02:43:57$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-06-07 03:22:06 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 151 151 psRegion region, ///< the size of the transformed image 152 152 const psPixels* pixels, /**< if not NULL, consists of psPixelCoords and specifies 153 * which pixels in output image shall be transformed;154 * otherwise, entire image generated*/153 * which pixels in output image shall be transformed; 154 * otherwise, entire image generated*/ 155 155 psImageInterpolateMode mode, ///< the interpolation scheme to be used 156 156 double exposedValue ///< Exposed value to which non-corresponding pixels are set 157 157 ); 158 158 159 // Flip the input image 160 psImage *psImageFlip(psImage *output, // Output image, or NULL 161 const psImage *input, // Input image 162 bool xFlip, // Flip x axis? 163 bool yFlip // Flip y axis? 164 ); 165 159 166 #endif // #ifndef PS_IMAGE_GEOM_MANIP_H -
trunk/psLib/src/imageops/psImagePixelManip.c
r7123 r7380 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 5-16 03:27:13$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-06-07 03:22:06 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 413 413 return numClipped; 414 414 } 415
Note:
See TracChangeset
for help on using the changeset viewer.
