diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-04-07 13:36:29 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-04-26 15:12:57 +0200 |
commit | d8ebcc7b59fc20b1dd3ea7887c6d3ad2859b3698 (patch) | |
tree | 74dc67e9c984bde63c4da7389d89b00e30b21182 /include | |
parent | 1b16995f277aefda88957e31c00d963fc9a59d7a (diff) | |
download | mupdf-d8ebcc7b59fc20b1dd3ea7887c6d3ad2859b3698.tar.xz |
svg: Add SVG parser.
svg: Implement graphics state stack.
svg: Use idmap for symbol and use elements.
svg: Put viewport and viewBox in state stack.
svg: Rebase to version 1.9 master.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/document.h | 1 | ||||
-rw-r--r-- | include/mupdf/svg.h | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h index 1964e41c..b70f7a8a 100644 --- a/include/mupdf/fitz/document.h +++ b/include/mupdf/fitz/document.h @@ -106,6 +106,7 @@ struct fz_document_handler_s extern fz_document_handler pdf_document_handler; extern fz_document_handler xps_document_handler; +extern fz_document_handler svg_document_handler; extern fz_document_handler cbz_document_handler; extern fz_document_handler img_document_handler; extern fz_document_handler tiff_document_handler; diff --git a/include/mupdf/svg.h b/include/mupdf/svg.h new file mode 100644 index 00000000..280f1726 --- /dev/null +++ b/include/mupdf/svg.h @@ -0,0 +1,41 @@ +#ifndef MUPDF_SVG_H +#define MUPDF_SVG_H + +#include "mupdf/fitz.h" + +/* Forward declarations. */ + +typedef struct svg_document_s svg_document; + +/* Parse basic data type units. */ + +const char *svg_lex_number(float *fp, const char *str); +float svg_parse_number(const char *str, float min,float max, float inherit); +float svg_parse_length(const char *str, float percent, float font_size); +float svg_parse_angle(const char *str); + +void svg_parse_color(fz_context *ctx, svg_document *doc, char *str, float *rgb); +void svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *ctm); + +int svg_is_whitespace_or_comma(int c); +int svg_is_whitespace(int c); +int svg_is_alpha(int c); +int svg_is_digit(int c); + +/* Graphics content parsing. */ + +void svg_parse_document_bounds(fz_context *ctx, svg_document *doc, fz_xml *root); +void svg_run_document(fz_context *ctx, svg_document *doc, fz_xml *root, fz_device *dev, const fz_matrix *ctm); + +/* Global context */ + +struct svg_document_s +{ + fz_document super; + fz_xml *root; + fz_tree *idmap; + float width; + float height; +}; + +#endif |