SDL2_gfx 1.0.2
Graphics primitives and surface functions for SDL2
/builddir/build/BUILD/SDL2_gfx-1.0.4/SDL2_rotozoom.h
Go to the documentation of this file.
1/*
2
3SDL2_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
4
5Copyright (C) 2012-2014 Andreas Schiffler
6
7This software is provided 'as-is', without any express or implied
8warranty. In no event will the authors be held liable for any damages
9arising from the use of this software.
10
11Permission is granted to anyone to use this software for any purpose,
12including commercial applications, and to alter it and redistribute it
13freely, subject to the following restrictions:
14
151. The origin of this software must not be misrepresented; you must not
16claim that you wrote the original software. If you use this software
17in a product, an acknowledgment in the product documentation would be
18appreciated but is not required.
19
202. Altered source versions must be plainly marked as such, and must not be
21misrepresented as being the original software.
22
233. This notice may not be removed or altered from any source
24distribution.
25
26Andreas 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
37extern "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
51#define SMOOTHING_OFF 0
52
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
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
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 */
SDL2_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurface(SDL_Surface *src, double angle, double zoom, int smooth)
Rotates and zooms a surface and optional anti-aliasing.
SDL2_ROTOZOOM_SCOPE SDL_Surface * rotozoomSurfaceXY(SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)
Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...
SDL2_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
Calculates the size of the target surface for a zoomSurface() call.
SDL2_ROTOZOOM_SCOPE SDL_Surface * zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth)
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
Returns the size of the resulting target surface for a rotozoomSurface() call.
SDL2_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
#define SDL2_ROTOZOOM_SCOPE
Definition: SDL2_rotozoom.h:70
SDL2_ROTOZOOM_SCOPE SDL_Surface * shrinkSurface(SDL_Surface *src, int factorx, int factory)
Shrink a surface by an integer ratio using averaging.
SDL2_ROTOZOOM_SCOPE SDL_Surface * rotateSurface90Degrees(SDL_Surface *src, int numClockwiseTurns)
Rotates a 8/16/24/32 bit surface in increments of 90 degrees.