- Timestamp:
- Feb 27, 2008, 1:41:29 AM (15 years ago)
- Location:
- libpipi/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libpipi/trunk/genethumb/genethumb.c
r2245 r2246 9 9 10 10 i = pipi_load("irc.png"); 11 j = pipi_resize(i, 1000, 114);11 j = pipi_resize(i, 240, 240); 12 12 pipi_save(j, "irc.bmp"); 13 13 pipi_free(i); -
libpipi/trunk/pipi/resize.c
r2245 r2246 20 20 #include "common.h" 21 21 22 #include <stdlib.h> 23 #include <string.h> 24 22 25 #include "pipi_internals.h" 23 26 #include "pipi.h" … … 27 30 int *aline, *line; 28 31 pipi_image_t *dst; 29 int x, y, x0, y0, sw, dw, sh, dh, remy = 0;32 int x, y, x0, y0, sw, dw, sh, dh, remy; 30 33 31 34 dst = pipi_new(w, h); … … 37 40 line = malloc(3 * dw * sizeof(int)); 38 41 42 memset(line, 0, 3 * dw * sizeof(int)); 43 remy = 0; 44 39 45 for(y = 0, y0 = 0; y < dst->height; y++) 40 46 { … … 42 48 43 49 memset(aline, 0, 3 * dw * sizeof(int)); 44 memset(line, 0, 3 * dw * sizeof(int));45 50 46 51 while(toty < sh) … … 48 53 if(remy == 0) 49 54 { 55 int r = 0, g = 0, b = 0; 56 int remx = 0; 57 50 58 for(x = 0, x0 = 0; x < dst->width; x++) 51 59 { 52 int remx = 0, totx = 0, nx;53 60 int ar = 0, ag = 0, ab = 0; 54 int r = 0, g = 0, b = 0;61 int totx = 0, nx; 55 62 56 63 while(totx < sw) … … 72 79 line[3 * x + 1] = ag; 73 80 line[3 * x + 2] = ab; 74 /* HACK */75 pipi_setpixel(dst, x, y, ar / sw, ag / sw, ab / sw);76 81 } 77 82 78 83 y0++; 79 84 remy = dh; 80 //printf(" remy is now %i\n", remy);81 85 } 82 86 … … 90 94 toty += ny; 91 95 remy -= ny; 92 //printf(" remy-- %i\n", remy);93 96 } 94 //printf("pasting line %i (src line now %i)\n", y, y0);95 97 96 #if 097 98 for(x = 0; x < dst->width; x++) 98 99 pipi_setpixel(dst, x, y, … … 100 101 aline[3 * x + 1] / (sw * sh), 101 102 aline[3 * x + 2] / (sw * sh)); 102 #endif103 103 } 104 104
Note: See TracChangeset
for help on using the changeset viewer.