xil_error_diffusion(3)
NAME
xil_error_diffusion − use error-diffusion dithering to convert an image into a single-band image with a colormap
SYNOPSIS
#include <xil/xil.h>
void xil_error_diffusion ( XilImage src,
XilImage dst,
XilLookup cmap,
XilKernel distribution);
DESCRIPTION
This routine performs error-diffusion dithering of a src (source) image with a distribution matrix. It produces a single-band dst (destination) image. cmap is a lookup table with the number of output bands equal to the number of bands in the source image. distribution is a kernel with values between 0.0 and 1.0. This distribution matrix specifies the amount of error to distribute to the neighbors of the current pixel.
This function assumes that the entire error is distributed to the right and below the current pixel. That is, the values in the distribution kernel sum to 1.0. The only entries that can be non-zero are those to the right of and on the same row as the key entry, and those entries below the row of the key entry.
ERRORS
For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide.
EXAMPLES
Error-diffusion dither a 3-band image into a single-band image:
XilImage src;/∗ 3-band source image ∗/
XilImage dst;/∗ 1-band destination image ∗/
XilLookup colormap;/∗ colormap ∗/
XilKernel distribution;/∗ error distribution matrix ∗/
float data[]={0.0, 0.0, 0.0,
0.0, 0.0, 7.0/16.0,
3.0/16.0, 5.0/16.0, 1.0/16.0};
distribution = xil_kernel_create(State, 3, 3, 1, 1, data);
xil_error_diffusion(src, dst, colormap, distribution);
NOTES
For a discussion of error diffusion in the XIL library, consult the XIL Programmer’s Guide.
SEE ALSO
xil_kernel_create(3), xil_kernel_get_by_name(3), xil_lookup_create(3), xil_lookup_get_by_name(3), xil_kernel_get_height(3).
SunOS — Last change: 15 June 1993