PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/src/GFX/Rotozoom.xs

http://github.com/PerlGameDev/SDL
Unknown | 217 lines | 181 code | 36 blank | 0 comment | 0 complexity | f082199464450ceb5eca1d045d4ad68e MD5 | raw file
  1#include "EXTERN.h"
  2#include "perl.h"
  3#include "XSUB.h"
  4#include "ppport.h"
  5
  6#ifndef aTHX_
  7#define aTHX_
  8#endif
  9
 10#include <SDL.h>
 11#ifdef HAVE_SDL_GFX_ROTOZOOM
 12#include <SDL_rotozoom.h>
 13
 14#ifndef _SDL_gfxPrimitives_h
 15#include <SDL_gfxPrimitives.h>
 16#endif
 17
 18#ifndef SDL_GFXPRIMITIVES_MAJOR
 19#define SDL_GFXPRIMITIVES_MAJOR 0
 20#endif
 21
 22#ifndef SDL_GFXPRIMITIVES_MINOR
 23#define SDL_GFXPRIMITIVES_MINOR 0
 24#endif
 25
 26#ifndef SDL_GFXPRIMITIVES_MICRO
 27#define SDL_GFXPRIMITIVES_MICRO 0
 28#endif
 29
 30#endif 
 31
 32MODULE = SDL::GFX::Rotozoom 	PACKAGE = SDL::GFX::Rotozoom    PREFIX = gfx_roto_
 33
 34=for documentation
 35
 36The Following are XS bindings to the SDL_gfx Library
 37
 38Described here:
 39
 40See: L<http:/*www.ferzkopp.net/joomla/content/view/19/14/> */
 41
 42=cut
 43
 44#ifdef HAVE_SDL_GFX_ROTOZOOM
 45
 46SDL_Surface *
 47gfx_roto_surface(src, angle, zoom, smooth)
 48	SDL_Surface * src
 49	double angle
 50	double zoom
 51	int smooth
 52	PREINIT:
 53		char *CLASS = "SDL::Surface";
 54	CODE:
 55		RETVAL = rotozoomSurface(src, angle, zoom, smooth);
 56	OUTPUT:
 57		RETVAL
 58
 59#if (SDL_GFXPRIMITIVES_MAJOR >= 2) && (SDL_GFXPRIMITIVES_MINOR >= 0) && (SDL_GFXPRIMITIVES_MICRO >= 13)
 60
 61SDL_Surface *
 62gfx_roto_surface_xy(src, angle, zoomx, zoomy, smooth)
 63	SDL_Surface * src
 64	double angle
 65	double zoomx
 66	double zoomy
 67	int smooth
 68	PREINIT:
 69		char *CLASS = "SDL::Surface";
 70	CODE:
 71		RETVAL = rotozoomSurfaceXY(src, angle, zoomx, zoomy, smooth);
 72	OUTPUT:
 73		RETVAL
 74
 75#else
 76
 77SDL_Surface *
 78gfx_roto_surface_xy(src, angle, zoomx, zoomy, smooth)
 79	SDL_Surface * src
 80	double angle
 81	double zoomx
 82	double zoomy
 83	int smooth
 84	PREINIT:
 85		char *CLASS = "SDL::Surface";
 86	CODE:
 87		warn("SDL_gfx >= 2.0.14 needed for SDL::GFX::Rotozoom::surface_xy( src, angle, zoomx, zoomy, smooth )");
 88		XSRETURN_UNDEF;
 89	OUTPUT:
 90		RETVAL
 91
 92#endif
 93
 94AV *
 95gfx_roto_surface_size(width, height, angle, zoom)
 96	int width
 97	int height
 98	double angle
 99	double zoom
100	CODE:
101		int dstwidth,dstheight;
102		rotozoomSurfaceSize(width, height, angle, zoom, &dstwidth, &dstheight);
103		RETVAL = newAV();
104		sv_2mortal((SV*)RETVAL);
105		av_push(RETVAL,newSViv(dstwidth));
106		av_push(RETVAL,newSViv(dstheight));
107	OUTPUT:
108		RETVAL
109
110AV *
111gfx_roto_surface_size_xy(width, height, angle, zoomx, zoomy)
112	int width
113	int height
114	double angle
115	double zoomx
116	double zoomy
117	CODE:
118		int dstwidth,dstheight;
119		rotozoomSurfaceSizeXY(width, height, angle, zoomx, zoomy, &dstwidth, &dstheight);
120		RETVAL = newAV();
121		sv_2mortal((SV*)RETVAL);
122		av_push(RETVAL,newSViv(dstwidth));
123		av_push(RETVAL,newSViv(dstheight));
124	OUTPUT:
125		RETVAL
126	
127
128SDL_Surface *
129gfx_roto_zoom_surface(src, zoomx, zoomy, smooth)
130	SDL_Surface * src
131	double zoomx
132	double zoomy
133	int smooth
134	PREINIT:
135		char *CLASS = "SDL::Surface";
136	CODE:
137		RETVAL = zoomSurface(src, zoomx, zoomy, smooth);
138	OUTPUT:
139		RETVAL
140
141AV *
142gfx_roto_zoom_surface_size(width, height, zoomx, zoomy)
143	int width
144	int height
145	double zoomx
146	double zoomy
147	CODE:
148		int dstwidth,dstheight;
149		zoomSurfaceSize(width, height, zoomx, zoomy, &dstwidth, &dstheight);
150		RETVAL = newAV();
151		sv_2mortal((SV*)RETVAL);
152		av_push(RETVAL,newSViv(dstwidth));
153		av_push(RETVAL,newSViv(dstheight));
154	OUTPUT:
155		RETVAL
156
157#if (SDL_GFXPRIMITIVES_MAJOR >= 2) && (SDL_GFXPRIMITIVES_MINOR >= 0) && (SDL_GFXPRIMITIVES_MICRO >= 14)
158
159SDL_Surface *
160gfx_roto_shrink_surface(src, factorx, factory)
161	SDL_Surface * src
162	float factorx
163	float factory
164	PREINIT:
165		char *CLASS = "SDL::Surface";
166	CODE:
167		RETVAL = shrinkSurface(src, factorx, factory);
168	OUTPUT:
169		RETVAL
170
171#else
172
173SDL_Surface *
174gfx_roto_shrink_surface(src, factorx, factory)
175	SDL_Surface * src
176	int factorx
177	int factory
178	PREINIT:
179		char *CLASS = "SDL::Surface";
180	CODE:
181		warn("SDL_gfx >= 2.0.14 needed for SDL::GFX::Rotozoom::shrink_surface( src, factorx, factory )");
182		XSRETURN_UNDEF;
183	OUTPUT:
184		RETVAL
185
186#endif
187
188#if (SDL_GFXPRIMITIVES_MAJOR >= 2) && (SDL_GFXPRIMITIVES_MINOR >= 0) && (SDL_GFXPRIMITIVES_MICRO >= 17)
189
190SDL_Surface *
191gfx_roto_rotate_surface_90_degrees(pSurf, numClockwiseTurns)
192	SDL_Surface* pSurf
193	int numClockwiseTurns
194	PREINIT:
195		char *CLASS = "SDL::Surface";
196	CODE:
197		RETVAL = rotateSurface90Degrees(pSurf, numClockwiseTurns);
198	OUTPUT:
199		RETVAL
200
201#else
202
203SDL_Surface *
204gfx_roto_rotate_surface_90_degrees(pSurf, numClockwiseTurns)
205	SDL_Surface* pSurf
206	int numClockwiseTurns
207	PREINIT:
208		char *CLASS = "SDL::Surface";
209	CODE:
210		warn("SDL_gfx >= 2.0.17 needed for SDL::GFX::Rotozoom::rotate_surface_90_degrees( src, numclockwiseturns )");
211		XSRETURN_UNDEF;
212	OUTPUT:
213		RETVAL
214
215#endif
216
217#endif