This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
/
PrintContext.custom
284 lines (209 loc) · 10 KB
/
PrintContext.custom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_beginpage (IntPtr raw, IntPtr name);
public PrintReturnCode BeginPage (string name) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (name);
int result = gnome_print_beginpage (Handle, native);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_showpage (IntPtr raw);
public PrintReturnCode ShowPage () {
return (PrintReturnCode)gnome_print_showpage (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_end_doc (IntPtr raw);
public PrintReturnCode EndDoc () {
return (PrintReturnCode)gnome_print_end_doc (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_gsave (IntPtr raw);
public PrintReturnCode SaveGraphicState () {
return (PrintReturnCode)gnome_print_gsave (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_grestore (IntPtr raw);
public PrintReturnCode RestoreGraphicState () {
return (PrintReturnCode)gnome_print_grestore (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_newpath (IntPtr raw);
public PrintReturnCode NewPath () {
return (PrintReturnCode)gnome_print_newpath (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_moveto (IntPtr raw, double x, double y);
public PrintReturnCode MoveTo (double x, double y) {
return (PrintReturnCode)gnome_print_moveto (Handle, x, y);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_lineto (IntPtr raw, double x, double y);
public PrintReturnCode LineTo (double x, double y) {
return (PrintReturnCode)gnome_print_lineto (Handle, x, y);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_curveto (IntPtr raw, double x1, double y1, double x2, double y2, double x3, double y3);
public PrintReturnCode CurveTo (double x1, double y1, double x2, double y2, double x3, double y3) {
return (PrintReturnCode)gnome_print_curveto (Handle, x1, y1, x2, y2, x3, y3);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_closepath (IntPtr raw);
public PrintReturnCode ClosePath () {
return (PrintReturnCode)gnome_print_closepath (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_strokepath (IntPtr raw);
public PrintReturnCode StrokePath () {
return (PrintReturnCode)gnome_print_strokepath (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_bpath (IntPtr raw, ref Art.Bpath bpath, bool append);
public PrintReturnCode Bpath (Art.Bpath bpath, bool append) {
return (PrintReturnCode)gnome_print_bpath (Handle, ref bpath, append);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_vpath (IntPtr raw, ref Art.Vpath vpath, bool append);
public PrintReturnCode Vpath (Art.Vpath vpath, bool append) {
return (PrintReturnCode)gnome_print_vpath (Handle, ref vpath, append);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_arcto (IntPtr raw, double x, double y, double radius, double angle1, double angle2, int direction);
public PrintReturnCode ArcTo (double x, double y, double radius, double angle1, double angle2, int direction) {
return (PrintReturnCode)gnome_print_arcto (Handle, x, y, radius, angle1, angle2, direction);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setrgbcolor (IntPtr raw, double r, double g, double b);
public PrintReturnCode SetRgbColor (double r, double g, double b) {
return (PrintReturnCode)gnome_print_setrgbcolor (Handle, r, g, b);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setopacity (IntPtr raw, double opacity);
public PrintReturnCode SetOpacity (double opacity) {
return (PrintReturnCode)gnome_print_setopacity (Handle, opacity);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setlinewidth (IntPtr raw, double width);
public PrintReturnCode SetLineWidth (double width) {
return (PrintReturnCode)gnome_print_setlinewidth (Handle, width);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setmiterlimit (IntPtr raw, double limit);
public PrintReturnCode SetMiterLimit (double limit) {
return (PrintReturnCode)gnome_print_setmiterlimit (Handle, limit);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setlinejoin (IntPtr raw, int jointype);
public PrintReturnCode SetLineJoin (int jointype) {
return (PrintReturnCode)gnome_print_setlinejoin (Handle, jointype);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setlinecap (IntPtr raw, int captype);
public PrintReturnCode SetLineCap (int captype) {
return (PrintReturnCode)gnome_print_setlinecap (Handle, captype);
}
// FIXME!
/*[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setdash (IntPtr raw, int n_values, IntPtr value, double offset);
public PrintReturnCode SetDash (double values[], double offset) {
return (PrintReturnCode)gnome_print_setdash (Handle, values.Length, values, offset);
}*/
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_setfont (IntPtr raw, IntPtr font);
public PrintReturnCode SetFont (Font font) {
return (PrintReturnCode)gnome_print_setfont (Handle, font == null ? IntPtr.Zero : font.Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_clip (IntPtr raw);
public PrintReturnCode Clip () {
return (PrintReturnCode)gnome_print_clip (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_eoclip (IntPtr raw);
public PrintReturnCode EvenOddClip () {
return (PrintReturnCode)gnome_print_eoclip (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_scale (IntPtr raw, double sx, double sy);
public PrintReturnCode Scale (double sx, double sy) {
return (PrintReturnCode)gnome_print_scale (Handle, sx, sy);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rotate (IntPtr raw, double theta);
public PrintReturnCode Rotate (double theta) {
return (PrintReturnCode)gnome_print_rotate (Handle, theta);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_translate (IntPtr raw, double x, double y);
public PrintReturnCode Translate (double x, double y) {
return (PrintReturnCode)gnome_print_translate (Handle, x, y);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_fill (IntPtr raw);
public PrintReturnCode Fill () {
return (PrintReturnCode)gnome_print_fill (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_eofill (IntPtr raw);
public PrintReturnCode EvenOddFill () {
return (PrintReturnCode)gnome_print_eofill (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_stroke (IntPtr raw);
public PrintReturnCode Stroke () {
return (PrintReturnCode)gnome_print_stroke (Handle);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_show (IntPtr raw, IntPtr text);
public PrintReturnCode Show (string text) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
int result = gnome_print_show (Handle, native);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_show_sized (IntPtr raw, IntPtr text, int bytes);
public PrintReturnCode ShowSized (string text, int bytes) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
int result = gnome_print_show_sized (Handle, native, bytes);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_grayimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode GrayImage (string data, int width, int height, int rowstride) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_grayimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rgbimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode RgbImage (string data, int width, int height, int rowstride) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_rgbimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rgbaimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode RgbaImage (string data, int width, int height, int rowstride) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_rgbaimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_line_stroked (IntPtr raw, double x0, double y0, double x1, double y1);
public PrintReturnCode LineStroked (double x0, double y0, double x1, double y1) {
return (PrintReturnCode)gnome_print_line_stroked (Handle, x0, y0, x1, y1);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rect_stroked (IntPtr raw, double x, double y, double width, double height);
public PrintReturnCode RectStroked (double x, double y, double width, double height) {
return (PrintReturnCode)gnome_print_rect_stroked (Handle, x, y, width, height);
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rect_filled (IntPtr raw, double x, double y, double width, double height);
public PrintReturnCode RectFilled (double x, double y, double width, double height) {
return (PrintReturnCode)gnome_print_rect_filled (Handle, x, y, width, height);
}