Version 1.2.0 with new build/configure system
[tennix.git] / src / SDL_rotozoom.h
blobda5cabafeeb3df3f7c1308557b1eb2716ce268f8
2 /*
4 SDL_rotozoom - rotozoomer
6 LGPL (c) A. Schiffler
8 */
10 #ifndef _SDL_rotozoom_h
11 #define _SDL_rotozoom_h
13 #include <math.h>
15 /* Set up for C function definitions, even when using C++ */
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 #ifndef M_PI
21 #define M_PI 3.141592654
22 #endif
24 #include <SDL/SDL.h>
26 /* ---- Defines */
28 #define SMOOTHING_OFF 0
29 #define SMOOTHING_ON 1
31 /* ---- Structures */
33 typedef struct tColorRGBA {
34 Uint8 r;
35 Uint8 g;
36 Uint8 b;
37 Uint8 a;
38 } tColorRGBA;
40 typedef struct tColorY {
41 Uint8 y;
42 } tColorY;
45 /* ---- Prototypes */
47 /*
49 rotozoomSurface()
51 Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
52 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
53 then the destination 32bit surface is anti-aliased. If the surface is not 8bit
54 or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
58 SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
60 SDL_Surface *rotozoomSurfaceXY
61 (SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
63 /* Returns the size of the target surface for a rotozoomSurface() call */
65 void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
66 int *dstheight);
68 void rotozoomSurfaceSizeXY
69 (int width, int height, double angle, double zoomx, double zoomy,
70 int *dstwidth, int *dstheight);
72 /*
74 zoomSurface()
76 Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
77 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
78 then the destination 32bit surface is anti-aliased. If the surface is not 8bit
79 or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
83 SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
85 /* Returns the size of the target surface for a zoomSurface() call */
87 void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
90 /*
91 shrinkSurface()
93 Shrinks a 32bit or 8bit 'src' surface ti a newly created 'dst' surface.
94 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size,
95 3=1/3 the size, etc.) The destination surface is antialiased by averaging
96 the source box RGBA or Y information. If the surface is not 8bit
97 or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
98 */
100 SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
104 Other functions
108 SDL_Surface* rotateSurface90Degrees(SDL_Surface* pSurf, int numClockwiseTurns);
110 /* Ends C function definitions when using C++ */
111 #ifdef __cplusplus
113 #endif
115 #endif /* _SDL_rotozoom_h */