42#define MAX(a,b) (((a) > (b)) ? (a) : (b))
59#define VALUE_LIMIT 0.001
67 SDL_GetSurfaceColorKey(src, &key);
89 int x, y, dx, dy, dgap, ra, ga, ba, aa;
91 SDL_Color *sp, *osp, *oosp;
99 n_average = factorx*factory;
104 sp = (SDL_Color *) src->pixels;
106 dp = (SDL_Color *) dst->pixels;
107 dgap = dst->pitch - dst->w * 4;
109 for (y = 0; y < dst->h; y++) {
112 for (x = 0; x < dst->w; x++) {
117 for (dy=0; dy < factory; dy++) {
118 for (dx=0; dx < factorx; dx++) {
127 sp = (SDL_Color *)((Uint8*)sp + (src->pitch - 4*factorx));
132 sp = (SDL_Color *)((Uint8*)oosp + 4*factorx);
135 dp->r = ra/n_average;
136 dp->g = ga/n_average;
137 dp->b = ba/n_average;
138 dp->a = aa/n_average;
148 sp = (SDL_Color *)((Uint8*)osp + src->pitch*factory);
153 dp = (SDL_Color *) ((Uint8 *) dp + dgap);
177 int x, y, dx, dy, dgap, a;
179 Uint8 *sp, *osp, *oosp;
187 n_average = factorx*factory;
192 sp = (Uint8 *) src->pixels;
194 dp = (Uint8 *) dst->pixels;
195 dgap = dst->pitch - dst->w;
197 for (y = 0; y < dst->h; y++) {
200 for (x = 0; x < dst->w; x++) {
205 for (dy=0; dy < factory; dy++) {
206 for (dx=0; dx < factorx; dx++) {
213 sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx));
218 sp = (Uint8 *)((Uint8*)oosp + factorx);
231 sp = (Uint8 *)((Uint8*)osp + src->pitch*factory);
236 dp = (Uint8 *)((Uint8 *)dp + dgap);
258int _zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst,
int flipx,
int flipy,
int smooth)
260 int x, y, sx, sy, ssx, ssy, *sax, *say, *csax, *csay, *salast, csx, csy, ex, ey, cx, cy, sstep, sstepx, sstepy;
261 SDL_Color *c00, *c01, *c10, *c11;
262 SDL_Color *sp, *csp, *dp;
263 int spixelgap, spixelw, spixelh, dgap, t1, t2;
268 if ((sax = (
int *) malloc((dst->w + 1) *
sizeof(Uint32))) == NULL) {
271 if ((say = (
int *) malloc((dst->h + 1) *
sizeof(Uint32))) == NULL) {
279 spixelw = (src->w - 1);
280 spixelh = (src->h - 1);
282 sx = (int) (65536.0 * (
float) spixelw / (
float) (dst->w - 1));
283 sy = (int) (65536.0 * (
float) spixelh / (
float) (dst->h - 1));
285 sx = (int) (65536.0 * (
float) (src->w) / (
float) (dst->w));
286 sy = (int) (65536.0 * (
float) (src->h) / (
float) (dst->h));
290 ssx = (src->w << 16) - 1;
291 ssy = (src->h << 16) - 1;
296 for (x = 0; x <= dst->w; x++) {
310 for (y = 0; y <= dst->h; y++) {
321 sp = (SDL_Color *) src->pixels;
322 dp = (SDL_Color *) dst->pixels;
323 dgap = dst->pitch - dst->w * 4;
324 spixelgap = src->pitch/4;
326 if (flipx) sp += spixelw;
327 if (flipy) sp += (spixelgap * spixelh);
338 for (y = 0; y < dst->h; y++) {
341 for (x = 0; x < dst->w; x++) {
345 ex = (*csax & 0xffff);
346 ey = (*csay & 0xffff);
349 sstepx = cx < spixelw;
350 sstepy = cy < spixelh;
375 t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
376 t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
377 dp->r = (((t2 - t1) * ey) >> 16) + t1;
378 t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
379 t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
380 dp->g = (((t2 - t1) * ey) >> 16) + t1;
381 t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
382 t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
383 dp->b = (((t2 - t1) * ey) >> 16) + t1;
384 t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
385 t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
386 dp->a = (((t2 - t1) * ey) >> 16) + t1;
392 sstep = (*csax >> 16) - (*salast >> 16);
409 sstep = (*csay >> 16) - (*salast >> 16);
420 dp = (SDL_Color *) ((Uint8 *) dp + dgap);
427 for (y = 0; y < dst->h; y++) {
430 for (x = 0; x < dst->w; x++) {
441 sstep = (*csax >> 16) - (*salast >> 16);
442 if (flipx) sstep = -sstep;
455 sstep = (*csay >> 16) - (*salast >> 16);
457 if (flipy) sstep = -sstep;
463 dp = (SDL_Color *) ((Uint8 *) dp + dgap);
491int _zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst,
int flipx,
int flipy)
494 Uint32 *sax, *say, *csax, *csay;
496 Uint8 *sp, *dp, *csp;
502 if ((sax = (Uint32 *) malloc((dst->w + 1) *
sizeof(Uint32))) == NULL) {
505 if ((say = (Uint32 *) malloc((dst->h + 1) *
sizeof(Uint32))) == NULL) {
513 sp = csp = (Uint8 *) src->pixels;
514 dp = (Uint8 *) dst->pixels;
515 dgap = dst->pitch - dst->w;
517 if (flipx) csp += (src->w-1);
518 if (flipy) csp = ( (Uint8*)csp + src->pitch*(src->h-1) );
525 for (x = 0; x < dst->w; x++) {
528 while (csx >= dst->w) {
532 (*csax) = (*csax) * (flipx ? -1 : 1);
537 for (y = 0; y < dst->h; y++) {
540 while (csy >= dst->h) {
544 (*csay) = (*csay) * (flipy ? -1 : 1);
552 for (y = 0; y < dst->h; y++) {
555 for (x = 0; x < dst->w; x++) {
573 csp += ((*csay) * src->pitch);
610void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst,
int cx,
int cy,
int isin,
int icos,
int flipx,
int flipy,
int smooth)
612 int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
613 SDL_Color c00, c01, c10, c11, cswap;
620 xd = ((src->w - dst->w) << 15);
621 yd = ((src->h - dst->h) << 15);
622 ax = (cx << 16) - (icos * cx);
623 ay = (cy << 16) - (isin * cx);
626 pc = (SDL_Color *) dst->pixels;
627 gap = dst->pitch - dst->w * 4;
633 for (y = 0; y < dst->h; y++) {
635 sdx = (ax + (isin * dy)) + xd;
636 sdy = (ay - (icos * dy)) + yd;
637 for (x = 0; x < dst->w; x++) {
640 if (flipx) dx = sw - dx;
641 if (flipy) dy = sh - dy;
642 if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
643 sp = (SDL_Color *)src->pixels;;
644 sp += ((src->pitch/4) * dy);
649 sp += (src->pitch/4);
654 cswap = c00; c00=c01; c01=cswap;
655 cswap = c10; c10=c11; c11=cswap;
658 cswap = c00; c00=c10; c10=cswap;
659 cswap = c01; c01=c11; c11=cswap;
666 t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
667 t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
668 pc->r = (((t2 - t1) * ey) >> 16) + t1;
669 t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
670 t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
671 pc->g = (((t2 - t1) * ey) >> 16) + t1;
672 t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
673 t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
674 pc->b = (((t2 - t1) * ey) >> 16) + t1;
675 t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
676 t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
677 pc->a = (((t2 - t1) * ey) >> 16) + t1;
683 pc = (SDL_Color *) ((Uint8 *) pc + gap);
686 for (y = 0; y < dst->h; y++) {
688 sdx = (ax + (isin * dy)) + xd;
689 sdy = (ay - (icos * dy)) + yd;
690 for (x = 0; x < dst->w; x++) {
691 dx = (short) (sdx >> 16);
692 dy = (short) (sdy >> 16);
693 if (flipx) dx = (src->w-1)-dx;
694 if (flipy) dy = (src->h-1)-dy;
695 if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
696 sp = (SDL_Color *) ((Uint8 *) src->pixels + src->pitch * dy);
704 pc = (SDL_Color *) ((Uint8 *) pc + gap);
727void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst,
int cx,
int cy,
int isin,
int icos,
int flipx,
int flipy)
729 int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
736 xd = ((src->w - dst->w) << 15);
737 yd = ((src->h - dst->h) << 15);
738 ax = (cx << 16) - (icos * cx);
739 ay = (cy << 16) - (isin * cx);
740 pc = (Uint8 *) dst->pixels;
741 gap = dst->pitch - dst->w;
745 memset(pc, (
int)(
_colorkey(src) & 0xff), dst->pitch * dst->h);
749 for (y = 0; y < dst->h; y++) {
751 sdx = (ax + (isin * dy)) + xd;
752 sdy = (ay - (icos * dy)) + yd;
753 for (x = 0; x < dst->w; x++) {
754 dx = (short) (sdx >> 16);
755 dy = (short) (sdy >> 16);
756 if (flipx) dx = (src->w-1)-dx;
757 if (flipy) dy = (src->h-1)-dy;
758 if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
759 sp = (Uint8 *) (src->pixels);
760 sp += (src->pitch * dy + dx);
786 int row, col, newWidth, newHeight;
791 int normalizedClockwiseTurns;
792 const SDL_PixelFormatDetails* details;
797 SDL_SetError(
"NULL source surface or source surface format");
801 details = SDL_GetPixelFormatDetails(src->format);
802 if ((details->bits_per_pixel % 8) != 0) {
803 SDL_SetError(
"Invalid source surface bit depth");
808 normalizedClockwiseTurns = (numClockwiseTurns % 4);
809 if (normalizedClockwiseTurns < 0) {
810 normalizedClockwiseTurns += 4;
814 if (normalizedClockwiseTurns % 2) {
822 dst = SDL_CreateSurface(newWidth, newHeight, src->format);
824 SDL_SetError(
"Could not create destination surface");
828 if (SDL_MUSTLOCK(src)) {
829 SDL_LockSurface(src);
831 if (SDL_MUSTLOCK(dst)) {
832 SDL_LockSurface(dst);
836 bpp = details->bits_per_pixel / 8;
838 switch(normalizedClockwiseTurns) {
844 if (src->pitch == dst->pitch) {
846 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
851 srcBuf = (Uint8*)(src->pixels);
852 dstBuf = (Uint8*)(dst->pixels);
854 for (row = 0; row < src->h; row++) {
855 memcpy(dstBuf, srcBuf, bpr);
856 srcBuf += src->pitch;
857 dstBuf += dst->pitch;
866 for (row = 0; row < src->h; ++row) {
867 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
868 dstBuf = (Uint8*)(dst->pixels) + (dst->w - row - 1) * bpp;
869 for (col = 0; col < src->w; ++col) {
870 memcpy (dstBuf, srcBuf, bpp);
872 dstBuf += dst->pitch;
880 for (row = 0; row < src->h; ++row) {
881 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
882 dstBuf = (Uint8*)(dst->pixels) + ((dst->h - row - 1) * dst->pitch) + (dst->w - 1) * bpp;
883 for (col = 0; col < src->w; ++col) {
884 memcpy (dstBuf, srcBuf, bpp);
894 for (row = 0; row < src->h; ++row) {
895 srcBuf = (Uint8*)(src->pixels) + (row * src->pitch);
896 dstBuf = (Uint8*)(dst->pixels) + (row * bpp) + ((dst->h - 1) * dst->pitch);
897 for (col = 0; col < src->w; ++col) {
898 memcpy (dstBuf, srcBuf, bpp);
900 dstBuf -= dst->pitch;
908 if (SDL_MUSTLOCK(src)) {
909 SDL_UnlockSurface(src);
911 if (SDL_MUSTLOCK(dst)) {
912 SDL_UnlockSurface(dst);
934 int *dstwidth,
int *dstheight,
935 double *canglezoom,
double *sanglezoom)
937 double x, y, cx, cy, sx, sy;
939 int dstwidthhalf, dstheighthalf;
944 radangle = angle * (
M_PI / 180.0);
945 *sanglezoom = sin(radangle);
946 *canglezoom = cos(radangle);
947 *sanglezoom *= zoomx;
948 *canglezoom *= zoomy;
949 x = (double)(width / 2);
950 y = (double)(height / 2);
951 cx = *canglezoom * x;
952 cy = *canglezoom * y;
953 sx = *sanglezoom * x;
954 sy = *sanglezoom * y;
956 dstwidthhalf =
MAX((
int)
957 ceil(
MAX(
MAX(
MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
958 dstheighthalf =
MAX((
int)
959 ceil(
MAX(
MAX(
MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
960 *dstwidth = 2 * dstwidthhalf;
961 *dstheight = 2 * dstheighthalf;
975void rotozoomSurfaceSizeXY(
int width,
int height,
double angle,
double zoomx,
double zoomy,
int *dstwidth,
int *dstheight)
977 double dummy_sanglezoom, dummy_canglezoom;
979 _rotozoomSurfaceSizeTrig(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
994 double dummy_sanglezoom, dummy_canglezoom;
996 _rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
1035SDL_Surface *
rotozoomSurfaceXY(SDL_Surface * src,
double angle,
double zoomx,
double zoomy,
int smooth)
1037 SDL_Surface *rz_src;
1038 SDL_Surface *rz_dst;
1040 double sanglezoom, canglezoom, sanglezoominv, canglezoominv;
1041 int dstwidthhalf, dstwidth, dstheighthalf, dstheight;
1043 int i, src_converted;
1045 const SDL_PixelFormatDetails* details;
1046 SDL_Palette* pal_dst;
1047 SDL_Palette* pal_src;
1059 details = SDL_GetPixelFormatDetails(src->format);
1060 is32bit = (details->bits_per_pixel == 32);
1061 if ((is32bit) || (details->bits_per_pixel == 8)) {
1072 SDL_CreateSurface(src->w, src->h, SDL_PIXELFORMAT_RGBA32);
1074 SDL_BlitSurface(src, NULL, rz_src, NULL);
1083 flipx = (zoomx<0.0);
1084 if (flipx) zoomx=-zoomx;
1085 flipy = (zoomy<0.0);
1086 if (flipy) zoomy=-zoomy;
1089 zoominv = 65536.0 / (zoomx * zoomx);
1104 _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom);
1109 sanglezoominv = sanglezoom;
1110 canglezoominv = canglezoom;
1111 sanglezoominv *= zoominv;
1112 canglezoominv *= zoominv;
1115 dstwidthhalf = dstwidth / 2;
1116 dstheighthalf = dstheight / 2;
1127 SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, rz_src->format);
1132 rz_dst = SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, SDL_PIXELFORMAT_INDEX8);
1133 pal_dst = SDL_CreateSurfacePalette(rz_dst);
1141 rz_dst->h = dstheight;
1146 if (SDL_MUSTLOCK(rz_src)) {
1147 SDL_LockSurface(rz_src);
1158 (
int) (sanglezoominv), (
int) (canglezoominv),
1165 pal_src = SDL_GetSurfacePalette(rz_src);
1166 for (i = 0; i < pal_src->ncolors; i++) {
1167 pal_dst->colors[i] = pal_src->colors[i];
1169 pal_dst->ncolors = pal_src->ncolors;
1174 (
int) (sanglezoominv), (
int) (canglezoominv),
1180 if (SDL_MUSTLOCK(rz_src)) {
1181 SDL_UnlockSurface(rz_src);
1196 zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
1207 SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, rz_src->format);
1212 rz_dst = SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, SDL_PIXELFORMAT_INDEX8);
1213 pal_dst = SDL_CreateSurfacePalette(rz_dst);
1221 rz_dst->h = dstheight;
1226 if (SDL_MUSTLOCK(rz_src)) {
1227 SDL_LockSurface(rz_src);
1243 pal_src = SDL_GetSurfacePalette(rz_src);
1244 for (i = 0; i < pal_src->ncolors; i++) {
1245 pal_dst->colors[i] = pal_src->colors[i];
1247 pal_dst->ncolors = pal_src->ncolors;
1258 if (SDL_MUSTLOCK(rz_src)) {
1259 SDL_UnlockSurface(rz_src);
1266 if (src_converted) {
1267 SDL_DestroySurface(rz_src);
1288void zoomSurfaceSize(
int width,
int height,
double zoomx,
double zoomy,
int *dstwidth,
int *dstheight)
1294 flipx = (zoomx<0.0);
1295 if (flipx) zoomx = -zoomx;
1296 flipy = (zoomy<0.0);
1297 if (flipy) zoomy = -zoomy;
1312 *dstwidth = (int) floor(((
double) width * zoomx) + 0.5);
1313 *dstheight = (int) floor(((
double) height * zoomy) + 0.5);
1314 if (*dstwidth < 1) {
1317 if (*dstheight < 1) {
1338SDL_Surface *
zoomSurface(SDL_Surface * src,
double zoomx,
double zoomy,
int smooth)
1340 SDL_Surface *rz_src;
1341 SDL_Surface *rz_dst;
1342 int dstwidth, dstheight;
1344 int i, src_converted;
1346 const SDL_PixelFormatDetails* details;
1347 SDL_Palette* pal_src;
1348 SDL_Palette* pal_dst;
1359 details = SDL_GetPixelFormatDetails(src->format);
1360 is32bit = (details->bits_per_pixel == 32);
1361 if ((is32bit) || (details->bits_per_pixel == 8)) {
1372 SDL_CreateSurface(src->w, src->h, SDL_PIXELFORMAT_RGBA32);
1373 if (rz_src == NULL) {
1376 SDL_BlitSurface(src, NULL, rz_src, NULL);
1381 flipx = (zoomx<0.0);
1382 if (flipx) zoomx = -zoomx;
1383 flipy = (zoomy<0.0);
1384 if (flipy) zoomy = -zoomy;
1387 zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
1398 SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, rz_src->format);
1403 rz_dst = SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, SDL_PIXELFORMAT_INDEX8);
1404 pal_dst = SDL_CreateSurfacePalette(rz_dst);
1408 if (rz_dst == NULL) {
1412 if (src_converted) {
1413 SDL_DestroySurface(rz_src);
1419 rz_dst->h = dstheight;
1424 if (SDL_MUSTLOCK(rz_src)) {
1425 SDL_LockSurface(rz_src);
1440 pal_src = SDL_GetSurfacePalette(rz_src);
1441 for (i = 0; i < pal_src->ncolors; i++) {
1442 pal_dst->colors[i] = pal_src->colors[i];
1444 pal_dst->ncolors = pal_src->ncolors;
1453 if (SDL_MUSTLOCK(rz_src)) {
1454 SDL_UnlockSurface(rz_src);
1460 if (src_converted) {
1461 SDL_DestroySurface(rz_src);
1490 SDL_Surface *rz_src;
1491 SDL_Surface *rz_dst = NULL;
1492 int dstwidth, dstheight;
1494 int i, src_converted;
1496 const SDL_PixelFormatDetails* details;
1497 SDL_Palette* pal_src;
1498 SDL_Palette* pal_dst;
1510 details = SDL_GetPixelFormatDetails(src->format);
1511 is32bit = (details->bits_per_pixel == 32);
1512 if ((is32bit) || (details->bits_per_pixel == 8)) {
1522 rz_src = SDL_CreateSurface(src->w, src->h, SDL_PIXELFORMAT_RGBA32);
1525 goto exitShrinkSurface;
1528 SDL_BlitSurface(src, NULL, rz_src, NULL);
1536 if (SDL_MUSTLOCK(rz_src)) {
1537 if (SDL_LockSurface(rz_src) < 0) {
1539 goto exitShrinkSurface;
1544 dstwidth=rz_src->w/factorx;
1545 while (dstwidth*factorx>rz_src->w) { dstwidth--; }
1546 dstheight=rz_src->h/factory;
1547 while (dstheight*factory>rz_src->h) { dstheight--; }
1558 SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, rz_src->format);
1563 rz_dst = SDL_CreateSurface(dstwidth, dstheight +
GUARD_ROWS, SDL_PIXELFORMAT_INDEX8);
1564 pal_dst = SDL_CreateSurfacePalette(rz_dst);
1568 if (rz_dst == NULL) {
1570 goto exitShrinkSurface;
1574 rz_dst->h = dstheight;
1584 if ((result!=0) || (rz_dst==NULL)) {
1586 goto exitShrinkSurface;
1592 pal_src = SDL_GetSurfacePalette(rz_src);
1593 for (i = 0; i < pal_src->ncolors; i++) {
1594 pal_dst->colors[i] = pal_src->colors[i];
1596 pal_dst->ncolors = pal_src->ncolors;
1603 goto exitShrinkSurface;
1612 if (SDL_MUSTLOCK(rz_src)) {
1613 SDL_UnlockSurface(rz_src);
1619 if (src_converted==1) {
1620 SDL_DestroySurface(rz_src);
1627 SDL_DestroySurface(rz_dst);
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.
void transformSurfaceY(SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.
SDL_Surface * rotozoomSurface(SDL_Surface *src, double angle, double zoom, int smooth)
Rotates and zooms a surface and optional anti-aliasing.
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.
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.
#define VALUE_LIMIT
Lower limit of absolute zoom factor or rotation degrees.
int _shrinkSurfaceY(SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
Internal 8 bit integer-factor averaging shrinker.
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.
int _shrinkSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)
Internal 32 bit integer-factor averaging Shrinker.
int _zoomSurfaceY(SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy)
Internal 8 bit Zoomer without smoothing.
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.
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.
#define MAX(a, b)
Returns maximum of two numbers a and b.
Uint32 _colorkey(SDL_Surface *src)
Returns colorkey info for a surface.