1mlib_ImageColorErrorDiffusimoendMixaNL(i3bMLLIiBb)ramrlyibF_uInmcatgieoCnoslorErrorDiffusionMxN(3MLIB)
2
3
4
6 mlib_ImageColorErrorDiffusionMxN - true-color to indexed-color or
7 grayscale to black-white conversion, using error diffusion
8
10 cc [ flag... ] file... -lmlib [ library... ]
11 #include <mlib.h>
12
13 mlib_status mlib_ImageColorErrorDiffusionMxN(mlib_image *dst,
14 const mlib_image *src, const mlib_s32 *kernel,
15 mlib_s32 m, mlib_s32 n, mlib_s32 dm, mlib_s32 dn,
16 mlib_s32 scale, const void *colormap);
17
18
20 The mlib_ImageColorErrorDiffusionMxN() function converts a 3-channel
21 image to a 1-channel indexed image, or converts a 1-channel grayscale
22 image to a 1-channel MLIB_BIT image, with the method of error diffu‐
23 sion.
24
25
26 The src can be an MLIB_BYTE image with 1 or 3 channels. The dst must be
27 a 1-channel MLIB_BIT or MLIB_BYTE image.
28
29
30 The colormap must be created by mlib_ImageColorDitherInit(). It may or
31 may not have a colorcube included. If it does, the colorcube is used.
32 Otherwise, the general lookup table included in colormap is used.
33
34
35 The kernel is required to have the following property:
36
37 kernel[0] = kernel[1] = ... = kernel[m*dn+dm] = 0;
38 kernel[m*dn+dm+1] + ... + kernel[m*n-1] = 2**scale;
39 scale ≥ 0
40
41
43 The function takes the following arguments:
44
45 dst Pointer to destination image.
46
47
48 src Pointer to source image.
49
50
51 kernel Pointer to the error-distribution kernel, in row major
52 order.
53
54
55 m Kernel width. m > 1.
56
57
58 n Kernel height. n > 1.
59
60
61 dm X coordinate of the key element in the kernel. 0 ≤ dm < m.
62
63
64 dn Y coordinate of the key element in the kernel. 0 ≤ dn < n.
65
66
67 scale The scaling factor for kernel to convert the input integer
68 coefficients into floating-point coefficients:
69
70 floating-point coefficient = integer coefficient * \
71 2**(-scale)
72
73
74
75 colormap Internal data structure for image dithering.
76
77
79 The function returns MLIB_SUCCESS if successful. Otherwise it returns
80 MLIB_FAILURE.
81
83 See attributes(5) for descriptions of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Interface Stability │Committed │
92 ├─────────────────────────────┼─────────────────────────────┤
93 │MT-Level │MT-Safe │
94 └─────────────────────────────┴─────────────────────────────┘
95
97 mlib_ImageColorDitherInit(3MLIB), mlib_ImageColorDitherFree(3MLIB),
98 mlib_ImageColorErrorDiffusion3x3(3MLIB), mlib_ImageColorOrdered‐
99 Dither8x8(3MLIB), mlib_ImageColorOrderedDitherMxN(3MLIB), attributes(5)
100
101
102
103SunOS 5.11 2 Marm2l0i0b7_ImageColorErrorDiffusionMxN(3MLIB)