diff --git a/includes/graphics.h b/includes/graphics.h index 17aaa263c..fe13d2b98 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -52,6 +52,8 @@ void *ptif_pack(pixel *src, int w, int h, int *result_size); pixel *ptif_unpack(void *datain, int size, int *w, int *h); +pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh); + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); diff --git a/src/graphics.c b/src/graphics.c index 6cc9310dd..b59a5bc40 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -138,6 +138,23 @@ pixel *ptif_unpack(void *datain, int size, int *w, int *h){ return result; } +pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh) +{ + int y, x; + //int i,j,x,y,w,h,r,g,b,c; + pixel *q; + q = malloc(rw*rh*PIXELSIZE); + //TODO: Actual resampling, this is just cheap nearest pixel crap + for (y=0; y