65 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
77 #define GUARD_ROWS (2)
82 #define VALUE_LIMIT 0.001
108 int *dstwidth,
int *dstheight,
109 double *cangle,
double *sangle)
111 double x,
y, cx, cy, sx, sy;
113 int dstwidthhalf, dstheighthalf;
118 radangle = angle * (
M_PI / 180.0);
121 x = (double)(width / 2);
122 y = (double)(height / 2);
128 dstwidthhalf =
MAX((
int)
130 dstheighthalf =
MAX((
int)
132 *dstwidth = 2 * dstwidthhalf;
133 *dstheight = 2 * dstheighthalf;
158 int x,
y,
t1,
t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
166 xd = ((src->
w - dst->
w) << 15);
167 yd = ((src->
h - dst->
h) << 15);
168 ax = (cx << 16) - (icos * cx);
169 ay = (cy << 16) - (isin * cx);
173 gap = dst->
pitch - dst->
w * 4;
179 for (y = 0; y < dst->
h; y++) {
181 sdx = (ax + (isin * dy)) + xd;
182 sdy = (ay - (icos * dy)) + yd;
183 for (x = 0; x < dst->
w; x++) {
186 if (flipx) dx = sw - dx;
187 if (flipy) dy = sh - dy;
188 if ((dx > -1) && (dy > -1) && (dx < (src->
w-1)) && (dy < (src->
h-1))) {
190 sp += ((src->
pitch/4) * dy);
195 sp += (src->
pitch/4);
200 cswap = c00; c00=c01; c01=cswap;
201 cswap = c10; c10=c11; c11=cswap;
204 cswap = c00; c00=c10; c10=cswap;
205 cswap = c01; c01=c11; c11=cswap;
212 t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
213 t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
214 pc->r = (((t2 -
t1) * ey) >> 16) + t1;
215 t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
216 t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
217 pc->g = (((t2 -
t1) * ey) >> 16) + t1;
218 t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
219 t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
220 pc->b = (((t2 -
t1) * ey) >> 16) + t1;
221 t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
222 t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
223 pc->a = (((t2 -
t1) * ey) >> 16) + t1;
232 for (y = 0; y < dst->
h; y++) {
234 sdx = (ax + (isin * dy)) + xd;
235 sdy = (ay - (icos * dy)) + yd;
236 for (x = 0; x < dst->
w; x++) {
237 dx = (short) (sdx >> 16);
238 dy = (short) (sdy >> 16);
239 if (flipx) dx = (src->
w-1)-dx;
240 if (flipy) dy = (src->
h-1)-dy;
241 if ((dx >= 0) && (dy >= 0) && (dx < src->
w) && (dy < src->
h)) {
275 int x,
y, dx, dy, xd, yd, sdx, sdy, ax, ay;
282 xd = ((src->
w - dst->
w) << 15);
283 yd = ((src->
h - dst->
h) << 15);
284 ax = (cx << 16) - (icos * cx);
285 ay = (cy << 16) - (isin * cx);
287 gap = dst->
pitch - dst->
w;
295 for (y = 0; y < dst->
h; y++) {
297 sdx = (ax + (isin * dy)) + xd;
298 sdy = (ay - (icos * dy)) + yd;
299 for (x = 0; x < dst->
w; x++) {
300 dx = (short) (sdx >> 16);
301 dy = (short) (sdy >> 16);
302 if (flipx) dx = (src->
w-1)-dx;
303 if (flipy) dy = (src->
h-1)-dy;
304 if ((dx >= 0) && (dy >= 0) && (dx < src->
w) && (dy < src->
h)) {
306 sp += (src->
pitch * dy + dx);
343 SDL_Surface *
_rotateSurface(
SDL_Surface *
src,
double angle,
int centerx,
int centery,
int smooth,
int flipx,
int flipy,
int dstwidth,
int dstheight,
double cangle,
double sangle)
348 int i, src_converted;
351 int colorKeyAvailable = 0;
352 double sangleinv, cangleinv;
364 colorKeyAvailable = 1;
383 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
385 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
388 if(colorKeyAvailable)
393 if(colorKeyAvailable)
406 sangleinv = sangle*65536.0;
407 cangleinv = cangle*65536.0;
433 rz_dst->
h = dstheight;
435 if (colorKeyAvailable == 1){
456 (
int) (sangleinv), (
int) (cangleinv),
476 (
int) (sangleinv), (
int) (cangleinv),
DECLSPEC double SDLCALL SDL_cos(double x)
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface)
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
DECLSPEC double SDLCALL SDL_fabs(double x)
A collection of pixels used in software blitting.
EGLSurface EGLint EGLint EGLint EGLint height
GLboolean GLboolean GLboolean GLboolean a
DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface *surface, Uint32 *key)
Gets the color key (transparent pixel) in a blittable surface.
struct tColorRGBA tColorRGBA
DECLSPEC double SDLCALL SDL_sin(double x)
DECLSPEC int SDLCALL SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
Uint32 _colorkey(SDL_Surface *src)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface)
EGLSurface EGLint EGLint EGLint width
void transformSurfaceY(SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
void _transformSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len)
SDL_Surface * _rotateSurface(SDL_Surface *src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle)
void _rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle)
DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
Sets the color key (transparent pixel) in a blittable surface.
EGLSurface EGLint EGLint y
uint8_t Uint8
An unsigned 8-bit integer type.
DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
Maps an RGB triple to an opaque pixel value for a given pixel format.
DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)
Get the RGB components from a pixel of the specified format.
DECLSPEC double SDLCALL SDL_ceil(double x)
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble b
GLint GLint GLint GLint GLint w
DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface)
Sets up a surface for directly accessing the pixels.