]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/include/mupdf/fitz/path.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / include / mupdf / fitz / path.h
1 #ifndef MUPDF_FITZ_PATH_H
2 #define MUPDF_FITZ_PATH_H
3
4 #include "mupdf/fitz/system.h"
5 #include "mupdf/fitz/context.h"
6 #include "mupdf/fitz/math.h"
7
8 /*
9  * Vector path buffer.
10  * It can be stroked and dashed, or be filled.
11  * It has a fill rule (nonzero or even_odd).
12  *
13  * When rendering, they are flattened, stroked and dashed straight
14  * into the Global Edge List.
15  */
16
17 typedef struct fz_path_s fz_path;
18 typedef struct fz_stroke_state_s fz_stroke_state;
19
20 typedef enum fz_path_command_e
21 {
22         FZ_MOVETO = 'M',
23         FZ_LINETO = 'L',
24         FZ_CURVETO = 'C',
25         FZ_CLOSE_PATH = 'Z',
26 } fz_path_item_kind;
27
28 typedef enum fz_linecap_e
29 {
30         FZ_LINECAP_BUTT = 0,
31         FZ_LINECAP_ROUND = 1,
32         FZ_LINECAP_SQUARE = 2,
33         FZ_LINECAP_TRIANGLE = 3
34 } fz_linecap;
35
36 typedef enum fz_linejoin_e
37 {
38         FZ_LINEJOIN_MITER = 0,
39         FZ_LINEJOIN_ROUND = 1,
40         FZ_LINEJOIN_BEVEL = 2,
41         FZ_LINEJOIN_MITER_XPS = 3
42 } fz_linejoin;
43
44 struct fz_path_s
45 {
46         int cmd_len, cmd_cap;
47         unsigned char *cmds;
48         int coord_len, coord_cap;
49         float *coords;
50         fz_point current;
51         fz_point begin;
52         int last_cmd;
53 };
54
55 struct fz_stroke_state_s
56 {
57         int refs;
58         fz_linecap start_cap, dash_cap, end_cap;
59         fz_linejoin linejoin;
60         float linewidth;
61         float miterlimit;
62         float dash_phase;
63         int dash_len;
64         float dash_list[32];
65 };
66
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);
76
77 void fz_transform_path(fz_context *ctx, fz_path *path, const fz_matrix *transform);
78
79 fz_path *fz_clone_path(fz_context *ctx, fz_path *old);
80
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);
83
84 extern const fz_stroke_state fz_default_stroke_state;
85
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);
93
94 #ifndef NDEBUG
95 void fz_print_path(fz_context *ctx, FILE *out, fz_path *, int indent);
96 #endif
97
98 #endif