Bitmaps

The fz_bitmap structure is used to represent a 2 dimensional array of monochrome pixels. They are the 1 bit per component equivalent of the fz_pixmap structure.

The core rendering engine of MuPDF does not currently make use of fz_bitmaps, but rather they are used as a step along the way for outputting rendered information.

Functions exist within MuPDF to create fz_bitmaps from fz_pixmaps by halftoning. See Halftones Halftones.


\begin{lstlisting}
/*
fz_new_bitmap_from_pixmap: Make a bitmap from a pixmap an...
..._pixmap *pix, fz_halftone *ht, int band_start, int bandheight);
\end{lstlisting}

Both functions work by applying a fz_halftone to the contone values to make the bitmap. The latter function is a more general version of the former, that allows for correct operation when rendering in bands - namely that the correct offset into the halftone table is used.

The data for each Bitmap is packed into bytes most significant bit first. Multiple components are packed into the same byte, so a CMYK pixmap converted to a bitmap would have 2 pixels worth of data in the first byte, CMYKCMYK, with the first pixel in the highest nibble.

The usual reference counting behaviour applies to fz_bitmaps, with fz_keep_bitmap and fz_drop_bitmap claiming and releasing references respectively.