Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7858 views
1
#ifndef MUPDF_FITZ_DISPLAY_LIST_H
2
#define MUPDF_FITZ_DISPLAY_LIST_H
3
4
#include "mupdf/fitz/system.h"
5
#include "mupdf/fitz/context.h"
6
#include "mupdf/fitz/math.h"
7
#include "mupdf/fitz/device.h"
8
9
/*
10
Display list device -- record and play back device commands.
11
*/
12
13
/*
14
fz_display_list is a list containing drawing commands (text,
15
images, etc.). The intent is two-fold: as a caching-mechanism
16
to reduce parsing of a page, and to be used as a data
17
structure in multi-threading where one thread parses the page
18
and another renders pages.
19
20
Create a displaylist with fz_new_display_list, hand it over to
21
fz_new_list_device to have it populated, and later replay the
22
list (once or many times) by calling fz_run_display_list. When
23
the list is no longer needed drop it with fz_drop_display_list.
24
*/
25
typedef struct fz_display_list_s fz_display_list;
26
27
/*
28
fz_new_display_list: Create an empty display list.
29
30
A display list contains drawing commands (text, images, etc.).
31
Use fz_new_list_device for populating the list.
32
*/
33
fz_display_list *fz_new_display_list(fz_context *ctx);
34
35
/*
36
fz_new_list_device: Create a rendering device for a display list.
37
38
When the device is rendering a page it will populate the
39
display list with drawing commsnds (text, images, etc.). The
40
display list can later be reused to render a page many times
41
without having to re-interpret the page from the document file
42
for each rendering. Once the device is no longer needed, free
43
it with fz_drop_device.
44
45
list: A display list that the list device takes ownership of.
46
*/
47
fz_device *fz_new_list_device(fz_context *ctx, fz_display_list *list);
48
49
/*
50
fz_run_display_list: (Re)-run a display list through a device.
51
52
list: A display list, created by fz_new_display_list and
53
populated with objects from a page by running fz_run_page on a
54
device obtained from fz_new_list_device.
55
56
dev: Device obtained from fz_new_*_device.
57
58
ctm: Transform to apply to display list contents. May include
59
for example scaling and rotation, see fz_scale, fz_rotate and
60
fz_concat. Set to fz_identity if no transformation is desired.
61
62
area: Only the part of the contents of the display list
63
visible within this area will be considered when the list is
64
run through the device. This does not imply for tile objects
65
contained in the display list.
66
67
cookie: Communication mechanism between caller and library
68
running the page. Intended for multi-threaded applications,
69
while single-threaded applications set cookie to NULL. The
70
caller may abort an ongoing page run. Cookie also communicates
71
progress information back to the caller. The fields inside
72
cookie are continually updated while the page is being run.
73
*/
74
void fz_run_display_list(fz_context *ctx, fz_display_list *list, fz_device *dev, const fz_matrix *ctm, const fz_rect *area, fz_cookie *cookie);
75
76
/*
77
fz_keep_display_list: Keep a reference to a display list.
78
79
Does not throw exceptions.
80
*/
81
fz_display_list *fz_keep_display_list(fz_context *ctx, fz_display_list *list);
82
83
/*
84
fz_drop_display_list: Drop a reference to a display list, freeing it
85
if the reference count reaches zero.
86
87
Does not throw exceptions.
88
*/
89
void fz_drop_display_list(fz_context *ctx, fz_display_list *list);
90
91
#endif
92
93