1 2 /* 3 4 SDL_rotozoom - rotozoomer 5 6 LGPL (c) A. Schiffler 7 8 */ 9 10 #ifndef _SDL_rotozoom_h 11 #define _SDL_rotozoom_h 12 13 #include <math.h> 14 15 /* Set up for C function definitions, even when using C++ */ 16 #ifdef __cplusplus 17 extern "C" 18 { 19 #endif 20 21 #ifndef M_PI 22 #define M_PI 3.141592654 23 #endif 24 25 #include <SDL/SDL.h> 26 27 /* ---- Defines */ 28 29 #define SMOOTHING_OFF 0 30 #define SMOOTHING_ON 1 31 32 /* ---- Structures */ 33 34 typedef struct tColorRGBA 35 { 36 Uint8 r; 37 Uint8 g; 38 Uint8 b; 39 Uint8 a; 40 } 41 tColorRGBA; 42 43 typedef struct tColorY 44 { 45 Uint8 y; 46 } 47 tColorY; 48 49 50 /* ---- Prototypes */ 51 52 53 #ifdef WIN32 54 #ifdef BUILD_DLL 55 #define DLLINTERFACE __declspec(dllexport) 56 #else 57 #define DLLINTERFACE __declspec(dllimport) 58 #endif 59 #else 60 #define DLLINTERFACE 61 #endif 62 63 /* 64 65 rotozoomSurface() 66 67 Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 68 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 69 then the destination 32bit surface is anti-aliased. If the surface is not 8bit 70 or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. 71 72 */ 73 74 SDL_Surface *rotozoomSurface (SDL_Surface * src, double angle, double zoom, 75 int smooth); 76 77 78 /* Returns the size of the target surface for a rotozoomSurface() call */ 79 80 void rotozoomSurfaceSize (int width, int height, double angle, double zoom, 81 int *dstwidth, int *dstheight); 82 83 /* 84 85 zoomSurface() 86 87 Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 88 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 89 then the destination 32bit surface is anti-aliased. If the surface is not 8bit 90 or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. 91 92 */ 93 94 SDL_Surface *zoomSurface (SDL_Surface * src, double zoomx, double zoomy, 95 int smooth); 96 97 /* Returns the size of the target surface for a zoomSurface() call */ 98 99 void zoomSurfaceSize (int width, int height, double zoomx, double zoomy, 100 int *dstwidth, int *dstheight); 101 102 103 /* Ends C function definitions when using C++ */ 104 #ifdef __cplusplus 105 }; 106 #endif 107 108 #endif /* _SDL_rotozoom_h */ 109