annotate window/SDL_rotozoom.h @ 9:b6d6c0ffb423

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