SDL2_gfx  1.0.1
GraphicsprimitivesandsurfacefunctionsforSDL2
I:/Sources/sdl2gfx/SDL2_imageFilter.h
Go to the documentation of this file.
00001 /*
00002 
00003 SDL2_imageFilter.h: byte-image "filter" routines 
00004 
00005 Copyright (C) 2001-2012  Andreas Schiffler
00006 
00007 This software is provided 'as-is', without any express or implied
00008 warranty. In no event will the authors be held liable for any damages
00009 arising from the use of this software.
00010 
00011 Permission is granted to anyone to use this software for any purpose,
00012 including commercial applications, and to alter it and redistribute it
00013 freely, subject to the following restrictions:
00014 
00015 1. The origin of this software must not be misrepresented; you must not
00016 claim that you wrote the original software. If you use this software
00017 in a product, an acknowledgment in the product documentation would be
00018 appreciated but is not required.
00019 
00020 2. Altered source versions must be plainly marked as such, and must not be
00021 misrepresented as being the original software.
00022 
00023 3. This notice may not be removed or altered from any source
00024 distribution.
00025 
00026 Andreas Schiffler -- aschiffler at ferzkopp dot net
00027 
00028 */
00029 
00030 #ifndef _SDL2_imageFilter_h
00031 #define _SDL2_imageFilter_h
00032 
00033 /* Set up for C function definitions, even when using C++ */
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038         /* ---- Function Prototypes */
00039 
00040 #ifdef _MSC_VER
00041 #  if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)
00042 #    define SDL2_IMAGEFILTER_SCOPE __declspec(dllexport)
00043 #  else
00044 #    ifdef LIBSDL2_GFX_DLL_IMPORT
00045 #      define SDL2_IMAGEFILTER_SCOPE __declspec(dllimport)
00046 #    endif
00047 #  endif
00048 #endif
00049 #ifndef SDL2_IMAGEFILTER_SCOPE
00050 #  define SDL2_IMAGEFILTER_SCOPE extern
00051 #endif
00052 
00053         /* Comments:                                                                           */
00054         /*  1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */
00055         /*  2.) Data that is not within an 8 byte boundary is processed using the C routine.   */
00056         /*  3.) Convolution routines do not have C routines at this time.                      */
00057 
00058         // Detect MMX capability in CPU
00059         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void);
00060 
00061         // Force use of MMX off (or turn possible use back on)
00062         SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void);
00063         SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void);
00064 
00065         //
00066         // All routines return:
00067         //   0   OK
00068         //  -1   Error (internal error, parameter error)
00069         //
00070 
00071         //  SDL_imageFilterAdd: D = saturation255(S1 + S2)
00072         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00073 
00074         //  SDL_imageFilterMean: D = S1/2 + S2/2
00075         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00076 
00077         //  SDL_imageFilterSub: D = saturation0(S1 - S2)
00078         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00079 
00080         //  SDL_imageFilterAbsDiff: D = | S1 - S2 |
00081         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00082 
00083         //  SDL_imageFilterMult: D = saturation(S1 * S2)
00084         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00085 
00086         //  SDL_imageFilterMultNor: D = S1 * S2   (non-MMX)
00087         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00088 
00089         //  SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
00090         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00091                 unsigned int length);
00092 
00093         //  SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
00094         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
00095                 unsigned int length);
00096 
00097         //  SDL_imageFilterBitAnd: D = S1 & S2
00098         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00099 
00100         //  SDL_imageFilterBitOr: D = S1 | S2
00101         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00102 
00103         //  SDL_imageFilterDiv: D = S1 / S2   (non-MMX)
00104         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
00105 
00106         //  SDL_imageFilterBitNegation: D = !S
00107         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length);
00108 
00109         //  SDL_imageFilterAddByte: D = saturation255(S + C)
00110         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00111 
00112         //  SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
00113         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00114 
00115         //  SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
00116         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00117                 unsigned char C);
00118 
00119         //  SDL_imageFilterSubByte: D = saturation0(S - C)
00120         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00121 
00122         //  SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
00123         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
00124 
00125         //  SDL_imageFilterShiftRight: D = saturation0(S >> N)
00126         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00127 
00128         //  SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
00129         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00130 
00131         //  SDL_imageFilterMultByByte: D = saturation255(S * C)
00132         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
00133 
00134         //  SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
00135         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00136                 unsigned char N, unsigned char C);
00137 
00138         //  SDL_imageFilterShiftLeftByte: D = (S << N)
00139         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00140                 unsigned char N);
00141 
00142         //  SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
00143         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00144                 unsigned char N);
00145 
00146         //  SDL_imageFilterShiftLeft: D = saturation255(S << N)
00147         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
00148 
00149         //  SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
00150         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00151                 unsigned char T);
00152 
00153         //  SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
00154         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length,
00155                 unsigned char Tmin, unsigned char Tmax);
00156 
00157         //  SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
00158         SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin,
00159                 int Cmax, int Nmin, int Nmax);
00160 
00161         /* Ends C function definitions when using C++ */
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165 
00166 #endif                          /* _SDL_imageFilter_h */