diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 12 | ||||
| -rw-r--r-- | src/main.c | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/graphics.c b/src/graphics.c index 0b8b8f8..af62862 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -140,6 +140,18 @@ pixel *ptif_unpack(void *datain, int size, int *w, int *h){ return result; } +pixel *resample_img_nn(pixel * src, int sw, int sh, int rw, int rh) +{ + int y, x; + pixel *q = NULL; + q = malloc(rw*rh*PIXELSIZE); + for (y=0; y<rh; y++) + for (x=0; x<rw; x++){ + q[rw*y+x] = src[sw*(y*sh/rh)+(x*sw/rw)]; + } + return q; +} + pixel *resample_img(pixel *src, int sw, int sh, int rw, int rh) { int y, x; @@ -1482,8 +1482,8 @@ int main(int argc, char *argv[]) free(datares); datares = NULL; } - scaled_buf = resample_img(vid_buf, XRES, YRES, XRES/4, YRES/4); - datares = ptif_pack(scaled_buf, XRES/4, YRES/4, &res); + scaled_buf = resample_img(vid_buf, XRES, YRES, XRES/GRID_Z, YRES/GRID_Z); + datares = ptif_pack(scaled_buf, XRES/GRID_Z, YRES/GRID_Z, &res); if(datares!=NULL){ f=fopen(ptismallfilename, "wb"); fwrite(datares, res, 1, f); |
