Chapter 22
Device Internals

In chapter 9 The Device interface, we introduced the central concept of a fz_device, and described the normal ones found in a standard MuPDF build. We skipped over the actual implementation details of how to call, or implement such devices. We rectify that here.

As mentioned before, although each device offers a set of function pointers, we prefer people not to call these directly, but rather to call some convenience functions that map down onto these. This protects us against API changes in future, and copes automatically with NULL pointers (in the case when a device doesn’t care about a particular type of call).

We describe these convenience functions here; implementers of devices can trivially extrapolate the behaviour of the function pointers from these descriptions. For example, the fz_fill_path function described here is implemented by the fill_path function pointer in the fz_device that takes the identical arguments and has the same return conditions.

 22.1 Line Art
 22.2 Text
 22.3 Images
 22.4 Shadings
 22.5 Clipping and Masking
 22.6 Groups and Transparency
 22.7 Tiling
 22.8 Render Flags
 22.9 Device Color Spaces
 22.10 Layers