1
/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.h,v 1.14 2008/12/11 16:03:05 matthias Exp $
3
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
5
Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
6
the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
8
Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
10
This program is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2 of the License, or
13
(at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
31
#define PDF_DASH_SIZE_MAX 16
32
#define PDF_GSAVE_MAX 256
34
extern void pdf_dev_init_gstates (void);
35
extern void pdf_dev_clear_gstates (void);
37
#define pdf_copymatrix(m,n) do {\
38
(m)->a = (n)->a; (m)->b = (n)->b;\
39
(m)->c = (n)->c; (m)->d = (n)->d;\
40
(m)->e = (n)->e; (m)->f = (n)->f;\
43
#define pdf_setmatrix(m,p,q,r,s,t,u) do {\
44
(m)->a = (p); (m)->b = (q);\
45
(m)->c = (r); (m)->d = (s);\
46
(m)->e = (t); (m)->f = (u);\
50
#define pdf_concatmatrix(m,n) do {\
51
double _tmp_a, _tmp_b, _tmp_c, _tmp_d; \
52
_tmp_a = (m)->a; _tmp_b = (m)->b; \
53
_tmp_c = (m)->c; _tmp_d = (m)->d; \
54
(m)->a = ((n)->a) * _tmp_a + ((n)->b) * _tmp_c; \
55
(m)->b = ((n)->a) * _tmp_b + ((n)->b) * _tmp_d; \
56
(m)->c = ((n)->c) * _tmp_a + ((n)->d) * _tmp_c; \
57
(m)->d = ((n)->c) * _tmp_b + ((n)->d) * _tmp_d; \
58
(m)->e += ((n)->e) * _tmp_a + ((n)->f) * _tmp_c; \
59
(m)->f += ((n)->e) * _tmp_b + ((n)->f) * _tmp_d; \
62
typedef struct pdf_path_ pdf_path;
64
extern int pdf_dev_currentmatrix (pdf_tmatrix *M);
65
extern int pdf_dev_currentpoint (pdf_coord *cp);
67
extern int pdf_dev_setlinewidth (double width);
68
extern int pdf_dev_setmiterlimit (double mlimit);
69
extern int pdf_dev_setlinecap (int style);
70
extern int pdf_dev_setlinejoin (int style);
71
extern int pdf_dev_setdash (int count,
75
extern int pdf_dev_setflat (int flatness);
78
/* Path Construction */
79
extern int pdf_dev_moveto (double x , double y);
80
extern int pdf_dev_rmoveto (double x , double y);
81
extern int pdf_dev_closepath (void);
83
extern int pdf_dev_lineto (double x0 , double y0);
84
extern int pdf_dev_rlineto (double x0 , double y0);
85
extern int pdf_dev_curveto (double x0 , double y0,
86
double x1 , double y1,
87
double x2 , double y2);
88
extern int pdf_dev_rcurveto (double x0 , double y0,
89
double x1 , double y1,
90
double x2 , double y2);
91
extern int pdf_dev_arc (double c_x, double c_y, double r,
92
double a_0, double a_1);
93
extern int pdf_dev_arcn (double c_x, double c_y, double r,
94
double a_0, double a_1);
96
#define PDF_FILL_RULE_NONZERO 0
97
#define PDF_FILL_RULE_EVENODD 1
99
extern int pdf_dev_newpath (void);
102
extern int pdf_dev_clip (void);
103
extern int pdf_dev_eoclip (void);
107
extern int pdf_dev_rectstroke (double x, double y,
109
const pdf_tmatrix *M /* optional */
112
extern int pdf_dev_rectfill (double x, double y, double w, double h);
113
extern int pdf_dev_rectclip (double x, double y, double w, double h);
115
extern int pdf_dev_flushpath (char p_op, int fill_rule);
117
#define pdf_dev_fill() pdf_dev_flushpath('f', PDF_FILL_RULE_NONZERO)
118
#define pdf_dev_eofill() pdf_dev_flushpath('f', PDF_FILL_RULE_EVENODD)
119
#define pdf_dev_stroke() pdf_dev_flushpath('S', PDF_FILL_RULE_NONZERO)
120
#define pdf_dev_fillstroke() pdf_dev_flushpath('B', PDF_FILL_RULE_NONZERO)
122
extern int pdf_dev_concat (const pdf_tmatrix *M);
123
/* NULL pointer of M mean apply current transformation */
124
extern void pdf_dev_dtransform (pdf_coord *p, const pdf_tmatrix *M);
125
extern void pdf_dev_idtransform (pdf_coord *p, const pdf_tmatrix *M);
126
extern void pdf_dev_transform (pdf_coord *p, const pdf_tmatrix *M);
128
extern void pdf_dev_itransform (pdf_coord *p, const pdf_tmatrix *M);
131
extern int pdf_dev_gsave (void);
132
extern int pdf_dev_grestore (void);
134
/* Requires from mpost.c because new MetaPost graphics must initialize
135
* the current gstate. */
136
extern int pdf_dev_push_gstate (void);
137
extern int pdf_dev_pop_gstate (void);
141
extern int pdf_dev_arcx (double c_x, double c_y,
142
double r_x, double r_y,
143
double a_0, double a_1,
144
int a_d, /* arc direction */
145
double xar /* x-axis-rotation */
147
extern int pdf_dev_bspline (double x0, double y0,
148
double x1, double y1,
149
double x2, double y2);
152
extern void pdf_invertmatrix (pdf_tmatrix *M);
154
/* The depth here is the depth of q/Q nesting.
155
* We must remember current depth of nesting when starting a page or xform,
156
* and must recover until that depth at the end of page/xform.
158
extern int pdf_dev_current_depth (void);
159
extern void pdf_dev_grestore_to (int depth);
160
#define pdf_dev_grestoreall() pdf_dev_grestore_to(0);
162
extern void pdf_dev_set_color (const pdf_color *color, char mask, int force);
163
#define pdf_dev_set_strokingcolor(c) pdf_dev_set_color(c, 0, 0);
164
#define pdf_dev_set_nonstrokingcolor(c) pdf_dev_set_color(c, 0x20, 0);
165
extern void pdf_dev_reset_color (int force);
167
#endif /* _PDF_DRAW_H_ */