Tizen 2.1 base
[sdk/emulator/qemu.git] / ui / sdl_rotate.h
1 /*
2  * Derived from: SDL_rotozoom,  LGPL (c) A. Schiffler from the SDL_gfx library.
3  * Modifications by Hyunjun Son(hj79.son@samsung.com)
4  *
5  * This work is licensed under the terms of the GNU GPL version 2.
6  * See the COPYING file in the top-level directory.
7  *
8  */
9
10 #ifndef _SDL_rotate_h
11 #define _SDL_rotate_h
12
13 #include <SDL.h>
14 #include <math.h>
15
16 /* ---- Prototypes */
17
18 #ifdef WIN32
19 #  ifdef DLL_EXPORT
20 #    define SDL_ROTOZOOM_SCOPE __declspec(dllexport)
21 #  else
22 #    ifdef LIBSDL_GFX_DLL_IMPORT
23 #      define SDL_ROTOZOOM_SCOPE __declspec(dllimport)
24 #    endif
25 #  endif
26 #endif
27 #ifndef SDL_ROTOZOOM_SCOPE
28 #  define SDL_ROTOZOOM_SCOPE extern
29 #endif
30
31 /*
32
33  rotozoomSurface()
34
35  Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
36  'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
37  then the destination 32bit surface is anti-aliased. If the surface is not 8bit
38  or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
39
40  */
41
42 SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
43
44 SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
45 (SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
46
47 /* Returns the size of the target surface for a rotozoomSurface() call */
48
49 SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
50                 int *dstheight);
51
52 SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
53 (int width, int height, double angle, double zoomx, double zoomy,
54                 int *dstwidth, int *dstheight);
55
56 /*
57
58  zoomSurface()
59
60  Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
61  'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
62  then the destination 32bit surface is anti-aliased. If the surface is not 8bit
63  or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
64
65  */
66
67 SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
68
69 /* Returns the size of the target surface for a zoomSurface() call */
70
71 SDL_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
72
73
74 /*
75     shrinkSurface()
76
77     Shrinks a 32bit or 8bit 'src' surface ti a newly created 'dst' surface.
78     'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size,
79     3=1/3 the size, etc.) The destination surface is antialiased by averaging
80     the source box RGBA or Y information. If the surface is not 8bit
81     or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
82  */
83
84 SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
85
86 /*
87
88     Other functions
89
90  */
91
92 SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* pSurf, int numClockwiseTurns);
93
94 /* Ends C function definitions when using C++ */
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif                          /* _SDL_rotate_h */