Page Level Functions

The fz_page structure contains a list of functions used to implement the page level calls:


\begin{lstlisting}
typedef struct fz_page_s
{
int refs;
fz_page_drop_page_fn *...
...rations;
fz_page_get_separation_fn *get_separation;
} fz_page;
\end{lstlisting}

The fz_page (and hence derived foo_page) structures are reference counted. The refs field is used to keep the reference count in. All the reference counting is handled by the core library, and all that is required of the implementation is that it should supply a drop_page function that will be called when the reference count reaches zero. This is of type:


\begin{lstlisting}
/*
fz_page_drop_page_fn: Type for a function to release all ...
...ef void (fz_page_drop_page_fn)(fz_context *ctx, fz_page *page);
\end{lstlisting}

Implementations must fill in the bound_page field with the address of a function to return the pages bounding box, of type:


\begin{lstlisting}
/*
fz_page_bound_page_fn: Type for a function to return the
...
...page_bound_page_fn)(fz_context *ctx, fz_page *page, fz_rect *);
\end{lstlisting}

Implementations must fill in the run_page_contents field with the address of a function to interpret the contents of a page, of type:


\begin{lstlisting}
/*
fz_page_run_page_contents_fn: Type for a function to run ...
...fz_device *dev, const fz_matrix *transform, fz_cookie *cookie);
\end{lstlisting}

If a document format supports internal or external hyperlinks, then its implementation must fill in the load_links field with the address of a function to load the links from a page, of type:


\begin{lstlisting}
/*
fz_page_load_links_fn: Type for a function to load the li...
..._link *(fz_page_load_links_fn)(fz_context *ctx, fz_page *page);
\end{lstlisting}

If a document format supports annotations, then its implementation must fill in the first_annot field with the address of a function to load the annotations from a page, of type:


\begin{lstlisting}
/*
fz_page_first_annot_fn: Type for a function to load the
...
...nnot *(fz_page_first_annot_fn)(fz_context *ctx, fz_page *page);
\end{lstlisting}

Some document formats can encode information that specifies how pages should be presented to the user as a slideshow - how long they should be displayed, and which transition to use when moving to the next page etc. In implementations of document handlers for such formats, they should fill in the page_presentation field with the address of a function to obtain this information, of type:


\begin{lstlisting}
/*
fz_page_page_presentation_fn: Type for a function to
obt...
...tx, fz_page *page, fz_transition *transition, float *duration);
\end{lstlisting}

Some document formats can encapsulate multiple color separations. In order to allow proofing of such formats, MuPDF allows such separations to be enumerated and enabled/disabled. In document handlers for such document formats, the control_separation, separation_disabled, count_separations and get_separation fields should be filled in with functions of the following types respectively:


\begin{lstlisting}
/*
fz_page_control_separation: Type for a function to enable...
... fz_page *page, int separation, uint32_t *rgb, uint32_t *cmyk);
\end{lstlisting}