The Context


The core MuPDF library is designed for simplicity, portability, and ease of integration. For all these reasons, it has no global variables, has no thread library dependencies, and has a well defined exception system to handle runtime errors. Nonetheless, in order to be as useful as possible, clearly the library must have some state and needs to be able to take advantage of multi-threaded environments.

The solution to these seeming conflicts is the Context (fz_context).

Every caller to MuPDF should create a Context at the start of it's use of the library, and destroy it at the end. This Context (or one 'cloned' from it) will then be passed in to every MuPDF API call.

Global State

At it's simplest, the Context contains global settings for the library. For instance, the level of Antialiasing used by the rendering routines is set in the Context.

Error handling


The Store


-- Robin Watts - 2016-04-24


Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2016-04-24 - RobinWatts
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 2014 Artifex Software Inc