Changeset 2812
- Timestamp:
- 09/01/08 01:05:55 (5 years ago)
- Location:
- libpipi/trunk/pipi
- Files:
-
- 1 deleted
- 4 edited
-
Makefile.am (modified) (1 diff)
-
context.c (modified) (1 diff)
-
dither/halftone.c (deleted)
-
dither/ordered.c (modified) (2 diffs)
-
pipi.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
libpipi/trunk/pipi/Makefile.am
r2810 r2812 77 77 dither/ediff.c \ 78 78 dither/ordered.c \ 79 dither/halftone.c \80 79 dither/ostromoukhov.c \ 81 80 dither/dbs.c \ -
libpipi/trunk/pipi/context.c
r2811 r2812 107 107 else if(!strncmp(method, "ordered", 7)) 108 108 { 109 double angle = .0; 109 double scale = 1., angle = .0; 110 if(ctx->nimages < 2) 111 return -1; 110 112 method = strchr(method, ':'); 111 113 if(method) 112 angle = atof(method + 1); 113 if(ctx->nimages < 2) 114 return -1; 114 { 115 scale = atof(method + 1); 116 method = strchr(method + 1, ':'); 117 if(method) 118 angle = atof(method + 1); 119 } 120 if(scale <= 0.) 121 scale = 1.; 115 122 dst = pipi_dither_ordered_ext(ctx->images[ctx->nimages - 2], src, 116 angle);123 scale, angle); 117 124 pipi_free(ctx->images[ctx->nimages - 2]); 118 125 ctx->nimages--; -
libpipi/trunk/pipi/dither/ordered.c
r2811 r2812 26 26 #include "pipi_internals.h" 27 27 28 pipi_image_t *pipi_dither_halftone(pipi_image_t *img, double r, double angle) 29 { 30 #define PRECISION 4. 31 pipi_image_t *ret, *kernel; 32 int k = (r * PRECISION / sqrt(2.) + .5); 33 34 kernel = pipi_render_halftone(k, k); 35 ret = pipi_dither_ordered_ext(img, kernel, 1. / PRECISION, angle + 45.); 36 pipi_free(kernel); 37 38 return ret; 39 } 40 28 41 pipi_image_t *pipi_dither_ordered(pipi_image_t *img, pipi_image_t *kernel) 29 42 { 30 return pipi_dither_ordered_ext(img, kernel, 0.0);43 return pipi_dither_ordered_ext(img, kernel, 1.0, 0.0); 31 44 } 32 45 33 46 pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *img, pipi_image_t *kernel, 34 double angle)47 double scale, double angle) 35 48 { 36 49 double sint, cost; … … 61 74 float p, q; 62 75 63 kx = (int)( cost * x - sint * y + 2 * w * h) % kw;64 ky = (int)( cost * y + sint * x + 2 * w * h) % kh;76 kx = (int)((cost * x - sint * y + 2 * w * h) / scale) % kw; 77 ky = (int)((cost * y + sint * x + 2 * w * h) / scale) % kh; 65 78 66 79 p = dstdata[y * w + x]; -
libpipi/trunk/pipi/pipi.h
r2811 r2812 184 184 extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *); 185 185 extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *, 186 double );186 double, double); 187 187 extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double); 188 188 extern pipi_image_t *pipi_dither_random(pipi_image_t *);
Note: See TracChangeset
for help on using the changeset viewer.
