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