summaryrefslogtreecommitdiff
path: root/fitz/fitz.h
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-12 15:34:30 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-12 20:15:09 +0000
commitf0d427993c1b9b40f1bc0b77ed9c0433099f2a5d (patch)
treec89144197a2aafec4dac4a05506dad93e098ebdc /fitz/fitz.h
parent269a44d92e2fc15631b86cc0c7135baf2023f312 (diff)
downloadmupdf-f0d427993c1b9b40f1bc0b77ed9c0433099f2a5d.tar.xz
Support proper XPS mitering. (And stroke fixes).
XPS differs from PS/PDF/etc in the way it handles miters; rather than simply converting a miter that's overly long to a bevel, it truncates it at the miter limit. As such it needs to be handled correctly. For clarity, expose new enumerated types for linejoins and linecaps, and use these throughout code. When we upgrade our freetype, we can move to using proper xps mitering in that too. Add new fz_matrix_max_expansion function to return a safer expansion value that works in the case where we scale up in one direction and down in another. In the xps path drawing code, avoid generating unnecessary linetos. Thanks to Zeniko for spotting these and providing implementations.
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r--fitz/fitz.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 6aebdf61..bfc4723a 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -520,6 +520,7 @@ fz_matrix fz_translate(float tx, float ty);
fz_matrix fz_invert_matrix(fz_matrix m);
int fz_is_rectilinear(fz_matrix m);
float fz_matrix_expansion(fz_matrix m);
+float fz_matrix_max_expansion(fz_matrix m);
fz_bbox fz_round_rect(fz_rect r);
fz_bbox fz_intersect_bbox(fz_bbox a, fz_bbox b);
@@ -1102,6 +1103,22 @@ typedef enum fz_path_item_kind_e
FZ_CLOSE_PATH
} fz_path_item_kind;
+typedef enum fz_linecap_e
+{
+ FZ_LINECAP_BUTT = 0,
+ FZ_LINECAP_ROUND = 1,
+ FZ_LINECAP_SQUARE = 2,
+ FZ_LINECAP_TRIANGLE = 3
+} fz_linecap;
+
+typedef enum fz_linejoin_e
+{
+ FZ_LINEJOIN_MITER = 0,
+ FZ_LINEJOIN_ROUND = 1,
+ FZ_LINEJOIN_BEVEL = 2,
+ FZ_LINEJOIN_MITER_XPS = 3
+} fz_linejoin;
+
union fz_path_item_s
{
fz_path_item_kind k;
@@ -1116,8 +1133,8 @@ struct fz_path_s
struct fz_stroke_state_s
{
- int start_cap, dash_cap, end_cap;
- int linejoin;
+ fz_linecap start_cap, dash_cap, end_cap;
+ fz_linejoin linejoin;
float linewidth;
float miterlimit;
float dash_phase;