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