This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via dca06a2b3d716c7a325793980f780c6d7052ab1b (commit) via e29f0a510fc5fab3fa982c5a13506a5b72ffd40d (commit) from 2c010bf3f32376abf437e23b4edf4735adb1f957 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/dca06a2b3d716c7a325793980f780c6d7052a...
commit dca06a2b3d716c7a325793980f780c6d7052ab1b Author: Cyril Hrubis metan@ucw.cz Date: Mon Nov 14 14:11:32 2011 +0100
filters: Fix some overly long lines.
diff --git a/include/filters/GP_Dither.h b/include/filters/GP_Dither.h index 3ecf7bf..b0b5157 100644 --- a/include/filters/GP_Dither.h +++ b/include/filters/GP_Dither.h @@ -34,14 +34,16 @@ /* * Floyd Steinberg */ -GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, GP_Context *dst, +GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, + GP_Context *dst, GP_ProgressCallback *callback);
/* * Floyd Steinberg */ -GP_Context *GP_FilterFloydSteinberg_from_RGB888(const GP_Context *src, GP_Context *dst, - GP_PixelType pixel_type, +GP_Context *GP_FilterFloydSteinberg_from_RGB888(const GP_Context *src, + GP_Context *dst, + GP_PixelType dst_pixel_type, GP_ProgressCallback *callback);
/* diff --git a/libs/filters/GP_Dither.c b/libs/filters/GP_Dither.c index 84932ec..e0c6be1 100644 --- a/libs/filters/GP_Dither.c +++ b/libs/filters/GP_Dither.c @@ -48,7 +48,8 @@ int GP_FilterFloydSteinberg_to_G1_Raw(const GP_Context *src, GP_Context *dst, for (y = 0; y < (GP_Coord)src->h; y++) { for (x = 0; x < (GP_Coord)src->w; x++) { GP_Pixel pix = GP_GetPixel(src, x, y); - float val = GP_ConvertPixel(pix, src->pixel_type, GP_PIXEL_G8); + float val = GP_ConvertPixel(pix, src->pixel_type, + GP_PIXEL_G8);
val += errors[y%2][x]; @@ -84,7 +85,8 @@ int GP_FilterFloydSteinberg_to_G1_Raw(const GP_Context *src, GP_Context *dst, return 0; }
-GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, GP_Context *dst, +GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, + GP_Context *dst, GP_ProgressCallback *callback) { GP_Context *ret = dst; @@ -107,7 +109,8 @@ GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, GP_Context *dst return ret; }
-GP_Context *GP_FilterFloydSteinberg_from_RGB888(const GP_Context *src, GP_Context *dst, +GP_Context *GP_FilterFloydSteinberg_from_RGB888(const GP_Context *src, + GP_Context *dst, GP_PixelType pixel_type, GP_ProgressCallback *callback) {
http://repo.or.cz/w/gfxprim.git/commit/e29f0a510fc5fab3fa982c5a13506a5b72ffd...
commit e29f0a510fc5fab3fa982c5a13506a5b72ffd40d Author: Cyril Hrubis metan@ucw.cz Date: Mon Nov 14 14:05:19 2011 +0100
doc: Added docs for Floyd Steinberg dithering.
diff --git a/doc/filters.txt b/doc/filters.txt index 066d04c..6750a70 100644 --- a/doc/filters.txt +++ b/doc/filters.txt @@ -265,3 +265,71 @@ downscaling. To do this reasonably fast we could cheat a little: first resize big images a little without the low-pass filter, then apply low-pass filter and finally downscale it to desired size.
+Dithering +~~~~~~~~~ + +[source,c] +------------------------------------------------------------------------------- +#include <GP_Filters.h> + +GP_Context *GP_FilterFloydSteinberg_from_RGB888(const GP_Context *src, + GP_Context *dst, + GP_PixelType dst_pixel_type, + GP_ProgressCallback *callback); +------------------------------------------------------------------------------- + +Floyd-Steinberg dithering the source context must be RGB888 and the +dst_pixel_type may either be RGB or Grayscale. + +Doesn't work 'in-place' as the result has different pixel type. + +The error is distributed to neighbour pixels as follows: + +[width="10%"] +|=================== +| | X | 7/16 +| 3/16 | 5/16 | 1/16 +|=================== + +And is throwed away at the image borders. + +[source,c] +------------------------------------------------------------------------------- +#include <GP_Filters.h> + +GP_Context *GP_FilterFloydSteinberg_to_G1(const GP_Context *src, + GP_Context *dst, + GP_ProgressCallback *callback); +------------------------------------------------------------------------------- + +Same as above but the source is any pixel type and the result is stored into +1-bit Grayscale. + +Example Images +^^^^^^^^^^^^^^ +All following images were generated using 'grinder'. +(Click for bigger size) + +.Original Image; 1-bit, 2-bit, 4-bit Grayscale; 1-bit, 2-bit, 3-bit RGB +image:images/dither/lenna_small.png[ + "Original Image", + link="images/dither/lenna.png"] +image:images/dither/lenna_G1_small.png[ + "1-bit Grayscale", + link="images/dither/lenna_G1.png"] +image:images/dither/lenna_G2_small.png[ + "2-bit Grayscale", + link="images/dither/lenna_G2.png"] +image:images/dither/lenna_G4_small.png[ + "4-bit Grayscale", + link="images/dither/lenna_G4.png"] +image:images/dither/lenna_RGB111_small.png[ + "1-bit RGB", + link="images/dither/lenna_RGB111.png"] +image:images/dither/lenna_RGB222_small.png[ + "2-bit RGB", + link="images/dither/lenna_RGB222.png"] +image:images/dither/lenna_RGB333_small.png[ + "3-bit RGB", + link="images/dither/lenna_RGB333.png"] + diff --git a/doc/images/dither/lenna.png b/doc/images/dither/lenna.png new file mode 100644 index 0000000..475bc7a Binary files /dev/null and b/doc/images/dither/lenna.png differ diff --git a/doc/images/dither/lenna_G1.png b/doc/images/dither/lenna_G1.png new file mode 100644 index 0000000..9f0e2c4 Binary files /dev/null and b/doc/images/dither/lenna_G1.png differ diff --git a/doc/images/dither/lenna_G1_small.png b/doc/images/dither/lenna_G1_small.png new file mode 100644 index 0000000..0083f5d Binary files /dev/null and b/doc/images/dither/lenna_G1_small.png differ diff --git a/doc/images/dither/lenna_G2.png b/doc/images/dither/lenna_G2.png new file mode 100644 index 0000000..8854b47 Binary files /dev/null and b/doc/images/dither/lenna_G2.png differ diff --git a/doc/images/dither/lenna_G2_small.png b/doc/images/dither/lenna_G2_small.png new file mode 100644 index 0000000..3c43f97 Binary files /dev/null and b/doc/images/dither/lenna_G2_small.png differ diff --git a/doc/images/dither/lenna_G4.png b/doc/images/dither/lenna_G4.png new file mode 100644 index 0000000..207f703 Binary files /dev/null and b/doc/images/dither/lenna_G4.png differ diff --git a/doc/images/dither/lenna_G4_small.png b/doc/images/dither/lenna_G4_small.png new file mode 100644 index 0000000..f5017c5 Binary files /dev/null and b/doc/images/dither/lenna_G4_small.png differ diff --git a/doc/images/dither/lenna_RGB111.png b/doc/images/dither/lenna_RGB111.png new file mode 100644 index 0000000..732ba24 Binary files /dev/null and b/doc/images/dither/lenna_RGB111.png differ diff --git a/doc/images/dither/lenna_RGB111_small.png b/doc/images/dither/lenna_RGB111_small.png new file mode 100644 index 0000000..759ab88 Binary files /dev/null and b/doc/images/dither/lenna_RGB111_small.png differ diff --git a/doc/images/dither/lenna_RGB222.png b/doc/images/dither/lenna_RGB222.png new file mode 100644 index 0000000..9d91a5e Binary files /dev/null and b/doc/images/dither/lenna_RGB222.png differ diff --git a/doc/images/dither/lenna_RGB222_small.png b/doc/images/dither/lenna_RGB222_small.png new file mode 100644 index 0000000..92a03d2 Binary files /dev/null and b/doc/images/dither/lenna_RGB222_small.png differ diff --git a/doc/images/dither/lenna_RGB333.png b/doc/images/dither/lenna_RGB333.png new file mode 100644 index 0000000..7b2d4c9 Binary files /dev/null and b/doc/images/dither/lenna_RGB333.png differ diff --git a/doc/images/dither/lenna_RGB333_small.png b/doc/images/dither/lenna_RGB333_small.png new file mode 100644 index 0000000..45f62c9 Binary files /dev/null and b/doc/images/dither/lenna_RGB333_small.png differ diff --git a/doc/images/dither/lenna_small.png b/doc/images/dither/lenna_small.png new file mode 100644 index 0000000..ad258a1 Binary files /dev/null and b/doc/images/dither/lenna_small.png differ
-----------------------------------------------------------------------
Summary of changes: doc/filters.txt | 68 ++++++++++++++++++++++++++++++ doc/images/dither/lenna.png | Bin 0 -> 394244 bytes doc/images/dither/lenna_G1.png | Bin 0 -> 44134 bytes doc/images/dither/lenna_G1_small.png | Bin 0 -> 11690 bytes doc/images/dither/lenna_G2.png | Bin 0 -> 69665 bytes doc/images/dither/lenna_G2_small.png | Bin 0 -> 18380 bytes doc/images/dither/lenna_G4.png | Bin 0 -> 92560 bytes doc/images/dither/lenna_G4_small.png | Bin 0 -> 26452 bytes doc/images/dither/lenna_RGB111.png | Bin 0 -> 109889 bytes doc/images/dither/lenna_RGB111_small.png | Bin 0 -> 27757 bytes doc/images/dither/lenna_RGB222.png | Bin 0 -> 162688 bytes doc/images/dither/lenna_RGB222_small.png | Bin 0 -> 41646 bytes doc/images/dither/lenna_RGB333.png | Bin 0 -> 196644 bytes doc/images/dither/lenna_RGB333_small.png | Bin 0 -> 52995 bytes doc/images/dither/lenna_small.png | Bin 0 -> 116129 bytes include/filters/GP_Dither.h | 8 ++- libs/filters/GP_Dither.c | 9 +++- 17 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 doc/images/dither/lenna.png create mode 100644 doc/images/dither/lenna_G1.png create mode 100644 doc/images/dither/lenna_G1_small.png create mode 100644 doc/images/dither/lenna_G2.png create mode 100644 doc/images/dither/lenna_G2_small.png create mode 100644 doc/images/dither/lenna_G4.png create mode 100644 doc/images/dither/lenna_G4_small.png create mode 100644 doc/images/dither/lenna_RGB111.png create mode 100644 doc/images/dither/lenna_RGB111_small.png create mode 100644 doc/images/dither/lenna_RGB222.png create mode 100644 doc/images/dither/lenna_RGB222_small.png create mode 100644 doc/images/dither/lenna_RGB333.png create mode 100644 doc/images/dither/lenna_RGB333_small.png create mode 100644 doc/images/dither/lenna_small.png
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.