4 Currently there are two dithering algorithms implemented. Both takes an RGB888
5 24bit image as input and are able to produce any RGB or Grayscale image.
6 This filters doesn't work 'in-place' as the result has different pixel type.
11 Classical Floyd-Steinberg. Produces good results and is a little faster than
12 the Hilbert-Peano dithering.
14 The error is distributed to neighbor pixels as follows:
22 And is throwed away at the image borders.
25 -------------------------------------------------------------------------------
28 #include <filters/GP_Dither.h>
30 int GP_FilterFloydSteinberg(const GP_Pixmap *src, GP_Pixmap *dst,
31 GP_ProgressCallback *callback);
32 -------------------------------------------------------------------------------
34 Renders Floyd Steinberg dithering directly into passed pixmap. The
35 destination must be at least as large as source.
37 If operation was aborted by a callback, non-zero is returned.
39 Not all pixel types all supported. If particular combination is not supported
40 the function returns non-zero and sets errno to 'ENOSYS'.
43 -------------------------------------------------------------------------------
46 #include <filters/GP_Dither.h>
48 GP_Pixmap *GP_FilterFloydSteinbergAlloc(const GP_Pixmap *src,
49 GP_PixelType pixel_type,
50 GP_ProgressCallback *callback);
51 -------------------------------------------------------------------------------
53 Returns pointer to allocated pixmap of given pixel_type.
55 If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
58 Not all pixel types all supported. If particular combination is not supported
59 the function returns NULL and sets errno to 'ENOSYS'.
64 Hilbert-Peano space filling curve based dithering.
66 The error value is distributed around the Hilbert curve.
68 The result is a little more noisy, but doesn't create repeating patterns like
69 Floyd-Steinberg which looks generally better to human eye. On the other hand
70 edges tend to be less sharp.
73 -------------------------------------------------------------------------------
76 #include <filters/GP_Dither.h>
78 int GP_FilterHilbertPeano(const GP_Pixmap *src, GP_Pixmap *dst,
79 GP_ProgressCallback *callback);
80 -------------------------------------------------------------------------------
82 Renders Hilbert Peano dithering directly into passed pixmap. The
83 destination must be at least as large as source.
85 If operation was aborted by a callback, non-zero is returned.
87 Not all pixel types all supported. If particular combination is not supported
88 the function returns NULL and sets errno to 'ENOSYS'.
91 -------------------------------------------------------------------------------
94 #include <filters/GP_Dither.h>
96 GP_Pixmap *GP_FilterHilbertPeanoAlloc(const GP_Pixmap *src,
97 GP_PixelType pixel_type,
98 GP_ProgressCallback *callback);
99 -------------------------------------------------------------------------------
101 Returns pointer to allocated pixmap of given pixel_type.
103 If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
106 Not all pixel types all supported. If particular combination is not supported
107 the function returns NULL and sets errno to 'ENOSYS'.
109 include::images/convert/images.txt[]
110 include::images/floyd_steinberg/images.txt[]
111 include::images/hilbert_peano/images.txt[]