1 #ifndef MUPDF_PDF_ANNOT_H
2 #define MUPDF_PDF_ANNOT_H
3 
4 enum pdf_annot_type
5 {
6 	PDF_ANNOT_TEXT,
7 	PDF_ANNOT_LINK,
8 	PDF_ANNOT_FREE_TEXT,
9 	PDF_ANNOT_LINE,
10 	PDF_ANNOT_SQUARE,
11 	PDF_ANNOT_CIRCLE,
12 	PDF_ANNOT_POLYGON,
13 	PDF_ANNOT_POLY_LINE,
14 	PDF_ANNOT_HIGHLIGHT,
15 	PDF_ANNOT_UNDERLINE,
16 	PDF_ANNOT_SQUIGGLY,
17 	PDF_ANNOT_STRIKE_OUT,
18 	PDF_ANNOT_REDACT,
19 	PDF_ANNOT_STAMP,
20 	PDF_ANNOT_CARET,
21 	PDF_ANNOT_INK,
22 	PDF_ANNOT_POPUP,
23 	PDF_ANNOT_FILE_ATTACHMENT,
24 	PDF_ANNOT_SOUND,
25 	PDF_ANNOT_MOVIE,
26 	PDF_ANNOT_RICH_MEDIA,
27 	PDF_ANNOT_WIDGET,
28 	PDF_ANNOT_SCREEN,
29 	PDF_ANNOT_PRINTER_MARK,
30 	PDF_ANNOT_TRAP_NET,
31 	PDF_ANNOT_WATERMARK,
32 	PDF_ANNOT_3D,
33 	PDF_ANNOT_PROJECTION,
34 	PDF_ANNOT_UNKNOWN = -1
35 };
36 
37 /*
38 	Map an annotation type to a (static) string.
39 
40 	The returned string must not be freed by the caller.
41 */
42 const char *pdf_string_from_annot_type(fz_context *ctx, enum pdf_annot_type type);
43 
44 /*
45 	Map from a (non-NULL, case sensitive) string to an annotation
46 	type.
47 */
48 enum pdf_annot_type pdf_annot_type_from_string(fz_context *ctx, const char *subtype);
49 
50 enum
51 {
52 	PDF_ANNOT_IS_INVISIBLE = 1 << (1-1),
53 	PDF_ANNOT_IS_HIDDEN = 1 << (2-1),
54 	PDF_ANNOT_IS_PRINT = 1 << (3-1),
55 	PDF_ANNOT_IS_NO_ZOOM = 1 << (4-1),
56 	PDF_ANNOT_IS_NO_ROTATE = 1 << (5-1),
57 	PDF_ANNOT_IS_NO_VIEW = 1 << (6-1),
58 	PDF_ANNOT_IS_READ_ONLY = 1 << (7-1),
59 	PDF_ANNOT_IS_LOCKED = 1 << (8-1),
60 	PDF_ANNOT_IS_TOGGLE_NO_VIEW = 1 << (9-1),
61 	PDF_ANNOT_IS_LOCKED_CONTENTS = 1 << (10-1)
62 };
63 
64 enum pdf_line_ending
65 {
66 	PDF_ANNOT_LE_NONE = 0,
67 	PDF_ANNOT_LE_SQUARE,
68 	PDF_ANNOT_LE_CIRCLE,
69 	PDF_ANNOT_LE_DIAMOND,
70 	PDF_ANNOT_LE_OPEN_ARROW,
71 	PDF_ANNOT_LE_CLOSED_ARROW,
72 	PDF_ANNOT_LE_BUTT,
73 	PDF_ANNOT_LE_R_OPEN_ARROW,
74 	PDF_ANNOT_LE_R_CLOSED_ARROW,
75 	PDF_ANNOT_LE_SLASH
76 };
77 
78 enum
79 {
80 	PDF_ANNOT_Q_LEFT = 0,
81 	PDF_ANNOT_Q_CENTER = 1,
82 	PDF_ANNOT_Q_RIGHT = 2
83 };
84 
85 /*
86 	Map from a PDF name specifying an annotation line ending
87 	to an enumerated line ending value.
88 */
89 enum pdf_line_ending pdf_line_ending_from_name(fz_context *ctx, pdf_obj *end);
90 
91 /*
92 	Map from a (non-NULL, case sensitive) C string specifying
93 	an annotation line ending to an enumerated line ending value.
94 */
95 enum pdf_line_ending pdf_line_ending_from_string(fz_context *ctx, const char *end);
96 
97 /*
98 	Map from an enumerated line ending to a pdf name object that
99 	specifies it.
100 */
101 pdf_obj *pdf_name_from_line_ending(fz_context *ctx, enum pdf_line_ending end);
102 
103 /*
104 	Map from an enumerated line ending to a C string that specifies
105 	it.
106 
107 	The caller must not free the returned string.
108 */
109 const char *pdf_string_from_line_ending(fz_context *ctx, enum pdf_line_ending end);
110 
111 /*
112 	Increment the reference count for an annotation.
113 
114 	Never throws exceptions. Returns the same pointer.
115 */
116 pdf_annot *pdf_keep_annot(fz_context *ctx, pdf_annot *annot);
117 
118 /*
119 	Drop the reference count for an annotation.
120 
121 	When the reference count reaches zero, the annotation will
122 	be destroyed. Never throws exceptions.
123 */
124 void pdf_drop_annot(fz_context *ctx, pdf_annot *annot);
125 
126 /*
127 	Returns a borrowed reference to the first annotation on
128 	a page, or NULL if none.
129 
130 	The caller should fz_keep this if it intends to hold the
131 	pointer. Unless it fz_keeps it, it must not fz_drop it.
132 */
133 pdf_annot *pdf_first_annot(fz_context *ctx, pdf_page *page);
134 
135 /*
136 	Returns a borrowed reference to the next annotation
137 	on a page, or NULL if none.
138 
139 	The caller should fz_keep this if it intends to hold the
140 	pointer. Unless it fz_keeps it, it must not fz_drop it.
141 */
142 pdf_annot *pdf_next_annot(fz_context *ctx, pdf_annot *annot);
143 
144 /*
145 	Return the rectangle for an annotation on a page.
146 */
147 fz_rect pdf_bound_annot(fz_context *ctx, pdf_annot *annot);
148 
149 enum pdf_annot_type pdf_annot_type(fz_context *ctx, pdf_annot *annot);
150 
151 /*
152 	Interpret an annotation and render it on a device.
153 
154 	page: A page loaded by pdf_load_page.
155 
156 	annot: an annotation.
157 
158 	dev: Device used for rendering, obtained from fz_new_*_device.
159 
160 	ctm: A transformation matrix applied to the objects on the page,
161 	e.g. to scale or rotate the page contents as desired.
162 */
163 void pdf_run_annot(fz_context *ctx, pdf_annot *annot, fz_device *dev, fz_matrix ctm, fz_cookie *cookie);
164 
165 /*
166 	Lookup needle in the nametree of the document given by which.
167 
168 	The returned reference is borrowed, and should not be dropped,
169 	unless it is kept first.
170 */
171 pdf_obj *pdf_lookup_name(fz_context *ctx, pdf_document *doc, pdf_obj *which, pdf_obj *needle);
172 
173 /*
174 	Load a nametree, flattening it into a single dictionary.
175 
176 	The caller is responsible for pdf_dropping the returned
177 	reference.
178 */
179 pdf_obj *pdf_load_name_tree(fz_context *ctx, pdf_document *doc, pdf_obj *which);
180 
181 /*
182 	Lookup needle in the given number tree.
183 
184 	The returned reference is borrowed, and should not be dropped,
185 	unless it is kept first.
186 */
187 pdf_obj *pdf_lookup_number(fz_context *ctx, pdf_obj *root, int needle);
188 
189 /*
190 	Perform a depth first traversal of a tree.
191 
192 	Start at tree, looking for children in the array named
193 	kid_name at each level.
194 
195 	The arrive callback is called when we arrive at a node (i.e.
196 	before all the children are walked), and then the leave callback
197 	is called as we leave it (after all the children have been
198 	walked).
199 
200 	names and values are (matching) null terminated arrays of
201 	names and values to be carried down the tree, to implement
202 	inheritance. NULL is a permissible value.
203 */
204 void pdf_walk_tree(fz_context *ctx, pdf_obj *tree, pdf_obj *kid_name,
205 			void (*arrive)(fz_context *, pdf_obj *, void *, pdf_obj **),
206 			void (*leave)(fz_context *, pdf_obj *, void *),
207 			void *arg,
208 			pdf_obj **names,
209 			pdf_obj **values);
210 
211 /*
212 	Resolve a link within a document.
213 */
214 int pdf_resolve_link(fz_context *ctx, pdf_document *doc, const char *uri, float *xp, float *yp);
215 
216 /*
217 	Create transform to fit appearance stream to annotation Rect
218 */
219 fz_matrix pdf_annot_transform(fz_context *ctx, pdf_annot *annot);
220 
221 /*
222 	create a new annotation of the specified type on the
223 	specified page. The returned pdf_annot structure is owned by the
224 	page and does not need to be freed.
225 */
226 pdf_annot *pdf_create_annot_raw(fz_context *ctx, pdf_page *page, enum pdf_annot_type type);
227 
228 /*
229 	create a new annotation of the specified type on the
230 	specified page. Populate it with sensible defaults per the type.
231 
232 	The page takes a reference, and an additional reference is
233 	returned to the caller, hence the caller should drop the
234 	reference once it is done.
235 */
236 pdf_annot *pdf_create_annot(fz_context *ctx, pdf_page *page, enum pdf_annot_type type);
237 
238 /*
239 	Delete an annoation from the page.
240 
241 	This unlinks the annotation from the page structure and drops
242 	the pages reference to it. Any reference held by the caller
243 	will not be dropped automatically, so this can safely be used
244 	on a borrowed reference.
245 */
246 void pdf_delete_annot(fz_context *ctx, pdf_page *page, pdf_annot *annot);
247 
248 /*
249 	Edit the associated Popup annotation rectangle.
250 
251 	Popup annotations are used to store the size and position of the
252 	popup box that is used to edit the contents of the markup annotation.
253 */
254 void pdf_set_annot_popup(fz_context *ctx, pdf_annot *annot, fz_rect rect);
255 fz_rect pdf_annot_popup(fz_context *ctx, pdf_annot *annot);
256 
257 /*
258 	Check to see if an annotation has an ink list.
259 */
260 int pdf_annot_has_ink_list(fz_context *ctx, pdf_annot *annot);
261 
262 /*
263 	Check to see if an annotation has quad points data.
264 */
265 int pdf_annot_has_quad_points(fz_context *ctx, pdf_annot *annot);
266 
267 /*
268 	Check to see if an annotation has vertex data.
269 */
270 int pdf_annot_has_vertices(fz_context *ctx, pdf_annot *annot);
271 
272 /*
273 	Check to see if an annotation has line data.
274 */
275 int pdf_annot_has_line(fz_context *ctx, pdf_annot *annot);
276 
277 /*
278 	Check to see if an annotation has an interior color.
279 */
280 int pdf_annot_has_interior_color(fz_context *ctx, pdf_annot *annot);
281 
282 /*
283 	Check to see if an annotation has line ending styles.
284 */
285 int pdf_annot_has_line_ending_styles(fz_context *ctx, pdf_annot *annot);
286 
287 /*
288 	Check to see if an annotation has an icon name.
289 */
290 int pdf_annot_has_icon_name(fz_context *ctx, pdf_annot *annot);
291 
292 /*
293 	Check to see if an annotation has an open action.
294 */
295 int pdf_annot_has_open(fz_context *ctx, pdf_annot *annot);
296 
297 /*
298 	Check to see if an annotation has author data.
299 */
300 int pdf_annot_has_author(fz_context *ctx, pdf_annot *annot);
301 
302 /*
303 	Retrieve the annotation flags.
304 */
305 int pdf_annot_flags(fz_context *ctx, pdf_annot *annot);
306 
307 /*
308 	Retrieve the annotation bounds in doc space.
309 */
310 fz_rect pdf_annot_rect(fz_context *ctx, pdf_annot *annot);
311 
312 /*
313 	Retrieve the annotation border line width in points.
314 */
315 float pdf_annot_border(fz_context *ctx, pdf_annot *annot);
316 
317 /*
318 	Retrieve the annotation opacity. (0 transparent, 1 solid).
319 */
320 float pdf_annot_opacity(fz_context *ctx, pdf_annot *annot);
321 
322 /*
323 	Retrieve the annotation color.
324 
325 	n components, each between 0 and 1.
326 	n = 1 (grey), 3 (rgb) or 4 (cmyk).
327 */
328 void pdf_annot_color(fz_context *ctx, pdf_annot *annot, int *n, float color[4]);
329 
330 /*
331 	Retrieve the annotation interior color.
332 
333 	n components, each between 0 and 1.
334 	n = 1 (grey), 3 (rgb) or 4 (cmyk).
335 */
336 void pdf_annot_interior_color(fz_context *ctx, pdf_annot *annot, int *n, float color[4]);
337 
338 /*
339 	Retrieve the annotation quadding (justification) to use.
340 		0 = Left-justified
341 		1 = Centered
342 		2 = Right-justified
343 */
344 int pdf_annot_quadding(fz_context *ctx, pdf_annot *annot);
345 
346 /*
347 	Retrieve the annotations text language (either from the
348 	annotation, or from the document).
349 */
350 fz_text_language pdf_annot_language(fz_context *ctx, pdf_annot *annot);
351 
352 /*
353 	How many quad points does an annotation have?
354 */
355 int pdf_annot_quad_point_count(fz_context *ctx, pdf_annot *annot);
356 
357 /*
358 	Get quadpoint i for an annotation.
359 */
360 fz_quad pdf_annot_quad_point(fz_context *ctx, pdf_annot *annot, int i);
361 
362 /*
363 	How many strokes in the ink list for an annotation?
364 */
365 int pdf_annot_ink_list_count(fz_context *ctx, pdf_annot *annot);
366 
367 /*
368 	How many vertexes in stroke i of the ink list for an annotation?
369 */
370 int pdf_annot_ink_list_stroke_count(fz_context *ctx, pdf_annot *annot, int i);
371 
372 /*
373 	Get vertex k from stroke i of the ink list for an annoation, in
374 	doc space.
375 */
376 fz_point pdf_annot_ink_list_stroke_vertex(fz_context *ctx, pdf_annot *annot, int i, int k);
377 
378 /*
379 	Set the flags for an annotation.
380 */
381 void pdf_set_annot_flags(fz_context *ctx, pdf_annot *annot, int flags);
382 
383 /*
384 	Set the bounding box for an annotation, in doc space.
385 */
386 void pdf_set_annot_rect(fz_context *ctx, pdf_annot *annot, fz_rect rect);
387 
388 /*
389 	Set the border width for an annotation, in points.
390 */
391 void pdf_set_annot_border(fz_context *ctx, pdf_annot *annot, float width);
392 
393 /*
394 	Set the opacity for an annotation, between 0 (transparent) and 1
395 	(solid).
396 */
397 void pdf_set_annot_opacity(fz_context *ctx, pdf_annot *annot, float opacity);
398 
399 /*
400 	Set the annotation color.
401 
402 	n components, each between 0 and 1.
403 	n = 1 (grey), 3 (rgb) or 4 (cmyk).
404 */
405 void pdf_set_annot_color(fz_context *ctx, pdf_annot *annot, int n, const float *color);
406 
407 /*
408 	Set the annotation interior color.
409 
410 	n components, each between 0 and 1.
411 	n = 1 (grey), 3 (rgb) or 4 (cmyk).
412 */
413 void pdf_set_annot_interior_color(fz_context *ctx, pdf_annot *annot, int n, const float *color);
414 
415 /*
416 	Set the quadding (justification) to use for the annotation.
417 		0 = Left-justified
418 		1 = Centered
419 		2 = Right-justified
420 */
421 void pdf_set_annot_quadding(fz_context *ctx, pdf_annot *annot, int q);
422 
423 /*
424 	Set the language for the annotation.
425 */
426 void pdf_set_annot_language(fz_context *ctx, pdf_annot *annot, fz_text_language lang);
427 
428 /*
429 	Set the quad points for an annotation to those in the qv array
430 	of length n.
431 */
432 void pdf_set_annot_quad_points(fz_context *ctx, pdf_annot *annot, int n, const fz_quad *qv);
433 
434 /*
435 	Clear the quadpoint data for an annotation.
436 */
437 void pdf_clear_annot_quad_points(fz_context *ctx, pdf_annot *annot);
438 
439 /*
440 	Append a new quad point to the quad point data in an annotation.
441 */
442 void pdf_add_annot_quad_point(fz_context *ctx, pdf_annot *annot, fz_quad quad);
443 
444 /*
445 	Set the ink list for an annotation.
446 
447 	n strokes. For 0 <= i < n, stroke i has count[i] points,
448 	The vertexes for all the strokes are packed into a single
449 	array, pointed to by v.
450 */
451 void pdf_set_annot_ink_list(fz_context *ctx, pdf_annot *annot, int n, const int *count, const fz_point *v);
452 
453 /*
454 	Clear the ink list for an annotation.
455 */
456 void pdf_clear_annot_ink_list(fz_context *ctx, pdf_annot *annot);
457 
458 /*
459 	Add a new stroke (initially empty) to the ink list for an
460 	annotation.
461 */
462 void pdf_add_annot_ink_list_stroke(fz_context *ctx, pdf_annot *annot);
463 
464 /*
465 	Add a new vertex to the last stroke in the ink list for an
466 	annotation.
467 */
468 void pdf_add_annot_ink_list_stroke_vertex(fz_context *ctx, pdf_annot *annot, fz_point p);
469 
470 /*
471 	Add a new stroke to the ink list for an annotation, and
472 	populate it with the n points from stroke[].
473 */
474 void pdf_add_annot_ink_list(fz_context *ctx, pdf_annot *annot, int n, fz_point stroke[]);
475 
476 /*
477 
478 */
479 void pdf_set_annot_icon_name(fz_context *ctx, pdf_annot *annot, const char *name);
480 void pdf_set_annot_is_open(fz_context *ctx, pdf_annot *annot, int is_open);
481 
482 enum pdf_line_ending pdf_annot_line_start_style(fz_context *ctx, pdf_annot *annot);
483 enum pdf_line_ending pdf_annot_line_end_style(fz_context *ctx, pdf_annot *annot);
484 void pdf_annot_line_ending_styles(fz_context *ctx, pdf_annot *annot, enum pdf_line_ending *start_style, enum pdf_line_ending *end_style);
485 void pdf_set_annot_line_start_style(fz_context *ctx, pdf_annot *annot, enum pdf_line_ending s);
486 void pdf_set_annot_line_end_style(fz_context *ctx, pdf_annot *annot, enum pdf_line_ending e);
487 void pdf_set_annot_line_ending_styles(fz_context *ctx, pdf_annot *annot, enum pdf_line_ending start_style, enum pdf_line_ending end_style);
488 
489 const char *pdf_annot_icon_name(fz_context *ctx, pdf_annot *annot);
490 int pdf_annot_is_open(fz_context *ctx, pdf_annot *annot);
491 
492 void pdf_annot_line(fz_context *ctx, pdf_annot *annot, fz_point *a, fz_point *b);
493 void pdf_set_annot_line(fz_context *ctx, pdf_annot *annot, fz_point a, fz_point b);
494 
495 int pdf_annot_vertex_count(fz_context *ctx, pdf_annot *annot);
496 fz_point pdf_annot_vertex(fz_context *ctx, pdf_annot *annot, int i);
497 
498 void pdf_set_annot_vertices(fz_context *ctx, pdf_annot *annot, int n, const fz_point *v);
499 void pdf_clear_annot_vertices(fz_context *ctx, pdf_annot *annot);
500 void pdf_add_annot_vertex(fz_context *ctx, pdf_annot *annot, fz_point p);
501 void pdf_set_annot_vertex(fz_context *ctx, pdf_annot *annot, int i, fz_point p);
502 
503 const char *pdf_annot_contents(fz_context *ctx, pdf_annot *annot);
504 void pdf_set_annot_contents(fz_context *ctx, pdf_annot *annot, const char *text);
505 
506 const char *pdf_annot_author(fz_context *ctx, pdf_annot *annot);
507 void pdf_set_annot_author(fz_context *ctx, pdf_annot *annot, const char *author);
508 
509 int64_t pdf_annot_modification_date(fz_context *ctx, pdf_annot *annot);
510 void pdf_set_annot_modification_date(fz_context *ctx, pdf_annot *annot, int64_t time);
511 int64_t pdf_annot_creation_date(fz_context *ctx, pdf_annot *annot);
512 void pdf_set_annot_creation_date(fz_context *ctx, pdf_annot *annot, int64_t time);
513 
514 void pdf_parse_default_appearance(fz_context *ctx, const char *da, const char **font, float *size, float color[3]);
515 void pdf_print_default_appearance(fz_context *ctx, char *buf, int nbuf, const char *font, float size, const float color[3]);
516 void pdf_annot_default_appearance(fz_context *ctx, pdf_annot *annot, const char **font, float *size, float color[3]);
517 void pdf_set_annot_default_appearance(fz_context *ctx, pdf_annot *annot, const char *font, float size, const float color[3]);
518 
519 void pdf_dirty_annot(fz_context *ctx, pdf_annot *annot);
520 
521 /*
522 	Recreate the appearance stream for an annotation, if necessary.
523 */
524 void pdf_update_appearance(fz_context *ctx, pdf_annot *annot);
525 void pdf_update_signature_appearance(fz_context *ctx, pdf_annot *annot, const char *name, const char *text, const char *date);
526 
527 /*
528 	Regenerate any appearance streams that are out of date and check for
529 	cases where a different appearance stream should be selected because of
530 	state changes.
531 
532 	Note that a call to pdf_pass_event for one page may lead to changes on
533 	any other, so an app should call pdf_update_annot for every annotation
534 	it currently displays. Also it is important that the pdf_annot object
535 	is the one used to last render the annotation. If instead the app were
536 	to drop the page or annotations and reload them then a call to
537 	pdf_update_annot would not reliably be able to report all changed
538 	annotations.
539 
540 	Returns true if the annotation appearance has changed since the last time
541 	pdf_update_annot was called or the annotation was first loaded.
542 */
543 int pdf_update_annot(fz_context *ctx, pdf_annot *annot);
544 
545 /*
546 	Recalculate form fields if necessary.
547 
548 	Loop through all annotations on the page and update them. Return true
549 	if any of them were changed (by either event or javascript actions, or
550 	by annotation editing) and need re-rendering.
551 
552 	If you need more granularity, loop through the annotations and call
553 	pdf_update_annot for each one to detect changes on a per-annotation
554 	basis.
555 */
556 int pdf_update_page(fz_context *ctx, pdf_page *page);
557 
558 /*
559 	Update internal state appropriate for editing this field. When editing
560 	is true, updating the text of the text widget will not have any
561 	side-effects such as changing other widgets or running javascript.
562 	This state is intended for the period when a text widget is having
563 	characters typed into it. The state should be reverted at the end of
564 	the edit sequence and the text newly updated.
565 */
566 void pdf_set_widget_editing_state(fz_context *ctx, pdf_widget *widget, int editing);
567 
568 int pdf_get_widget_editing_state(fz_context *ctx, pdf_widget *widget);
569 
570 /*
571 	Toggle the state of a specified annotation. Applies only to check-box
572 	and radio-button widgets.
573 */
574 int pdf_toggle_widget(fz_context *ctx, pdf_widget *widget);
575 
576 fz_display_list *pdf_new_display_list_from_annot(fz_context *ctx, pdf_annot *annot);
577 
578 /*
579 	Render an annotation suitable for blending on top of the opaque
580 	pixmap returned by fz_new_pixmap_from_page_contents.
581 */
582 fz_pixmap *pdf_new_pixmap_from_annot(fz_context *ctx, pdf_annot *annot, fz_matrix ctm, fz_colorspace *cs, fz_separations *seps, int alpha);
583 fz_stext_page *pdf_new_stext_page_from_annot(fz_context *ctx, pdf_annot *annot, const fz_stext_options *options);
584 
585 fz_layout_block *pdf_layout_text_widget(fz_context *ctx, pdf_annot *annot);
586 
587 const char *pdf_guess_mime_type_from_file_name(fz_context *ctx, const char *filename);
588 pdf_obj *pdf_embedded_file_stream(fz_context *ctx, pdf_obj *fs);
589 const char *pdf_embedded_file_name(fz_context *ctx, pdf_obj *fs);
590 const char *pdf_embedded_file_type(fz_context *ctx, pdf_obj *fs);
591 int pdf_is_embedded_file(fz_context *ctx, pdf_obj *fs);
592 fz_buffer *pdf_load_embedded_file(fz_context *ctx, pdf_obj *fs);
593 pdf_obj *pdf_add_embedded_file(fz_context *ctx, pdf_document *doc, const char *filename, const char *mimetype, fz_buffer *contents);
594 
595 /* Implementation details: Subject to change */
596 
597 struct pdf_annot
598 {
599 	int refs;
600 
601 	pdf_page *page;
602 	pdf_obj *obj;
603 
604 	pdf_obj *ap;
605 
606 	int is_hot;
607 	int is_active;
608 
609 	int needs_new_ap;
610 	int has_new_ap;
611 	int ignore_trigger_events;
612 
613 	pdf_annot *next;
614 };
615 
616 char *pdf_parse_link_dest(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
617 char *pdf_parse_link_action(fz_context *ctx, pdf_document *doc, pdf_obj *obj, int pagenum);
618 pdf_obj *pdf_lookup_dest(fz_context *ctx, pdf_document *doc, pdf_obj *needle);
619 fz_link *pdf_load_link_annots(fz_context *ctx, pdf_document *, pdf_obj *annots, int pagenum, fz_matrix page_ctm);
620 void pdf_load_annots(fz_context *ctx, pdf_page *page, pdf_obj *annots);
621 void pdf_drop_annots(fz_context *ctx, pdf_annot *annot_list);
622 void pdf_drop_widgets(fz_context *ctx, pdf_widget *widget_list);
623 
624 void pdf_annot_MK_BG(fz_context *ctx, pdf_annot *annot, int *n, float color[4]);
625 void pdf_annot_MK_BC(fz_context *ctx, pdf_annot *annot, int *n, float color[4]);
626 int pdf_annot_MK_BG_rgb(fz_context *ctx, pdf_annot *annot, float rgb[3]);
627 int pdf_annot_MK_BC_rgb(fz_context *ctx, pdf_annot *annot, float rgb[3]);
628 
629 
630 #endif
631