From b5c9d86fbefdc3402be2e6615bae0bc444a1d491 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 8 Jun 2011 13:30:39 +0100 Subject: [PATCH] Less blurry thumbnail scaling --- includes/graphics.h | 2 ++ src/graphics.c | 12 ++++++++++++ src/main.c | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/includes/graphics.h b/includes/graphics.h index 748946052..2d556383d 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_nn(pixel *src, int sw, int sh, int rw, int rh); + 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); diff --git a/src/graphics.c b/src/graphics.c index 0b8b8f826..af628622f 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