diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-08 12:30:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-06-08 12:30:39 (GMT) |
| commit | b5c9d86fbefdc3402be2e6615bae0bc444a1d491 (patch) | |
| tree | 915b493a97cb24b66543f6bc63fd4639c1652846 /src | |
| parent | b5856bfa47020448961a60689dc2a44d09baf2ec (diff) | |
| download | powder-b5c9d86fbefdc3402be2e6615bae0bc444a1d491.zip powder-b5c9d86fbefdc3402be2e6615bae0bc444a1d491.tar.gz | |
Less blurry thumbnail scaling
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); |
