~ubuntu-branches/ubuntu/gutsy/cairo-java/gutsy

« back to all changes in this revision

Viewing changes to src/java/org/freedesktop/cairo/Context.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-04-16 16:15:30 UTC
  • Revision ID: james.westby@ubuntu.com-20060416161530-avdw6l5vg6n2kosy
Tags: upstream-1.0.3
ImportĀ upstreamĀ versionĀ 1.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Java-Gnome Bindings Library
 
3
 *
 
4
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 
5
 *
 
6
 * The Java-Gnome bindings library is free software distributed under
 
7
 * the terms of the GNU Library General Public License version 2.
 
8
 */
 
9
package org.freedesktop.cairo;
 
10
 
 
11
import org.gnu.glib.Struct;
 
12
import org.gnu.glib.Handle;
 
13
 
 
14
public class Context extends CairoObject {
 
15
 
 
16
    /**
 
17
     * Creates a new Context with all graphics state parameters set to default
 
18
     * values and with target as a target surface. The target surface should be
 
19
     * constructed with a backend-specific function such as ImageSurface.create.
 
20
     * 
 
21
     * @param target
 
22
     *            target surface for the context.
 
23
     */
 
24
    public Context(Surface target) {
 
25
        super(cairo_create(target.getHandle()));
 
26
    }
 
27
 
 
28
    protected Context(Handle hndl) {
 
29
        super(hndl);
 
30
    }
 
31
 
 
32
    /**
 
33
     * Disposes all the native resources used by the object.
 
34
     */
 
35
    protected void finalize() throws Throwable {
 
36
        cairo_destroy(getHandle());
 
37
        super.finalize();
 
38
    }
 
39
 
 
40
    /**
 
41
     * Makes a copy of the current state and saves it on an internal stack of
 
42
     * saved states. When {@link #restore()} is called, the saved state will be
 
43
     * restored. Multiple calls <tt>save()</tt> and <tt>restore()</tt> can
 
44
     * be nested; each call to <tt>restore()</tt> restores the state from the
 
45
     * matching paired <tt>save()</tt>.
 
46
     */
 
47
    public void save() {
 
48
        cairo_save(getHandle());
 
49
    }
 
50
 
 
51
    /**
 
52
     * Restores the state saved by a preceding call to {@link #save()} and
 
53
     * removes that state from the stack of saved states.
 
54
     */
 
55
    public void restore() {
 
56
        cairo_restore(getHandle());
 
57
    }
 
58
 
 
59
    /**
 
60
     * Sets the compositing operator to be used for all drawing operations.
 
61
     * 
 
62
     * @param op
 
63
     */
 
64
    public void setOperator(Operator op) {
 
65
        cairo_set_operator(getHandle(), op.getValue());
 
66
    }
 
67
 
 
68
    /**
 
69
     * Sets the source pattern within the Cairo object. This pattern will then
 
70
     * be used for any subsequent drawing operation until a new source pattern
 
71
     * is set.
 
72
     * 
 
73
     * @param pattern
 
74
     */
 
75
    public void setSource(Pattern pattern) {
 
76
        cairo_set_source(getHandle(), pattern.getHandle());
 
77
    }
 
78
 
 
79
    /**
 
80
     * Sets a constant color for filling and stroking. The color components are
 
81
     * floating point numbers in the range 0 to 1. If the values passed in are
 
82
     * outside that range, they will be clamped.
 
83
     * 
 
84
     * @param red
 
85
     * @param green
 
86
     * @param blue
 
87
     */
 
88
    public void setSourceRGB(double red, double green, double blue) {
 
89
        cairo_set_source_rgb(getHandle(), red, green, blue);
 
90
    }
 
91
 
 
92
    /**
 
93
     * Sets the source pattern within this Cairo object to a translucent color.
 
94
     * This color will then be used for any subsequent drawing operation until a
 
95
     * new source pattern is set.
 
96
     * 
 
97
     * The color and alpha components are floating point numbers in the range 0
 
98
     * to 1. If the values passed in are outside that range, they will be
 
99
     * clamped.
 
100
     * 
 
101
     * @param red
 
102
     * @param green
 
103
     * @param blue
 
104
     * @param alpha
 
105
     */
 
106
    public void setSourceRGBA(double red, double green, double blue,
 
107
            double alpha) {
 
108
        cairo_set_source_rgba(getHandle(), red, green, blue, alpha);
 
109
    }
 
110
 
 
111
    /**
 
112
     * 
 
113
     * @param surface
 
114
     * @param x
 
115
     * @param y
 
116
     */
 
117
    public void setSource(Surface surface, double x, double y) {
 
118
        cairo_set_source_surface(getHandle(), surface.getHandle(), x, y);
 
119
    }
 
120
 
 
121
    /**
 
122
     * Sets the tolerance used when converting paths into trapezoids. Curved
 
123
     * segments of the path will be subdivided until the maximum deviation
 
124
     * between the original path and the polygonal approximation is less than
 
125
     * tolerance. The default value is 0.1. A larger value will give better
 
126
     * performance, a smaller value, better appearance. (Reducing the value from
 
127
     * the default value of 0.1 is unlikely to improve appearance
 
128
     * significantly).
 
129
     * 
 
130
     * @param tolerance
 
131
     */
 
132
    public void setTolerance(double tolerance) {
 
133
        cairo_set_tolerance(getHandle(), tolerance);
 
134
    }
 
135
 
 
136
    /**
 
137
     * Set the current fill rule within the Context. The fill rule is used to
 
138
     * determine which regions are inside or outside a complex (potentially
 
139
     * self-intersecting) path. The current fill rule affects both <tt>fill</tt>
 
140
     * and <tt>clip</tt>.
 
141
     * 
 
142
     * @param fillrule
 
143
     */
 
144
    public void setFillRule(FillRule fillrule) {
 
145
        cairo_set_fill_rule(getHandle(), fillrule.getValue());
 
146
    }
 
147
 
 
148
    /**
 
149
     * Sets the current line width within the cairo context. The line width
 
150
     * specifies the diameter of a pen that is circular in user-space.
 
151
     * 
 
152
     * As with the other stroke parameters, the current line cap style is
 
153
     * examined by <tt>stroke()</tt>, <tt>strokeExtents()</tt>, and
 
154
     * <tt>strokeToPath(), but does not have any effect during path
 
155
     * construction.
 
156
     * @param width
 
157
     */
 
158
    public void setLineWidth(double width) {
 
159
        cairo_set_line_width(getHandle(), width);
 
160
    }
 
161
 
 
162
    /**
 
163
     * Sets the current line cap style within the cairo context. See
 
164
     * <tt>LineCap</tt> for details about how the available line cap styles
 
165
     * are drawn.
 
166
     * 
 
167
     * @param linecap
 
168
     */
 
169
    public void setLineCap(LineCap linecap) {
 
170
        cairo_set_line_cap(getHandle(), linecap.getValue());
 
171
    }
 
172
 
 
173
    /**
 
174
     * Sets the current line join style within the cairo context. See
 
175
     * <tt>LineJoin</tt> for details about how the available line join styles
 
176
     * are drawn.
 
177
     * 
 
178
     * @param linejoin
 
179
     */
 
180
    public void setLineJoin(LineJoin linejoin) {
 
181
        cairo_set_line_join(getHandle(), linejoin.getValue());
 
182
    }
 
183
 
 
184
    /**
 
185
     * Sets the line dash.
 
186
     * 
 
187
     * @param dashes
 
188
     * @param offset
 
189
     */
 
190
    public void setDash(double[] dashes, double offset) {
 
191
        cairo_set_dash(getHandle(), dashes, offset);
 
192
    }
 
193
 
 
194
    /**
 
195
     * Sets the miter limit.
 
196
     * 
 
197
     * @param limit
 
198
     */
 
199
    public void setMiterLimit(double limit) {
 
200
        cairo_set_miter_limit(getHandle(), limit);
 
201
    }
 
202
 
 
203
    /**
 
204
     * Modifies the current transformation matrix (CTM) by tanslating the
 
205
     * user-space origin by (tx, ty). This offset is interpreted as a user-space
 
206
     * coordinate according to the CTM in place before the new call to
 
207
     * translate. In other words, the translation of the user-space origin takes
 
208
     * place after any existing transformation.
 
209
     * 
 
210
     * @param tx
 
211
     * @param ty
 
212
     */
 
213
    public void translate(double tx, double ty) {
 
214
        cairo_translate(getHandle(), tx, ty);
 
215
    }
 
216
 
 
217
    /**
 
218
     * Modifies the current transformation matrix (CTM) by scaling the X and Y
 
219
     * user-space axes by sx and sy respectively. The scaling of the axes takes
 
220
     * place after any existing transformation of user space.
 
221
     * 
 
222
     * @param sx
 
223
     * @param sy
 
224
     */
 
225
    public void scale(double sx, double sy) {
 
226
        cairo_scale(getHandle(), sx, sy);
 
227
    }
 
228
 
 
229
    /**
 
230
     * Modifies the current transformation matrix (CTM) by rotating the
 
231
     * user-space axes by angle radians. The rotation of the axes takes places
 
232
     * after any existing transformation of user space. The rotation direction
 
233
     * for positive angles is from the positive X axis toward the positive Y
 
234
     * axis.
 
235
     * 
 
236
     * @param angle
 
237
     */
 
238
    public void rotate(double angle) {
 
239
        cairo_rotate(getHandle(), angle);
 
240
    }
 
241
 
 
242
    /**
 
243
     * Modifies the current transformation matrix (CTM) by applying matrix as an
 
244
     * additional transformation. The new transformation of user space takes
 
245
     * place after any existing transformation.
 
246
     * 
 
247
     * @param matrix
 
248
     *            the transformation matrix to append
 
249
     */
 
250
    public void transform(Matrix matrix) {
 
251
        cairo_transform(getHandle(), matrix.getHandle());
 
252
    }
 
253
 
 
254
    /**
 
255
     * Modifies the current transformation matrix (CTM) by setting it equal to
 
256
     * matrix.
 
257
     * 
 
258
     * @param matrix
 
259
     *            the transformation matrix
 
260
     */
 
261
    public void setMatrix(Matrix matrix) {
 
262
        cairo_set_matrix(getHandle(), matrix.getHandle());
 
263
    }
 
264
 
 
265
    /**
 
266
     * Resets the current transformation matrix (CTM) by setting it equal to the
 
267
     * identity matrix. That is, the user-space and device-space axes will be
 
268
     * aligned and one user-space unit will transform to one device-space unit.
 
269
     */
 
270
    public void identityMatrix() {
 
271
        cairo_identity_matrix(getHandle());
 
272
    }
 
273
 
 
274
    /**
 
275
     * Transform a coordinate from user space to device space by multiplying the
 
276
     * given point by the current transformation matrix (CTM).
 
277
     */
 
278
    public Point userToDevice(Point point) {
 
279
        double[] px = new double[] { point.getX() };
 
280
        double[] py = new double[] { point.getY() };
 
281
        cairo_user_to_device(getHandle(), px, py);
 
282
        return new Point(px[0], py[0]);
 
283
    }
 
284
 
 
285
    /**
 
286
     * Transform a distance vector from user space to device space. This
 
287
     * function is similar to userToDevice() except that the translation
 
288
     * components of the CTM will be ignored when transforming the Point.
 
289
     */
 
290
    public Point userToDeviceDistance(Point distance) {
 
291
        double[] dx = new double[] { distance.getX() };
 
292
        double[] dy = new double[] { distance.getY() };
 
293
        cairo_user_to_device_distance(getHandle(), dx, dy);
 
294
        return new Point(dx[0], dy[0]);
 
295
    }
 
296
 
 
297
    /**
 
298
     * Transform a coordinate from device space to user space by multiplying the
 
299
     * given point by the inverse of the current transformation matrix (CTM).
 
300
     */
 
301
    public Point deviceToUser(Point point) {
 
302
        double[] px = new double[] { point.getX() };
 
303
        double[] py = new double[] { point.getY() };
 
304
        cairo_device_to_user(getHandle(), px, py);
 
305
        return new Point(px[0], py[0]);
 
306
    }
 
307
 
 
308
    /**
 
309
     * Transform a distance vector from device space to user space. This
 
310
     * function is similar to deviceToUser() except that the translation
 
311
     * components of the inverse CTM will be ignored when transforming the
 
312
     * Point.
 
313
     */
 
314
    public Point deviceToUserDistance(Point distance) {
 
315
        double[] dx = new double[] { distance.getX() };
 
316
        double[] dy = new double[] { distance.getY() };
 
317
        cairo_device_to_user_distance(getHandle(), dx, dy);
 
318
        return new Point(dx[0], dy[0]);
 
319
    }
 
320
 
 
321
    /**
 
322
     * Starts a new path. You can add path segments to this path using the path
 
323
     * extension methods (xxxxTo()).
 
324
     */
 
325
    public void newPath() {
 
326
        cairo_new_path(getHandle());
 
327
    }
 
328
 
 
329
    /**
 
330
     * Moves the current point in the path to the given co-ordinates.
 
331
     * 
 
332
     * @param p
 
333
     *            the point co-ordinate of the point to move to
 
334
     */
 
335
    public void moveTo(Point p) {
 
336
        cairo_move_to(getHandle(), p.getX(), p.getY());
 
337
    }
 
338
 
 
339
    public void moveTo(double x, double y) {
 
340
        cairo_move_to(getHandle(), x, y);
 
341
    }
 
342
 
 
343
    /**
 
344
     * Draws a line segment as part of the current path. The line is drawn from
 
345
     * the current point of the path to the new co-ordinates.
 
346
     * 
 
347
     * @param p
 
348
     *            the point coordinate for the end point for the line segment
 
349
     */
 
350
    public void lineTo(Point p) {
 
351
        cairo_line_to(getHandle(), p.getX(), p.getY());
 
352
    }
 
353
 
 
354
    public void lineTo(double x, double y) {
 
355
        cairo_line_to(getHandle(), x, y);
 
356
    }
 
357
 
 
358
    /**
 
359
     * Draws a cubic bezier curve from the current point to (x3, y3) using 2
 
360
     * control points (x1, y1) and (x2, y2).
 
361
     * 
 
362
     * @param p1
 
363
     *            x co-ordinate of the first control point
 
364
     * @param p2
 
365
     *            x co-ordinate of the second control point
 
366
     * @param p3
 
367
     *            x co-ordinate of the end point
 
368
     */
 
369
    public void curveTo(Point p1, Point p2, Point p3) {
 
370
        cairo_curve_to(getHandle(), p1.getX(), p1.getY(), p2.getX(), p2.getY(),
 
371
                p3.getX(), p3.getY());
 
372
    }
 
373
 
 
374
    public void curveTo(double x1, double y1, double x2, double y2, double x3,
 
375
            double y3) {
 
376
        cairo_curve_to(getHandle(), x1, y1, x2, y2, x3, y3);
 
377
    }
 
378
 
 
379
    /**
 
380
     * Adds an arc from angle1 to angle2 to the current path. If there is a
 
381
     * current point, that point is connected to the start of the arc by a
 
382
     * straight line segment. Angles are measured in radians with an angle of 0
 
383
     * along the X axis and an angle of %M_PI radians (90 degrees) along the Y
 
384
     * axis, so with the default transformation matrix, positive angles are
 
385
     * clockwise. (To convert from degrees to radians, use <literal>degrees *
 
386
     * (M_PI / 180.)</literal>.) This function gives the arc in the direction
 
387
     * of increasing angle; see arcNegative() to get the arc in the direction of
 
388
     * decreasing angle.
 
389
     * 
 
390
     * A full arc is drawn as a circle. To make an oval arc, you can scale the
 
391
     * current transformation matrix by different amounts in the X and Y
 
392
     * directions.
 
393
     * 
 
394
     * @param point
 
395
     * @param radius
 
396
     * @param angle1
 
397
     * @param angle2
 
398
     */
 
399
    public void arc(Point point, double radius, double angle1, double angle2) {
 
400
        cairo_arc(getHandle(), point.getX(), point.getY(), radius, angle1,
 
401
                angle2);
 
402
    }
 
403
 
 
404
    public void arc(double x, double y, double radius, double angle1,
 
405
            double angle2) {
 
406
        cairo_arc(getHandle(), x, y, radius, angle1, angle2);
 
407
    }
 
408
 
 
409
    /**
 
410
     * Adds an arc from angle1 to angle2 to the current path. The function
 
411
     * behaves identically to <tt>arc()</tt> except that instead of giving the
 
412
     * arc in the direction of increasing angle, it gives the arc in the
 
413
     * direction of decreasing angle.
 
414
     * 
 
415
     * @param point
 
416
     * @param radius
 
417
     * @param angle1
 
418
     * @param angle2
 
419
     */
 
420
    public void arcNegative(Point point, double radius, double angle1,
 
421
            double angle2) {
 
422
        cairo_arc_negative(getHandle(), point.getX(), point.getY(), radius,
 
423
                angle1, angle2);
 
424
    }
 
425
 
 
426
    public void arcNegative(double x, double y, double radius, double angle1,
 
427
            double angle2) {
 
428
        cairo_arc_negative(getHandle(), x, y, radius, angle1, angle2);
 
429
    }
 
430
 
 
431
    /**
 
432
     * Moves to the current path to a new point. The co-ordinates of the new
 
433
     * point are given in relation to the current point of the state.
 
434
     * 
 
435
     * @param p
 
436
     *            relative distance between current point and the new point
 
437
     */
 
438
    public void relMoveTo(Point p) {
 
439
        cairo_rel_move_to(getHandle(), p.getX(), p.getY());
 
440
    }
 
441
 
 
442
    public void relMoveTo(double x, double y) {
 
443
        cairo_rel_move_to(getHandle(), x, y);
 
444
    }
 
445
 
 
446
    /**
 
447
     * Draws a line segment as part of the current path. The line is drawn from
 
448
     * the current point of the path to the new co-ordinates. The new
 
449
     * co-ordinates are given relative to the current point.
 
450
     * 
 
451
     * @param p
 
452
     *            The relative coordinate for the end point for the line segment
 
453
     */
 
454
    public void relLineTo(Point p) {
 
455
        cairo_rel_line_to(getHandle(), p.getX(), p.getY());
 
456
    }
 
457
 
 
458
    public void relLineTo(double x, double y) {
 
459
        cairo_rel_line_to(getHandle(), x, y);
 
460
    }
 
461
 
 
462
    /**
 
463
     * Draws a cubic bezier curve from the current point to p3 using 2 control
 
464
     * points p1 and p2. The co-ordinates are specified relative to current
 
465
     * point in the path.
 
466
     * 
 
467
     * @param p1
 
468
     *            relative co-ordinate of the first control point
 
469
     * @param p2
 
470
     *            relative co-ordinate of the second control point
 
471
     * @param p3
 
472
     *            relative co-ordinate of the end point
 
473
     */
 
474
    public void relCurveTo(Point p1, Point p2, Point p3) {
 
475
        cairo_rel_curve_to(getHandle(), p1.getX(), p1.getY(), p2.getX(), p2
 
476
                .getY(), p3.getX(), p3.getY());
 
477
    }
 
478
 
 
479
    public void relCurveTo(double x1, double y1, double x2, double y2,
 
480
            double x3, double y3) {
 
481
        cairo_rel_curve_to(getHandle(), x1, y1, x2, y2, x3, y3);
 
482
    }
 
483
 
 
484
    /**
 
485
     * Draws a rectangle defined by the upper-left point p1 and the
 
486
     * lower-right point p2.
 
487
     * 
 
488
     * @param upperLeft
 
489
     *            x and y coordinates of the upper-left point
 
490
     * @param lowerRight
 
491
     *            x and y coordinates of the lower-right point
 
492
     */
 
493
    public void rectangle(Point upperLeft, Point lowerRight) {
 
494
        Rectangle r = new Rectangle(upperLeft, lowerRight);
 
495
        rectangle(r);
 
496
    }
 
497
 
 
498
    /**
 
499
     * Draws a rectangle defined by the Rectangle object rect.
 
500
     * 
 
501
     * @param rect
 
502
     *            Rectangle defining the coordinate of the shape to draw
 
503
     */
 
504
    public void rectangle(Rectangle rect) {
 
505
        cairo_rectangle(getHandle(), rect.getX(), rect.getY(), rect.getWidth(),
 
506
                rect.getHeight());
 
507
    }
 
508
 
 
509
    /**
 
510
     * Closes the current path by connecting current point to the starting point
 
511
     * with a line segment.
 
512
     */
 
513
    public void closePath() {
 
514
        cairo_close_path(getHandle());
 
515
    }
 
516
 
 
517
    /**
 
518
     * A drawing operator that paints the current source everywhere within the
 
519
     * current clip region.
 
520
     */
 
521
    public void paint() {
 
522
        cairo_paint(getHandle());
 
523
    }
 
524
 
 
525
    /**
 
526
     * A drawing operator that paints the current source everywhere within the
 
527
     * current clip region using a mask of constant alpha value alpha. The
 
528
     * effect is similar to <tt>paint()</tt>, but the drawing is faded out
 
529
     * using the alpha value.
 
530
     * 
 
531
     * @param alpha
 
532
     */
 
533
    public void paintWithAlpha(double alpha) {
 
534
        cairo_paint_with_alpha(getHandle(), alpha);
 
535
    }
 
536
 
 
537
    /**
 
538
     * A drawing operator that paints the current source using the alpha channel
 
539
     * of pattern as a mask. (Opaque areas of mask are painted with the source,
 
540
     * transparent areas are not painted.)
 
541
     * 
 
542
     * @param pattern
 
543
     */
 
544
    public void mask(Pattern pattern) {
 
545
        cairo_mask(getHandle(), pattern.getHandle());
 
546
    }
 
547
 
 
548
    /**
 
549
     * A drawing operator that paints the current source using the alpha channel
 
550
     * of surface as a mask. (Opaque areas of surface are painted with the
 
551
     * source, transparent areas are not painted.)
 
552
     * 
 
553
     * @param surface
 
554
     * @param sx
 
555
     * @param sy
 
556
     */
 
557
    public void mask(Surface surface, double sx, double sy) {
 
558
        cairo_mask_surface(getHandle(), surface.getHandle(), sx, sy);
 
559
    }
 
560
 
 
561
    /**
 
562
     * A drawing operator that strokes the current path according to the current
 
563
     * line width, line join, line cap, and dash settings. After stroke, the
 
564
     * current path will be cleared from the cairo context.
 
565
     */
 
566
    public void stroke() {
 
567
        cairo_stroke(getHandle());
 
568
    }
 
569
 
 
570
    /**
 
571
     * A drawing operator that strokes the current path according to the current
 
572
     * line width, line join, line cap, and dash settings. Unlike stroke(),
 
573
     * strokePreserve preserves the path within the cairo context.
 
574
     */
 
575
    public void strokePreserve() {
 
576
        cairo_stroke_preserve(getHandle());
 
577
    }
 
578
 
 
579
    /**
 
580
     * A drawing operator that fills the current path according to the current
 
581
     * fill rule. After fill, the current path will be cleared from the cairo
 
582
     * context.
 
583
     */
 
584
    public void fill() {
 
585
        cairo_fill(getHandle());
 
586
    }
 
587
 
 
588
    /**
 
589
     * A drawing operator that fills the current path according to the current
 
590
     * fill rule. Unlike fill(), fillPreserve preserves the path within the
 
591
     * cairo context.
 
592
     */
 
593
    public void fillPreserve() {
 
594
        cairo_fill_preserve(getHandle());
 
595
    }
 
596
 
 
597
    public void copyPage() {
 
598
        cairo_copy_page(getHandle());
 
599
    }
 
600
 
 
601
    public void showPage() {
 
602
        cairo_show_page(getHandle());
 
603
    }
 
604
 
 
605
    /**
 
606
     * Determines whether the point specified by (x, y) lies inside
 
607
     * the area bounded by the current path, including the path's
 
608
     * stroke area.
 
609
     *
 
610
     * @param x
 
611
     *            x coordinate of the point to test
 
612
     * @param y
 
613
     *            y coordinate of the point to test
 
614
     */
 
615
    public boolean inStroke(double x, double y) {
 
616
        return cairo_in_stroke(getHandle(), x, y);
 
617
    }
 
618
 
 
619
    public boolean inStroke(Point p) {
 
620
        return cairo_in_stroke(getHandle(), p.getX(), p.getY());
 
621
    }
 
622
 
 
623
    /**
 
624
     * Determines whether the point specified by (x, y) lies inside
 
625
     * the area bounded by the current path, excluding the path's
 
626
     * stroke area.
 
627
     *
 
628
     * @param x
 
629
     *            x coordinate of the point to test
 
630
     * @param y
 
631
     *            y coordinate of the point to test
 
632
     */
 
633
    public boolean inFill(double x, double y) {
 
634
        return cairo_in_fill(getHandle(), x, y);
 
635
    }
 
636
 
 
637
    public boolean inFill(Point p) {
 
638
        return cairo_in_fill(getHandle(), p.getX(), p.getY());
 
639
    }
 
640
 
 
641
    public Rectangle strokeExtents() {
 
642
        double[] x1 = new double[1];
 
643
        double[] y1 = new double[1];
 
644
        double[] x2 = new double[1];
 
645
        double[] y2 = new double[1];
 
646
        cairo_stroke_extents(getHandle(), x1, y1, x2, y2);
 
647
        return new Rectangle(x1[0], y1[0], x2[0], y2[0]);
 
648
    }
 
649
 
 
650
    public Rectangle fillExtents() {
 
651
        double[] x1 = new double[1];
 
652
        double[] y1 = new double[1];
 
653
        double[] x2 = new double[1];
 
654
        double[] y2 = new double[1];
 
655
        cairo_fill_extents(getHandle(), x1, y1, x2, y2);
 
656
        return new Rectangle(x1[0], y1[0], x2[0], y2[0]);
 
657
    }
 
658
 
 
659
    /**
 
660
     * Reset the current clip region to its original, unrestricted state. That
 
661
     * is, set the clip region to an infinitely large shape containing the
 
662
     * target surface. Equivalently, if infinity is too hard to grasp, one can
 
663
     * imagine the clip region being reset to the exact bounds of the target
 
664
     * surface.
 
665
     * 
 
666
     * Note that code meant to be reusable should not call resetClip() as it
 
667
     * will cause results unexpected by higher-level code which calls clip().
 
668
     * Consider using save() and restore() around clip() as a more robust means
 
669
     * of temporarily restricting the clip region.
 
670
     */
 
671
    public void resetClip() {
 
672
        cairo_reset_clip(getHandle());
 
673
    }
 
674
 
 
675
    /**
 
676
     * Establishes a new clip region by intersecting the current clip region
 
677
     * with the current path as it would be filled by fill() and according to
 
678
     * the current fill rule (see setFillRule()).
 
679
     * 
 
680
     * After clip, the current path will be cleared from the cairo context.
 
681
     * 
 
682
     * The current clip region affects all drawing operations by effectively
 
683
     * masking out any changes to the surface that are outside the current clip
 
684
     * region.
 
685
     * 
 
686
     * Calling clip() can only make the clip region smaller, never larger. But
 
687
     * the current clip is part of the graphics state, so a tempoarary
 
688
     * restriction of the clip region can be achieved by calling clip() within a
 
689
     * save()/restore() pair. The only other means of increasing the size of the
 
690
     * clip region is resetClip().
 
691
     */
 
692
    public void clip() {
 
693
        cairo_clip(getHandle());
 
694
    }
 
695
 
 
696
    /**
 
697
     * Establishes a new clip region by intersecting the current clip region
 
698
     * with the current path as it would be filled by fill() and according to
 
699
     * the current fill rule (see setFillRule()).
 
700
     * 
 
701
     * Unlike clip(), clipPreserve preserves the path within the cairo context.
 
702
     * 
 
703
     * The current clip region affects all drawing operations by effectively
 
704
     * masking out any changes to the surface that are outside the current clip
 
705
     * region.
 
706
     * 
 
707
     * Calling clip() can only make the clip region smaller, never larger. But
 
708
     * the current clip is part of the graphics state, so a tempoarary
 
709
     * restriction of the clip region can be achieved by calling clip() within a
 
710
     * save()/restore() pair. The only other means of increasing the size of the
 
711
     * clip region is resetClip().
 
712
     */
 
713
    public void clipPreserve() {
 
714
        cairo_clip_preserve(getHandle());
 
715
    }
 
716
 
 
717
    /**
 
718
     * Selects a family and style of font from a simplified description as a
 
719
     * family name, slant and weight. This method is meant to be used only for
 
720
     * applications with simple font needs: Cairo doesn't provide for operations
 
721
     * such as listing all available fonts on the system, and it is expected
 
722
     * that most applications will need to use a more comprehensive font
 
723
     * handling and text layout library in addition to Cairo.
 
724
     * 
 
725
     * @param family
 
726
     *            font family name
 
727
     * @param slant
 
728
     *            font slant
 
729
     * @param weight
 
730
     *            font weight
 
731
     */
 
732
    public void selectFontFace(String family, FontSlant slant, FontWeight weight) {
 
733
        cairo_select_font_face(getHandle(), family, slant.getValue(), weight
 
734
                .getValue());
 
735
    }
 
736
 
 
737
    /**
 
738
     * Sets the current font matrix to a scale by a factor of size, replacing
 
739
     * any font matrix previously set with cairo_setFontSize() or
 
740
     * setFontMatrix(). This results in a font size of size user space units.
 
741
     * (More precisely, this matrix will result in the font's em-square being a
 
742
     * size by size square in user space.)
 
743
     * 
 
744
     * @param scale
 
745
     *            the scaling factor.
 
746
     */
 
747
    public void setFontSize(double scale) {
 
748
        cairo_set_font_size(getHandle(), scale);
 
749
    }
 
750
 
 
751
    /**
 
752
     * Sets the current font matrix to matrix. The font matrix gives a
 
753
     * transformation from the design space of the font (in this space, the
 
754
     * em-square is 1 unit by 1 unit) to user space. Normally, a simple scale is
 
755
     * used (see setFontSize()), but a more complex font matrix can be used to
 
756
     * shear the font or stretch it unequally along the two axes
 
757
     * 
 
758
     * @param matrix
 
759
     *            transformation matrix.
 
760
     */
 
761
    public void setFontMatrix(Matrix matrix) {
 
762
        cairo_set_font_matrix(getHandle(), matrix.getHandle());
 
763
    }
 
764
 
 
765
    /**
 
766
     * Gets the current font matrix. See setFontMatrix()
 
767
     * 
 
768
     * @return the current font matrix
 
769
     */
 
770
    public Matrix getFontMatrix() {
 
771
        return new Matrix(cairo_get_font_matrix(getHandle()));
 
772
    }
 
773
 
 
774
    /**
 
775
     * Draws the given text on the screen.
 
776
     * 
 
777
     * @param text
 
778
     *            String to draw on the screen.
 
779
     */
 
780
    public void showText(String text) {
 
781
        cairo_show_text(getHandle(), text);
 
782
    }
 
783
 
 
784
    public void showGlyphs(Glyph[] glyphs) {
 
785
        if (null == glyphs || glyphs.length < 1)
 
786
            return;
 
787
        Handle[] hndls = new Handle[glyphs.length];
 
788
        for (int i = 0; i < glyphs.length; i++)
 
789
            hndls[i] = glyphs[i].getHandle();
 
790
        cairo_show_glyphs(getHandle(), hndls);
 
791
    }
 
792
 
 
793
    /**
 
794
     * Gets the current font face.
 
795
     */
 
796
    public FontFace getFontFace() {
 
797
        return new FontFace(cairo_get_font_face(getHandle()));
 
798
    }
 
799
 
 
800
    /**
 
801
     * Gets the font extents for the currently selected font.
 
802
     */
 
803
    public FontExtents fontExtents() {
 
804
        Handle hndl = Struct.getNullHandle();
 
805
        cairo_font_extents(getHandle(), hndl);
 
806
        return new FontExtents(hndl);
 
807
    }
 
808
 
 
809
    /**
 
810
     * Replaces the current FontFace object in the context with fontFace. The
 
811
     * replaced font face in the context will be destroyed if there are no other
 
812
     * references to it.
 
813
     * 
 
814
     * @param fontFace
 
815
     */
 
816
    public void setFontFace(FontFace fontFace) {
 
817
        cairo_set_font_face(getHandle(), fontFace.getHandle());
 
818
    }
 
819
 
 
820
    /**
 
821
     * Gets the extents for a string of text. The extents describe a user-space
 
822
     * rectangle that encloses the "inked" portion of the text, (as it would be
 
823
     * drawn by showText). Additionally, the xAdvance and yAdvance values
 
824
     * indicate the amount by which the current point would be advanced by
 
825
     * showText.
 
826
     * 
 
827
     * Note that whitespace characters do not directly contribute to the size of
 
828
     * the rectangle (extents.width and extents.height). They do contribute
 
829
     * indirectly by changing the position of non-whitespace characters. In
 
830
     * particular, trailing whitespace characters are likely to not affect the
 
831
     * size of the rectangle, though they will affect the xAdvance and yAdvance
 
832
     * values.
 
833
     */
 
834
    public TextExtents textExtents(String text) {
 
835
        Handle hndl = Struct.getNullHandle();
 
836
        cairo_text_extents(getHandle(), text, hndl);
 
837
        return new TextExtents(hndl);
 
838
    }
 
839
 
 
840
    /**
 
841
     * Gets the extents for an array of glyphs. The extents describe a
 
842
     * user-space rectangle that encloses the "inked" portion of the glyphs, (as
 
843
     * they would be drawn by showGlyphs). Additionally, the xAdvance and
 
844
     * yAdvance values indicate the amount by which the current point would be
 
845
     * advanced by cairo_show_glyphs.
 
846
     * 
 
847
     * Note that whitespace glyphs do not contribute to the size of the
 
848
     * rectangle (extents.width and extents.height).
 
849
     */
 
850
    public TextExtents glyphExtents(Glyph[] glyphs) {
 
851
        Handle hndl = Struct.getNullHandle();
 
852
        Handle[] gHndls = new Handle[glyphs.length];
 
853
        for (int i = 0; i < glyphs.length; i++)
 
854
            gHndls[i] = glyphs[i].getHandle();
 
855
        cairo_glyph_extents(getHandle(), gHndls, hndl);
 
856
        return new TextExtents(hndl);
 
857
    }
 
858
 
 
859
    public void textPath(String text) {
 
860
        cairo_text_path(getHandle(), text);
 
861
    }
 
862
 
 
863
    public void glyphPath(Glyph[] glyphs) {
 
864
        Handle[] gHndls = new Handle[glyphs.length];
 
865
        for (int i = 0; i < glyphs.length; i++)
 
866
            gHndls[i] = glyphs[i].getHandle();
 
867
        cairo_glyph_path(getHandle(), gHndls);
 
868
    }
 
869
 
 
870
    /**
 
871
     * Returns the current surface operator
 
872
     * 
 
873
     * @return The surface operator.
 
874
     */
 
875
    public Operator getOperator() {
 
876
        return Operator.intern(cairo_get_operator(getHandle()));
 
877
    }
 
878
 
 
879
    /**
 
880
     * Gets the current source pattern for this object.
 
881
     */
 
882
    public Pattern getSource() {
 
883
        Handle hndl = cairo_get_source(getHandle());
 
884
        return new Pattern(hndl);
 
885
    }
 
886
 
 
887
    /**
 
888
     * Returns the tesselation tolerance of the current state.
 
889
     * 
 
890
     * @return tesselation tolerance
 
891
     */
 
892
    public double getTolerance() {
 
893
        return cairo_get_tolerance(getHandle());
 
894
    }
 
895
 
 
896
    /**
 
897
     * Returns the current point of the surface.
 
898
     * 
 
899
     * The current point is returned in the user-space coordinate system. If
 
900
     * there is no defined current point then Point will be set to (0,0)
 
901
     * 
 
902
     * @return Current point for drawing
 
903
     */
 
904
    public Point getCurrentPoint() {
 
905
        double[] x = new double[1];
 
906
        double[] y = new double[1];
 
907
        cairo_get_current_point(getHandle(), x, y);
 
908
        return new Point(x[0], y[0]);
 
909
    }
 
910
 
 
911
    /**
 
912
     * Gets the current fill rule, as set by setFillRule().
 
913
     */
 
914
    public FillRule getFillRule() {
 
915
        return FillRule.intern(cairo_get_fill_rule(getHandle()));
 
916
    }
 
917
 
 
918
    /**
 
919
     * Returns the stroke line width.
 
920
     * 
 
921
     * @return The stroke line width
 
922
     */
 
923
    public double getLineWidth() {
 
924
        return cairo_get_line_width(getHandle());
 
925
    }
 
926
 
 
927
    /**
 
928
     * Returns current linecap style.
 
929
     * 
 
930
     * @return The line cap style
 
931
     */
 
932
    public LineCap getLineCap() {
 
933
        return LineCap.intern(cairo_get_line_cap(getHandle()));
 
934
    }
 
935
 
 
936
    /**
 
937
     * Return current line join style.
 
938
     * 
 
939
     * @return Line join style
 
940
     */
 
941
    public LineJoin getLineJoin() {
 
942
        return LineJoin.intern(cairo_get_line_join(getHandle()));
 
943
    }
 
944
 
 
945
    /**
 
946
     * Returns the miter limit for miter style line joins
 
947
     * 
 
948
     * @return The miter limit
 
949
     */
 
950
    public double getMiterLimit() {
 
951
        return cairo_get_miter_limit(getHandle());
 
952
    }
 
953
 
 
954
    /**
 
955
     * Returns the current transformation matrix
 
956
     * 
 
957
     * @return the current transformation matrix
 
958
     */
 
959
    public Matrix getMatrix() {
 
960
        Handle handle = cairo_get_matrix(getHandle());
 
961
        return new Matrix(handle);
 
962
    }
 
963
 
 
964
    /**
 
965
     * Gets the target surface for the cairo context as passed to the
 
966
     * constructor.
 
967
     * 
 
968
     * @return the target surface
 
969
     */
 
970
    public Surface getTarget() {
 
971
        return new Surface(cairo_get_target(getHandle()));
 
972
    }
 
973
 
 
974
    public Status status() {
 
975
        return Status.intern(cairo_status(getHandle()));
 
976
    }
 
977
 
 
978
    public void setAntialias(Antialias antialias) {
 
979
        cairo_set_antialias(getHandle(), antialias.getValue());
 
980
    }
 
981
 
 
982
    public Antialias getAntialias() {
 
983
        return Antialias.intern(cairo_get_antialias(getHandle()));
 
984
    }
 
985
 
 
986
    public void setFontOptions(FontOptions fontOptions) {
 
987
        cairo_set_font_options(getHandle(), fontOptions.getHandle());
 
988
    }
 
989
 
 
990
    public FontOptions getFontOptions() {
 
991
        return new FontOptions(cairo_get_font_options(getHandle()));
 
992
    }
 
993
 
 
994
    /** Constant use for drawing ellipse */
 
995
    private static final double SVG_ARC_MAGIC = 0.5522847498;
 
996
 
 
997
    /**
 
998
     * Creates an ellipse path.
 
999
     * 
 
1000
     * @param cx
 
1001
     *            X co-ordinate of the center of ellipse
 
1002
     * @param cy
 
1003
     *            Y co-ordinate of the center of ellipse
 
1004
     * @param rx
 
1005
     *            X radius of the ellipse
 
1006
     * @param ry
 
1007
     *            Y radius of the ellipse
 
1008
     */
 
1009
    public void ellipse(double cx, double cy, double rx, double ry) {
 
1010
 
 
1011
        /* approximate an ellipse using 4 bezier curves */
 
1012
        cairo_new_path(getHandle());
 
1013
        cairo_move_to(getHandle(), cx + rx, cy);
 
1014
        cairo_curve_to(getHandle(), cx + rx, cy + ry * SVG_ARC_MAGIC, cx + rx
 
1015
                * SVG_ARC_MAGIC, cy + ry, cx, cy + ry);
 
1016
        cairo_curve_to(getHandle(), cx - rx * SVG_ARC_MAGIC, cy + ry, cx - rx,
 
1017
                cy + ry * SVG_ARC_MAGIC, cx - rx, cy);
 
1018
        cairo_curve_to(getHandle(), cx - rx, cy - ry * SVG_ARC_MAGIC, cx - rx
 
1019
                * SVG_ARC_MAGIC, cy - ry, cx, cy - ry);
 
1020
        cairo_curve_to(getHandle(), cx + rx * SVG_ARC_MAGIC, cy - ry, cx + rx,
 
1021
                cy - ry * SVG_ARC_MAGIC, cx + rx, cy);
 
1022
        cairo_close_path(getHandle());
 
1023
    }
 
1024
 
 
1025
    /*
 
1026
     * Native calls
 
1027
     */
 
1028
    native static final private Handle cairo_create(Handle surface);
 
1029
 
 
1030
    native static final private void cairo_destroy(Handle obj);
 
1031
 
 
1032
    native static final private void cairo_save(Handle obj);
 
1033
 
 
1034
    native static final private void cairo_restore(Handle obj);
 
1035
 
 
1036
    native static final private void cairo_set_operator(Handle obj, int operator);
 
1037
 
 
1038
    native static final private void cairo_set_source(Handle obj, Handle pattern);
 
1039
 
 
1040
    native static final private void cairo_set_source_rgb(Handle obj,
 
1041
            double red, double green, double blue);
 
1042
 
 
1043
    native static final private void cairo_set_source_rgba(Handle object,
 
1044
            double red, double green, double glue, double alpha);
 
1045
 
 
1046
    native static final private void cairo_set_source_surface(Handle object,
 
1047
            Handle surface, double x, double y);
 
1048
 
 
1049
    native static final private void cairo_set_tolerance(Handle obj,
 
1050
            double tolerance);
 
1051
 
 
1052
    native static final private void cairo_set_fill_rule(Handle obj,
 
1053
            int fillRule);
 
1054
 
 
1055
    native static final private void cairo_set_line_width(Handle obj,
 
1056
            double width);
 
1057
 
 
1058
    native static final private void cairo_set_line_cap(Handle obj, int lineCap);
 
1059
 
 
1060
    native static final private void cairo_set_line_join(Handle obj,
 
1061
            int lineJoin);
 
1062
 
 
1063
    native static final private void cairo_set_dash(Handle obj,
 
1064
            double[] dashes, double offset);
 
1065
 
 
1066
    native static final private void cairo_set_miter_limit(Handle obj,
 
1067
            double limit);
 
1068
 
 
1069
    native static final private void cairo_translate(Handle obj, double tx,
 
1070
            double ty);
 
1071
 
 
1072
    native static final private void cairo_scale(Handle obj, double sx,
 
1073
            double sy);
 
1074
 
 
1075
    native static final private void cairo_rotate(Handle obj, double angle);
 
1076
 
 
1077
    native static final private void cairo_transform(Handle obj, Handle matrix);
 
1078
 
 
1079
    native static final private void cairo_set_matrix(Handle obj, Handle matrix);
 
1080
 
 
1081
    native static final private void cairo_identity_matrix(Handle obj);
 
1082
 
 
1083
    native static final private void cairo_user_to_device(Handle obj,
 
1084
            double[] x, double[] y);
 
1085
 
 
1086
    native static final private void cairo_user_to_device_distance(Handle obj,
 
1087
            double[] dx, double[] dy);
 
1088
 
 
1089
    native static final private void cairo_device_to_user(Handle obj,
 
1090
            double[] x, double[] y);
 
1091
 
 
1092
    native static final private void cairo_device_to_user_distance(Handle obj,
 
1093
            double[] dx, double[] dy);
 
1094
 
 
1095
    native static final private void cairo_new_path(Handle obj);
 
1096
 
 
1097
    native static final private void cairo_move_to(Handle obj, double x,
 
1098
            double y);
 
1099
 
 
1100
    native static final private void cairo_line_to(Handle obj, double x,
 
1101
            double y);
 
1102
 
 
1103
    native static final private void cairo_curve_to(Handle obj, double x1,
 
1104
            double y1, double x2, double y2, double x3, double y3);
 
1105
 
 
1106
    native static final private void cairo_arc(Handle obj, double xc,
 
1107
            double yc, double radius, double angle1, double angle2);
 
1108
 
 
1109
    native static final private void cairo_arc_negative(Handle obj, double xc,
 
1110
            double yc, double radius, double angle1, double angle2);
 
1111
 
 
1112
    native static final private void cairo_rel_move_to(Handle obj, double dx,
 
1113
            double dy);
 
1114
 
 
1115
    native static final private void cairo_rel_line_to(Handle obj, double dx,
 
1116
            double dy);
 
1117
 
 
1118
    native static final private void cairo_rel_curve_to(Handle obj, double dx1,
 
1119
            double dy1, double dx2, double dy2, double dx3, double dy3);
 
1120
 
 
1121
    native static final private void cairo_rectangle(Handle obj, double x,
 
1122
            double y, double width, double height);
 
1123
 
 
1124
    native static final private void cairo_close_path(Handle obj);
 
1125
 
 
1126
    native static final private void cairo_paint(Handle obj);
 
1127
 
 
1128
    native static final private void cairo_paint_with_alpha(Handle obj,
 
1129
            double alpha);
 
1130
 
 
1131
    native static final private void cairo_mask(Handle obj, Handle pattern);
 
1132
 
 
1133
    native static final private void cairo_mask_surface(Handle obj,
 
1134
            Handle surface, double sx, double sy);
 
1135
 
 
1136
    native static final private void cairo_stroke(Handle obj);
 
1137
 
 
1138
    native static final private void cairo_stroke_preserve(Handle obj);
 
1139
 
 
1140
    native static final private void cairo_fill(Handle obj);
 
1141
 
 
1142
    native static final private void cairo_fill_preserve(Handle obj);
 
1143
 
 
1144
    native static final private void cairo_copy_page(Handle obj);
 
1145
 
 
1146
    native static final private void cairo_show_page(Handle obj);
 
1147
 
 
1148
    native static final private boolean cairo_in_stroke(Handle obj, double x,
 
1149
            double y);
 
1150
 
 
1151
    native static final private boolean cairo_in_fill(Handle obj, double x,
 
1152
            double y);
 
1153
 
 
1154
    native static final private void cairo_stroke_extents(Handle obj,
 
1155
            double[] x1, double[] y1, double[] x2, double[] y2);
 
1156
 
 
1157
    native static final private void cairo_fill_extents(Handle obj,
 
1158
            double[] x1, double[] y1, double[] x2, double[] y2);
 
1159
 
 
1160
    native static final private void cairo_reset_clip(Handle obj);
 
1161
 
 
1162
    native static final private void cairo_clip(Handle ojb);
 
1163
 
 
1164
    native static final private void cairo_clip_preserve(Handle obj);
 
1165
 
 
1166
    native static final private void cairo_select_font_face(Handle obj,
 
1167
            String family, int slant, int weight);
 
1168
 
 
1169
    native static final private void cairo_set_font_size(Handle obj,
 
1170
            double scale);
 
1171
 
 
1172
    native static final private void cairo_set_font_matrix(Handle obj,
 
1173
            Handle matrix);
 
1174
 
 
1175
    native static final private Handle cairo_get_font_matrix(Handle obj);
 
1176
 
 
1177
    native static final private void cairo_show_text(Handle obj, String utf8);
 
1178
 
 
1179
    native static final private void cairo_show_glyphs(Handle obj,
 
1180
            Handle[] glyphs);
 
1181
 
 
1182
    native static final private Handle cairo_get_font_face(Handle obj);
 
1183
 
 
1184
    native static final private void cairo_font_extents(Handle obj,
 
1185
            Handle extents);
 
1186
 
 
1187
    native static final private void cairo_set_font_face(Handle obj, Handle font);
 
1188
 
 
1189
    native static final private void cairo_text_extents(Handle obj,
 
1190
            String utf8, Handle extents);
 
1191
 
 
1192
    native static final private void cairo_glyph_extents(Handle obj,
 
1193
            Handle[] glyphs, Handle extents);
 
1194
 
 
1195
    native static final private void cairo_text_path(Handle obj, String utf8);
 
1196
 
 
1197
    native static final private void cairo_glyph_path(Handle obj,
 
1198
            Handle[] glyphs);
 
1199
 
 
1200
    native static final private int cairo_get_operator(Handle obj);
 
1201
 
 
1202
    native static final private Handle cairo_get_source(Handle obj);
 
1203
 
 
1204
    native static final private double cairo_get_tolerance(Handle obj);
 
1205
 
 
1206
    native static final private void cairo_get_current_point(Handle obj,
 
1207
            double[] x, double[] y);
 
1208
 
 
1209
    native static final private int cairo_get_fill_rule(Handle obj);
 
1210
 
 
1211
    native static final private double cairo_get_line_width(Handle obj);
 
1212
 
 
1213
    native static final private int cairo_get_line_cap(Handle obj);
 
1214
 
 
1215
    native static final private int cairo_get_line_join(Handle obj);
 
1216
 
 
1217
    native static final private double cairo_get_miter_limit(Handle obj);
 
1218
 
 
1219
    native static final private Handle cairo_get_matrix(Handle obj);
 
1220
 
 
1221
    native static final private Handle cairo_get_target(Handle obj);
 
1222
 
 
1223
    native static final private int cairo_status(Handle obj);
 
1224
 
 
1225
    native static final private void cairo_set_antialias(Handle obj,
 
1226
            int antialias);
 
1227
 
 
1228
    native static final private int cairo_get_antialias(Handle obj);
 
1229
 
 
1230
    native static final private void cairo_set_font_options(Handle obj,
 
1231
            Handle fo);
 
1232
 
 
1233
    native static final private Handle cairo_get_font_options(Handle obj);
 
1234
 
 
1235
    // TODO: add the following
 
1236
    // cairo_path_t *
 
1237
    // cairo_copy_path (cairo_t *cr);
 
1238
    //
 
1239
    // cairo_path_t *
 
1240
    // cairo_copy_path_flat (cairo_t *cr);
 
1241
    //
 
1242
    // void
 
1243
    // cairo_append_path (cairo_t *cr,
 
1244
    // cairo_path_t *path);
 
1245
    //
 
1246
    // void
 
1247
    // cairo_path_destroy (cairo_path_t *path);
 
1248
}