67#define MAX(a,b) (((a) > (b)) ? (a) : (b))
84#define VALUE_LIMIT 0.001
122 dgap = dst->pitch - dst->w * 4;
124 for (
y = 0;
y < dst->h;
y++) {
127 for (
x = 0;
x < dst->w;
x++) {
132 for (dy=0; dy <
factory; dy++) {
133 for (dx=0; dx <
factorx; dx++) {
192 int x,
y,
sx,
sy,
ssx,
ssy, *
sax, *
say, *
csax, *
csay, *
salast,
csx,
csy,
ex,
ey,
cx,
cy,
sstep,
sstepx,
sstepy;
217 sx = (
int) (65536.0 * (
float) (src->w) / (
float) (dst->w));
218 sy = (
int) (65536.0 * (
float) (src->h) / (
float) (dst->h));
222 ssx = (src->w << 16) - 1;
223 ssy = (src->h << 16) - 1;
228 for (
x = 0;
x <= dst->w;
x++) {
242 for (
y = 0;
y <= dst->h;
y++) {
255 dgap = dst->pitch - dst->w * 4;
270 for (
y = 0;
y < dst->h;
y++) {
273 for (
x = 0;
x < dst->w;
x++) {
307 t1 = ((((
c01->r -
c00->r) *
ex) >> 16) +
c00->r) & 0xff;
308 t2 = ((((
c11->r -
c10->r) *
ex) >> 16) +
c10->r) & 0xff;
309 dp->r = (((t2 - t1) *
ey) >> 16) + t1;
310 t1 = ((((
c01->g -
c00->g) *
ex) >> 16) +
c00->g) & 0xff;
311 t2 = ((((
c11->g -
c10->g) *
ex) >> 16) +
c10->g) & 0xff;
312 dp->g = (((t2 - t1) *
ey) >> 16) + t1;
313 t1 = ((((
c01->b -
c00->b) *
ex) >> 16) +
c00->b) & 0xff;
314 t2 = ((((
c11->b -
c10->b) *
ex) >> 16) +
c10->b) & 0xff;
315 dp->b = (((t2 - t1) *
ey) >> 16) + t1;
316 t1 = ((((
c01->a -
c00->a) *
ex) >> 16) +
c00->a) & 0xff;
317 t2 = ((((
c11->a -
c10->a) *
ex) >> 16) +
c10->a) & 0xff;
318 dp->a = (((t2 - t1) *
ey) >> 16) + t1;
359 for (
y = 0;
y < dst->h;
y++) {
362 for (
x = 0;
x < dst->w;
x++) {
429 int x,
y, t1, t2, dx, dy,
xd,
yd,
sdx,
sdy,
ax,
ay,
ex,
ey, sw, sh;
437 xd = ((src->w - dst->w) << 15);
438 yd = ((src->h - dst->h) << 15);
444 gap = dst->pitch - dst->w * 4;
450 for (
y = 0;
y < dst->h;
y++) {
454 for (
x = 0;
x < dst->w;
x++) {
457 if (
flipx) dx = sw - dx;
458 if (
flipy) dy = sh - dy;
459 if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
461 sp += ((src->pitch/4) * dy);
466 sp += (src->pitch/4);
483 t1 = ((((
c01.r -
c00.r) *
ex) >> 16) +
c00.r) & 0xff;
484 t2 = ((((
c11.r -
c10.r) *
ex) >> 16) +
c10.r) & 0xff;
485 pc->r = (((t2 - t1) *
ey) >> 16) + t1;
486 t1 = ((((
c01.g -
c00.g) *
ex) >> 16) +
c00.g) & 0xff;
487 t2 = ((((
c11.g -
c10.g) *
ex) >> 16) +
c10.g) & 0xff;
488 pc->g = (((t2 - t1) *
ey) >> 16) + t1;
489 t1 = ((((
c01.b -
c00.b) *
ex) >> 16) +
c00.b) & 0xff;
490 t2 = ((((
c11.b -
c10.b) *
ex) >> 16) +
c10.b) & 0xff;
491 pc->b = (((t2 - t1) *
ey) >> 16) + t1;
492 t1 = ((((
c01.a -
c00.a) *
ex) >> 16) +
c00.a) & 0xff;
493 t2 = ((((
c11.a -
c10.a) *
ex) >> 16) +
c10.a) & 0xff;
494 pc->a = (((t2 - t1) *
ey) >> 16) + t1;
503 for (
y = 0;
y < dst->h;
y++) {
507 for (
x = 0;
x < dst->w;
x++) {
510 if (
flipx) dx = (src->w-1)-dx;
511 if (
flipy) dy = (src->h-1)-dy;
512 if ((dx >= 0) && (dy >= 0) && (
dx < src->w) && (dy < src->h)) {
551 SDL_SetError(
"NULL source surface or source surface format");
557 if ((
details->bits_per_pixel % 8) != 0) {
599 if (src->pitch == dst->pitch) {
601 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
637 dstBuf = (
Uint8*)(dst->pixels) + ((dst->h -
row - 1) * dst->pitch) + (dst->w - 1) *
bpp;
813 if ((
details->bits_per_pixel == 32)
814 || (
details->bits_per_pixel == 8)) {
1067 if ((
details->bits_per_pixel == 32)
1068 || (
details->bits_per_pixel == 8)) {
1197 if ((
details->bits_per_pixel == 32)
1198 || (
details->bits_per_pixel == 8)) {
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-...
#define GUARD_ROWS
Number of guard rows added to destination surfaces.
static void _transformSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
Internal 32 bit rotozoomer with optional anti-aliasing.
static int _zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy, int smooth)
Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.
SDL_Surface * rotozoomSurface(SDL_Surface *src, double angle, double zoom, int smooth)
Rotates and zooms a surface and optional anti-aliasing.
static int _shrinkSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
Internal 32 bit integer-factor averaging Shrinker.
SDL_Surface * rotateSurface90Degrees(SDL_Surface *src, int numClockwiseTurns)
Rotates a 8/16/24/32 bit surface in increments of 90 degrees.
SDL_Surface * zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth)
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
SDL_Surface * shrinkSurface(SDL_Surface *src, int factorx, int factory)
Shrink a surface by an integer ratio using averaging.
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.
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.
#define VALUE_LIMIT
Lower limit of absolute zoom factor or rotation degrees.
static void _rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, double *canglezoom, double *sanglezoom)
Internal target surface sizing function for rotozooms with trig result return.
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 MAX(a, b)
Returns maximum of two numbers a and b.
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite int int int width