1 #ifndef MUPDF_FITZ_PATH_H
2 #define MUPDF_FITZ_PATH_H
4 #include "mupdf/fitz/system.h"
5 #include "mupdf/fitz/context.h"
6 #include "mupdf/fitz/math.h"
10 * It can be stroked and dashed, or be filled.
11 * It has a fill rule (nonzero or even_odd).
13 * When rendering, they are flattened, stroked and dashed straight
14 * into the Global Edge List.
17 typedef struct fz_path_s fz_path;
18 typedef struct fz_stroke_state_s fz_stroke_state;
20 typedef enum fz_path_command_e
28 typedef enum fz_linecap_e
32 FZ_LINECAP_SQUARE = 2,
33 FZ_LINECAP_TRIANGLE = 3
36 typedef enum fz_linejoin_e
38 FZ_LINEJOIN_MITER = 0,
39 FZ_LINEJOIN_ROUND = 1,
40 FZ_LINEJOIN_BEVEL = 2,
41 FZ_LINEJOIN_MITER_XPS = 3
48 int coord_len, coord_cap;
55 struct fz_stroke_state_s
58 fz_linecap start_cap, dash_cap, end_cap;
67 fz_path *fz_new_path(fz_context *ctx);
68 fz_point fz_currentpoint(fz_context *ctx, fz_path *path);
69 void fz_moveto(fz_context*, fz_path*, float x, float y);
70 void fz_lineto(fz_context*, fz_path*, float x, float y);
71 void fz_curveto(fz_context*,fz_path*, float, float, float, float, float, float);
72 void fz_curvetov(fz_context*,fz_path*, float, float, float, float);
73 void fz_curvetoy(fz_context*,fz_path*, float, float, float, float);
74 void fz_closepath(fz_context*,fz_path*);
75 void fz_free_path(fz_context *ctx, fz_path *path);
77 void fz_transform_path(fz_context *ctx, fz_path *path, const fz_matrix *transform);
79 fz_path *fz_clone_path(fz_context *ctx, fz_path *old);
81 fz_rect *fz_bound_path(fz_context *ctx, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r);
82 fz_rect *fz_adjust_rect_for_stroke(fz_rect *r, const fz_stroke_state *stroke, const fz_matrix *ctm);
84 extern const fz_stroke_state fz_default_stroke_state;
86 fz_stroke_state *fz_new_stroke_state(fz_context *ctx);
87 fz_stroke_state *fz_new_stroke_state_with_dash_len(fz_context *ctx, int len);
88 fz_stroke_state *fz_keep_stroke_state(fz_context *ctx, fz_stroke_state *stroke);
89 void fz_drop_stroke_state(fz_context *ctx, fz_stroke_state *stroke);
90 fz_stroke_state *fz_unshare_stroke_state(fz_context *ctx, fz_stroke_state *shared);
91 fz_stroke_state *fz_unshare_stroke_state_with_dash_len(fz_context *ctx, fz_stroke_state *shared, int len);
92 fz_stroke_state *fz_clone_stroke_state(fz_context *ctx, fz_stroke_state *stroke);
95 void fz_print_path(fz_context *ctx, FILE *out, fz_path *, int indent);