11.5 Miscellaneous operations

There are a few other operations that can be performed efficiently on a display list. Firstly, one can request the bounds of a list.

/* 
   fz_bound_display_list: Return the bounding box of the page recorded in a display list. 
*/ 
fz_rect *fz_bound_display_list(fz_context *ctx, fz_display_list *list, fz_rect *bounds);

Note that this is the bounding box of the page that was written to the display list, not the bounding box of the contents of the list; the latter will typically (but not always) be smaller than the former due to page borders etc.

Secondly, one can create a new fz_image from a display list. This is useful for creating scalable content to embed in other document types; for instance MuPDF makes use of this to turn SVG files embedded within EPUB files (for illustrations and cover pages etc) into convenient objects for adding into the flow of text.

/* 
   Create a new image from a display list. 
 
   w, h: The conceptual width/height of the image. 
 
   transform: The matrix that needs to be applied to the given 
   list to make it render to the unit square. 
 
   list: The display list. 
*/ 
fz_image *fz_new_image_from_display_list(fz_context *ctx, float w, float h, fz_display_list *list);

Finally, it is possible to very quickly check if a given display list is empty or not.

/* 
   Check for a display list being empty 
 
   list: The list to check. 
 
   Returns true if empty, false otherwise. 
*/ 
int fz_display_list_is_empty(fz_context *ctx, const fz_display_list *list);