69#define MAX(a,b) (((a) > (b)) ? (a) : (b))
86#define VALUE_LIMIT 0.001
124 dgap = dst->pitch - dst->w * 4;
126 for (
y = 0;
y < dst->h;
y++) {
129 for (
x = 0;
x < dst->w;
x++) {
134 for (dy=0; dy <
factory; dy++) {
135 for (dx=0; dx <
factorx; dx++) {
194 int x,
y,
sx,
sy,
ssx,
ssy, *
sax, *
say, *
csax, *
csay, *
salast,
csx,
csy,
ex,
ey,
cx,
cy,
sstep,
sstepx,
sstepy;
219 sx = (
int) (65536.0 * (
float) (src->w) / (
float) (dst->w));
220 sy = (
int) (65536.0 * (
float) (src->h) / (
float) (dst->h));
224 ssx = (src->w << 16) - 1;
225 ssy = (src->h << 16) - 1;
230 for (
x = 0;
x <= dst->w;
x++) {
244 for (
y = 0;
y <= dst->h;
y++) {
257 dgap = dst->pitch - dst->w * 4;
272 for (
y = 0;
y < dst->h;
y++) {
275 for (
x = 0;
x < dst->w;
x++) {
309 t1 = ((((
c01->r -
c00->r) *
ex) >> 16) +
c00->r) & 0xff;
310 t2 = ((((
c11->r -
c10->r) *
ex) >> 16) +
c10->r) & 0xff;
311 dp->r = (((t2 - t1) *
ey) >> 16) + t1;
312 t1 = ((((
c01->g -
c00->g) *
ex) >> 16) +
c00->g) & 0xff;
313 t2 = ((((
c11->g -
c10->g) *
ex) >> 16) +
c10->g) & 0xff;
314 dp->g = (((t2 - t1) *
ey) >> 16) + t1;
315 t1 = ((((
c01->b -
c00->b) *
ex) >> 16) +
c00->b) & 0xff;
316 t2 = ((((
c11->b -
c10->b) *
ex) >> 16) +
c10->b) & 0xff;
317 dp->b = (((t2 - t1) *
ey) >> 16) + t1;
318 t1 = ((((
c01->a -
c00->a) *
ex) >> 16) +
c00->a) & 0xff;
319 t2 = ((((
c11->a -
c10->a) *
ex) >> 16) +
c10->a) & 0xff;
320 dp->a = (((t2 - t1) *
ey) >> 16) + t1;
361 for (
y = 0;
y < dst->h;
y++) {
364 for (
x = 0;
x < dst->w;
x++) {
431 int x,
y, t1, t2, dx, dy,
xd,
yd,
sdx,
sdy,
ax,
ay,
ex,
ey, sw, sh;
439 xd = ((src->w - dst->w) << 15);
440 yd = ((src->h - dst->h) << 15);
446 gap = dst->pitch - dst->w * 4;
452 for (
y = 0;
y < dst->h;
y++) {
456 for (
x = 0;
x < dst->w;
x++) {
459 if (
flipx) dx = sw - dx;
460 if (
flipy) dy = sh - dy;
461 if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
463 sp += ((src->pitch/4) * dy);
468 sp += (src->pitch/4);
485 t1 = ((((
c01.r -
c00.r) *
ex) >> 16) +
c00.r) & 0xff;
486 t2 = ((((
c11.r -
c10.r) *
ex) >> 16) +
c10.r) & 0xff;
487 pc->r = (((t2 - t1) *
ey) >> 16) + t1;
488 t1 = ((((
c01.g -
c00.g) *
ex) >> 16) +
c00.g) & 0xff;
489 t2 = ((((
c11.g -
c10.g) *
ex) >> 16) +
c10.g) & 0xff;
490 pc->g = (((t2 - t1) *
ey) >> 16) + t1;
491 t1 = ((((
c01.b -
c00.b) *
ex) >> 16) +
c00.b) & 0xff;
492 t2 = ((((
c11.b -
c10.b) *
ex) >> 16) +
c10.b) & 0xff;
493 pc->b = (((t2 - t1) *
ey) >> 16) + t1;
494 t1 = ((((
c01.a -
c00.a) *
ex) >> 16) +
c00.a) & 0xff;
495 t2 = ((((
c11.a -
c10.a) *
ex) >> 16) +
c10.a) & 0xff;
496 pc->a = (((t2 - t1) *
ey) >> 16) + t1;
505 for (
y = 0;
y < dst->h;
y++) {
509 for (
x = 0;
x < dst->w;
x++) {
512 if (
flipx) dx = (src->w-1)-dx;
513 if (
flipy) dy = (src->h-1)-dy;
514 if ((dx >= 0) && (dy >= 0) && (
dx < src->w) && (dy < src->h)) {
553 SDL_SetError(
"NULL source surface or source surface format");
559 if ((
details->bits_per_pixel % 8) != 0) {
601 if (src->pitch == dst->pitch) {
603 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
639 dstBuf = (
Uint8*)(dst->pixels) + ((dst->h -
row - 1) * dst->pitch) + (dst->w - 1) *
bpp;
815 if ((
details->bits_per_pixel == 32)
816 || (
details->bits_per_pixel == 8)) {
1069 if ((
details->bits_per_pixel == 32)
1070 || (
details->bits_per_pixel == 8)) {
1199 if ((
details->bits_per_pixel == 32)
1200 || (
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