10.5 Halftones

The fz_halftone structure represents a set of tiles, one per component, each of a potentially different size. Each of these tiles is a 2-dimensional array of threshold values (actually implemented as a single component fz_pixmap). During the halftoning (bitmap creation) process, if the contone value is smaller than the threshold value, then it remains unset in the output. If it is larger or equal then it is set in the output.

For convenience, a NULL pointer can be used to signify the default halftone. The default halftone can also be fetched by using:

/* 
   fz_default_halftone: Create a default halftone structure 
   for the given number of components. 
 
   num_comps: The number of components to use. 
 
   Returns a simple default halftone. The default halftone uses 
   the same halftone tile for each plane, which may not be ideal 
   for all purposes. 
*/ 
fz_halftone *fz_default_halftone(fz_context *ctx, int num_comps);

The creation of halftones is a specialised field upon which much research has been done. The mechanisms in MuPDF are designed to allow people the freedom to create and tune the halftones for their particular application.

The usual reference counting behaviour applies to fz_halftones, with fz_keep_halftone and fz_drop_halftone claiming and releasing references respectively.