1 #include <SDL.h>
2 #if SDL_VERSION_ATLEAST(2,0,0)
3 #include "SDL2_rotozoom.h"
4 #else
5 /*
6 
7 SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
8 
9 Copyright (C) 2001-2012  Andreas Schiffler
10 
11 This software is provided 'as-is', without any express or implied
12 warranty. In no event will the authors be held liable for any damages
13 arising from the use of this software.
14 
15 Permission is granted to anyone to use this software for any purpose,
16 including commercial applications, and to alter it and redistribute it
17 freely, subject to the following restrictions:
18 
19 1. The origin of this software must not be misrepresented; you must not
20 claim that you wrote the original software. If you use this software
21 in a product, an acknowledgment in the product documentation would be
22 appreciated but is not required.
23 
24 2. Altered source versions must be plainly marked as such, and must not be
25 misrepresented as being the original software.
26 
27 3. This notice may not be removed or altered from any source
28 distribution.
29 
30 Andreas Schiffler -- aschiffler at ferzkopp dot net
31 
32 */
33 
34 #ifndef _SDL_rotozoom_h
35 #define _SDL_rotozoom_h
36 
37 #include <math.h>
38 
39 /* Set up for C function definitions, even when using C++ */
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #ifndef M_PI
45 #define M_PI	3.141592654
46 #endif
47 
48 #include "SDL.h"
49 
50 	/* ---- Defines */
51 
52 	/*!
53 	\brief Disable anti-aliasing (no smoothing).
54 	*/
55 #define SMOOTHING_OFF		0
56 
57 	/*!
58 	\brief Enable anti-aliasing (smoothing).
59 	*/
60 #define SMOOTHING_ON		1
61 
62 	/* ---- Function Prototypes */
63 
64 #ifdef _MSC_VER
65 #  if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
66 #    define SDL_ROTOZOOM_SCOPE __declspec(dllexport)
67 #  else
68 #    ifdef LIBSDL_GFX_DLL_IMPORT
69 #      define SDL_ROTOZOOM_SCOPE __declspec(dllimport)
70 #    endif
71 #  endif
72 #endif
73 #ifndef SDL_ROTOZOOM_SCOPE
74 #  define SDL_ROTOZOOM_SCOPE extern
75 #endif
76 
77 	/*
78 
79 	Rotozoom functions
80 
81 	*/
82 
83 	SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
84 
85 	SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
86 		(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
87 
88 
89 	SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
90 		int *dstheight);
91 
92 	SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
93 		(int width, int height, double angle, double zoomx, double zoomy,
94 		int *dstwidth, int *dstheight);
95 
96 	/*
97 
98 	Zooming functions
99 
100 	*/
101 
102 	SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
103 
104 	SDL_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
105 
106 	/*
107 
108 	Shrinking functions
109 
110 	*/
111 
112 	SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
113 
114 	/*
115 
116 	Specialized rotation functions
117 
118 	*/
119 
120 	SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns);
121 
122 	/* Ends C function definitions when using C++ */
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif				/* _SDL_rotozoom_h */
128 #endif
129