link.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef MUPDF_FITZ_LINK_H
  2. #define MUPDF_FITZ_LINK_H
  3. #include "mupdf/fitz/system.h"
  4. #include "mupdf/fitz/context.h"
  5. #include "mupdf/fitz/geometry.h"
  6. /*
  7. Links
  8. */
  9. typedef struct fz_link_s fz_link;
  10. /*
  11. fz_link is a list of interactive links on a page.
  12. There is no relation between the order of the links in the
  13. list and the order they appear on the page. The list of links
  14. for a given page can be obtained from fz_load_links.
  15. A link is reference counted. Dropping a reference to a link is
  16. done by calling fz_drop_link.
  17. rect: The hot zone. The area that can be clicked in
  18. untransformed coordinates.
  19. uri: Link destinations come in two forms: internal and external.
  20. Internal links refer to other pages in the same document.
  21. External links are URLs to other documents.
  22. next: A pointer to the next link on the same page.
  23. */
  24. struct fz_link_s
  25. {
  26. int refs;
  27. fz_link *next;
  28. fz_rect rect;
  29. void *doc;
  30. char *uri;
  31. };
  32. fz_link *fz_new_link(fz_context *ctx, const fz_rect *bbox, void *doc, const char *uri);
  33. fz_link *fz_keep_link(fz_context *ctx, fz_link *link);
  34. /*
  35. Checks if a link destination is external or internal.
  36. */
  37. int fz_is_external_link(fz_context *ctx, const char *uri);
  38. /*
  39. fz_drop_link: Drop and free a list of links.
  40. Does not throw exceptions.
  41. */
  42. void fz_drop_link(fz_context *ctx, fz_link *link);
  43. #endif