2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = cairo-cairo-t.html
54 * - cairo_surface_t* -> Surface
60 module cairoLib
.Cairo
;
66 import tango
.io
.Stdout
; // use the tango loging?
70 private import gtkc
.cairoLibtypes
;
72 private import gtkc
.cairoLib
;
75 private import cairoLib
.Surface
;
76 private import glib
.Str
;
77 private import gdk
.Region
;
78 private import gdk
.Rectangle
;
79 private import gdk
.Pixbuf
;
80 private import gdk
.Pixmap
;
81 private import gdk
.Color
;
82 private import gtkc
.gdk
;
83 private import gdk
.Drawable
;
90 * cairo_t is the main object used when drawing with cairo. To
91 * draw with cairo, you create a cairo_t, set the target surface,
92 * and drawing options for the cairo_t, create shapes with
93 * functions like cairo_move_to() and cairo_line_to(), and then
94 * draw shapes with cairo_stroke() or cairo_fill().
95 * cairo_t's can be pushed to a stack via cairo_save().
96 * They may then safely be changed, without loosing the current state.
97 * Use cairo_restore() to restore to the saved state.
102 /** the main Gtk struct */
103 protected cairo_t
* cairo
;
106 public cairo_t
* getCairoStruct()
112 /** the main Gtk struct as a void* */
113 protected void* getStruct()
115 return cast(void*)cairo
;
119 * Sets our main struct and passes it to the parent class
121 public this (cairo_t
* cairo
)
130 Stdout("struct cairo is null on constructor").newline
;
134 printf("struct cairo is null on constructor");
141 assert(cairo
!is null, "struct cairo is null on constructor");
147 * Creates a Cairo context for drawing to drawable.
151 * A newly created Cairo context. Free with
152 * cairo_destroy() when you are done drawing.
155 this (Drawable drawable
)
157 // cairo_t* gdk_cairo_create (GdkDrawable *);
158 this(gdk_cairo_create(drawable
.getDrawableStruct()));
162 * Sets the specified GdkColor as the source color of cr.
169 public void setSourceColor(Color color
)
171 // void gdk_cairo_set_source_color (cairo_t *cr, GdkColor *color);
172 gdk_cairo_set_source_color(getCairoStruct(), color
.getColorStruct());
176 * Sets the given pixbuf as the source pattern for the Cairo context.
177 * The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned
178 * so that the origin of pixbuf is pixbuf_x, pixbuf_y
184 * X coordinate of location to place upper left corner of pixbuf
186 * Y coordinate of location to place upper left corner of pixbuf
189 public void setSourcePixbuf(Pixbuf pixbuf
, double pixbufX
, double pixbufY
)
191 // void gdk_cairo_set_source_pixbuf (cairo_t *cr, GdkPixbuf *pixbuf, double pixbuf_x, double pixbuf_y);
192 gdk_cairo_set_source_pixbuf(getCairoStruct(), pixbuf
.getPixbufStruct(), pixbufX
, pixbufY
);
196 * Sets the given pixmap as the source pattern for the Cairo context.
197 * The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned
198 * so that the origin of pixbuf is pixbuf_x, pixbuf_y
204 * X coordinate of location to place upper left corner of pixmap
206 * Y coordinate of location to place upper left corner of pixmap
209 public void setSourcePixmap(Pixmap pixmap
, double pixmapX
, double pixmapY
)
211 // void gdk_cairo_set_source_pixmap (cairo_t *cr, GdkPixmap *pixmap, double pixmap_x, double pixmap_y);
212 gdk_cairo_set_source_pixmap( getCairoStruct(), pixmap
.getPixmapStruct(), pixmapX
, pixmapY
);
216 * Adds the given rectangle to the current path of cr.
223 public void rectangle(Rectangle rectangle
)
225 // void gdk_cairo_rectangle (cairo_t *cr, GdkRectangle *rectangle);
226 gdk_cairo_rectangle( getCairoStruct(), rectangle
.getRectangleStruct());
230 * Adds the given region to the current path of cr.
237 public void region( Region region
)
239 // void gdk_cairo_region (cairo_t *cr, GdkRegion *region);
240 gdk_cairo_region(getCairoStruct(), region
.getRegionStruct());
258 * Creates a new cairo_t with all graphics state parameters set to
259 * default values and with target as a target surface. The target
260 * surface should be constructed with a backend-specific function such
261 * as cairo_image_surface_create() (or any other
262 * cairo_<backend>_surface_create variant).
263 * This function references target, so you can immediately
264 * call cairo_surface_destroy() on it if you don't need to
265 * maintain a separate reference to it.
267 * target surface for the context
269 * a newly allocated cairo_t with a reference
270 * count of 1. The initial reference count should be released
271 * with cairo_destroy() when you are done using the cairo_t.
272 * This function never returns NULL. If memory cannot be
273 * allocated, a special cairo_t object will be returned on
274 * which cairo_status() returns CAIRO_STATUS_NO_MEMORY.
275 * You can use this object normally, but no drawing will
278 public static Cairo
create(Surface target
)
280 // cairo_t* cairo_create (cairo_surface_t *target);
281 return new Cairo( cairo_create((target
is null) ?
null : target
.getSurfaceStruct()) );
285 * Increases the reference count on cr by one. This prevents
286 * cr from being destroyed until a matching call to cairo_destroy()
291 * the referenced cairo_t.
293 public Cairo
reference()
295 // cairo_t* cairo_reference (cairo_t *cr);
296 return new Cairo( cairo_reference(cairo
) );
300 * Decreases the reference count on cr by one. If the result
301 * is zero, then cr and all associated resources are freed.
302 * See cairo_reference().
306 public void destroy()
308 // void cairo_destroy (cairo_t *cr);
309 cairo_destroy(cairo
);
313 * Checks whether an error has previously occurred for this context.
317 * the current status of this context, see cairo_status_t
319 public cairo_status_t
status()
321 // cairo_status_t cairo_status (cairo_t *cr);
322 return cairo_status(cairo
);
326 * Makes a copy of the current state of cr and saves it
327 * on an internal stack of saved states for cr. When
328 * cairo_restore() is called, cr will be restored to
329 * the saved state. Multiple calls to cairo_save() and
330 * cairo_restore() can be nested; each call to cairo_restore()
331 * restores the state from the matching paired cairo_save().
332 * It isn't necessary to clear all saved states before
333 * a cairo_t is freed. If the reference count of a cairo_t
334 * drops to zero in response to a call to cairo_destroy(),
335 * any saved states will be freed along with the cairo_t.
341 // void cairo_save (cairo_t *cr);
346 * Restores cr to the state saved by a preceding call to
347 * cairo_save() and removes that state from the stack of
352 public void restore()
354 // void cairo_restore (cairo_t *cr);
355 cairo_restore(cairo
);
359 * Gets the target surface for the cairo context as passed to
361 * This function will always return a valid pointer, but the result
362 * can be a "nil" surface if cr is already in an error state,
363 * (ie. cairo_status() != CAIRO_STATUS_SUCCESS).
364 * A nil surface is indicated by cairo_surface_status()
365 * != CAIRO_STATUS_SUCCESS.
369 * the target surface. This object is owned by cairo. To
370 * keep a reference to it, you must call cairo_surface_reference().
372 public Surface
getTarget()
374 // cairo_surface_t* cairo_get_target (cairo_t *cr);
375 return new Surface( cairo_get_target(cairo
) );
379 * Temporarily redirects drawing to an intermediate surface known as a
380 * group. The redirection lasts until the group is completed by a call
381 * to cairo_pop_group() or cairo_pop_group_to_source(). These calls
382 * provide the result of any drawing to the group as a pattern,
383 * (either as an explicit object, or set as the source pattern).
384 * This group functionality can be convenient for performing
385 * intermediate compositing. One common use of a group is to render
386 * objects as opaque within the group, (so that they occlude each
387 * other), and then blend the result with translucence onto the
389 * Groups can be nested arbitrarily deep by making balanced calls to
390 * cairo_push_group()/cairo_pop_group(). Each call pushes/pops the new
391 * target group onto/from a stack.
392 * The cairo_push_group() function calls cairo_save() so that any
393 * changes to the graphics state will not be visible outside the
394 * group, (the pop_group functions call cairo_restore()).
395 * By default the intermediate group will have a content type of
396 * CAIRO_CONTENT_COLOR_ALPHA. Other content types can be chosen for
397 * the group by using cairo_push_group_with_content() instead.
398 * As an example, here is how one might fill and stroke a path with
399 * translucence, but without any portion of the fill being visible
401 * cairo_push_group (cr);
402 * cairo_set_source (cr, fill_pattern);
403 * cairo_fill_preserve (cr);
404 * cairo_set_source (cr, stroke_pattern);
406 * cairo_pop_group_to_source (cr);
407 * cairo_paint_with_alpha (cr, alpha);
412 public void pushGroup()
414 // void cairo_push_group (cairo_t *cr);
415 cairo_push_group(cairo
);
419 * Temporarily redirects drawing to an intermediate surface known as a
420 * group. The redirection lasts until the group is completed by a call
421 * to cairo_pop_group() or cairo_pop_group_to_source(). These calls
422 * provide the result of any drawing to the group as a pattern,
423 * (either as an explicit object, or set as the source pattern).
424 * The group will have a content type of content. The ability to
425 * control this content type is the only distinction between this
426 * function and cairo_push_group() which you should see for a more
427 * detailed description of group rendering.
431 * a cairo_content_t indicating the type of group that
435 public void pushGroupWithContent(cairo_content_t content
)
437 // void cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
438 cairo_push_group_with_content(cairo
, content
);
442 * Terminates the redirection begun by a call to cairo_push_group() or
443 * cairo_push_group_with_content() and returns a new pattern
444 * containing the results of all drawing operations performed to the
446 * The cairo_pop_group() function calls cairo_restore(), (balancing a
447 * call to cairo_save() by the push_group function), so that any
448 * changes to the graphics state will not be visible outside the
453 * a newly created (surface) pattern containing the
454 * results of all drawing operations performed to the group. The
455 * caller owns the returned object and should call
456 * cairo_pattern_destroy() when finished with it.
459 public cairo_pattern_t
* popGroup()
461 // cairo_pattern_t* cairo_pop_group (cairo_t *cr);
462 return cairo_pop_group(cairo
);
466 * Terminates the redirection begun by a call to cairo_push_group() or
467 * cairo_push_group_with_content() and installs the resulting pattern
468 * as the source pattern in the given cairo context.
469 * The behavior of this function is equivalent to the sequence of
471 * cairo_pattern_t *group = cairo_pop_group (cr);
472 * cairo_set_source (cr, group);
473 * cairo_pattern_destroy (group);
474 * but is more convenient as their is no need for a variable to store
475 * the short-lived pointer to the pattern.
476 * The cairo_pop_group() function calls cairo_restore(), (balancing a
477 * call to cairo_save() by the push_group function), so that any
478 * changes to the graphics state will not be visible outside the
484 public void popGroupToSource()
486 // void cairo_pop_group_to_source (cairo_t *cr);
487 cairo_pop_group_to_source(cairo
);
491 * Gets the target surface for the current group as started by the
492 * most recent call to cairo_push_group() or
493 * cairo_push_group_with_content().
494 * This function will return NULL if called "outside" of any group
495 * rendering blocks, (that is, after the last balancing call to
496 * cairo_pop_group() or cairo_pop_group_to_source()).
500 * the target group surface, or NULL if none. This
501 * object is owned by cairo. To keep a reference to it, you must call
502 * cairo_surface_reference().
505 public Surface
getGroupTarget()
507 // cairo_surface_t* cairo_get_group_target (cairo_t *cr);
508 return new Surface( cairo_get_group_target(cairo
) );
512 * Sets the source pattern within cr to an opaque color. This opaque
513 * color will then be used for any subsequent drawing operation until
514 * a new source pattern is set.
515 * The color components are floating point numbers in the range 0 to
516 * 1. If the values passed in are outside that range, they will be
521 * red component of color
523 * green component of color
525 * blue component of color
527 public void setSourceRgb(double red
, double green
, double blue
)
529 // void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
530 cairo_set_source_rgb(cairo
, red
, green
, blue
);
534 * Sets the source pattern within cr to a translucent color. This
535 * color will then be used for any subsequent drawing operation until
536 * a new source pattern is set.
537 * The color and alpha components are floating point numbers in the
538 * range 0 to 1. If the values passed in are outside that range, they
543 * red component of color
545 * green component of color
547 * blue component of color
549 * alpha component of color
551 public void setSourceRgba(double red
, double green
, double blue
, double alpha
)
553 // void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha);
554 cairo_set_source_rgba(cairo
, red
, green
, blue
, alpha
);
558 * Sets the source pattern within cr to source. This pattern
559 * will then be used for any subsequent drawing operation until a new
560 * source pattern is set.
561 * Note: The pattern's transformation matrix will be locked to the
562 * user space in effect at the time of cairo_set_source(). This means
563 * that further modifications of the current transformation matrix
564 * will not affect the source pattern. See cairo_pattern_set_matrix().
565 * XXX: I'd also like to direct the reader's attention to some
566 * (not-yet-written) section on cairo's imaging model. How would I do
567 * that if such a section existed? (cworth).
571 * a cairo_pattern_t to be used as the source for
572 * subsequent drawing operations.
574 public void setSource(cairo_pattern_t
* source
)
576 // void cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
577 cairo_set_source(cairo
, source
);
581 * This is a convenience function for creating a pattern from surface
582 * and setting it as the source in cr with cairo_set_source().
583 * The x and y parameters give the user-space coordinate at which
584 * the surface origin should appear. (The surface origin is its
585 * upper-left corner before any transformation has been applied.) The
586 * x and y patterns are negated and then set as translation values
587 * in the pattern matrix.
588 * Other than the initial translation pattern matrix, as described
589 * above, all other pattern attributes, (such as its extend mode), are
590 * set to the default values as in cairo_pattern_create_for_surface().
591 * The resulting pattern can be queried with cairo_get_source() so
592 * that these attributes can be modified if desired, (eg. to create a
593 * repeating pattern with cairo_pattern_set_extend()).
597 * a surface to be used to set the source pattern
599 * User-space X coordinate for surface origin
601 * User-space Y coordinate for surface origin
603 public void setSourceSurface(Surface surface
, double x
, double y
)
605 // void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y);
606 cairo_set_source_surface(cairo
, (surface
is null) ?
null : surface
.getSurfaceStruct(), x
, y
);
610 * Gets the current source pattern for cr.
614 * the current source pattern. This object is owned by
615 * cairo. To keep a reference to it, you must call
616 * cairo_pattern_reference().
618 public cairo_pattern_t
* getSource()
620 // cairo_pattern_t* cairo_get_source (cairo_t *cr);
621 return cairo_get_source(cairo
);
626 * Set the antialiasing mode of the rasterizer used for drawing shapes.
627 * This value is a hint, and a particular backend may or may not support
628 * a particular value. At the current time, no backend supports
629 * CAIRO_ANTIALIAS_SUBPIXEL when drawing shapes.
630 * Note that this option does not affect text rendering, instead see
631 * cairo_font_options_set_antialias().
635 * the new antialiasing mode
637 public void setAntialias(cairo_antialias_t antialias
)
639 // void cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
640 cairo_set_antialias(cairo
, antialias
);
644 * Gets the current shape antialiasing mode, as set by cairo_set_shape_antialias().
648 * the current shape antialiasing mode.
650 public cairo_antialias_t
getAntialias()
652 // cairo_antialias_t cairo_get_antialias (cairo_t *cr);
653 return cairo_get_antialias(cairo
);
657 * Sets the dash pattern to be used by cairo_stroke(). A dash pattern
658 * is specified by dashes, an array of positive values. Each value
659 * provides the length of alternate "on" and "off" portions of the
660 * stroke. The offset specifies an offset into the pattern at which
662 * Each "on" segment will have caps applied as if the segment were a
663 * separate sub-path. In particular, it is valid to use an "on" length
664 * of 0.0 with CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE in order
665 * to distributed dots or squares along a path.
666 * Note: The length values are in user-space units as evaluated at the
667 * time of stroking. This is not necessarily the same as the user
668 * space at the time of cairo_set_dash().
669 * If num_dashes is 0 dashing is disabled.
670 * If num_dashes is 1 a symmetric pattern is assumed with alternating
671 * on and off portions of the size specified by the single value in
673 * If any value in dashes is negative, or if all values are 0, then
674 * cairo_t will be put into an error state with a status of
675 * CAIRO_STATUS_INVALID_DASH.
679 * an array specifying alternate lengths of on and off stroke portions
681 * the length of the dashes array
683 * an offset into the dash pattern at which the stroke should start
685 public void setDash(double* dashes
, int numDashes
, double offset
)
687 // void cairo_set_dash (cairo_t *cr, const double *dashes, int num_dashes, double offset);
688 cairo_set_dash(cairo
, dashes
, numDashes
, offset
);
693 * Set the current fill rule within the cairo context. The fill rule
694 * is used to determine which regions are inside or outside a complex
695 * (potentially self-intersecting) path. The current fill rule affects
696 * both cairo_fill and cairo_clip. See cairo_fill_rule_t for details
697 * on the semantics of each available fill rule.
701 * a fill rule, specified as a cairo_fill_rule_t
703 public void setFillRule(cairo_fill_rule_t fillRule
)
705 // void cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
706 cairo_set_fill_rule(cairo
, fillRule
);
710 * Gets the current fill rule, as set by cairo_set_fill_rule().
714 * the current fill rule.
716 public cairo_fill_rule_t
getFillRule()
718 // cairo_fill_rule_t cairo_get_fill_rule (cairo_t *cr);
719 return cairo_get_fill_rule(cairo
);
724 * Sets the current line cap style within the cairo context. See
725 * cairo_line_cap_t for details about how the available line cap
727 * As with the other stroke parameters, the current line cap style is
728 * examined by cairo_stroke(), cairo_stroke_extents(), and
729 * cairo_stroke_to_path(), but does not have any effect during path
732 * a cairo context, as a cairo_t
734 * a line cap style, as a cairo_line_cap_t
736 public void setLineCap(cairo_line_cap_t lineCap
)
738 // void cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
739 cairo_set_line_cap(cairo
, lineCap
);
743 * Gets the current line cap style, as set by cairo_set_line_cap().
747 * the current line cap style.
749 public cairo_line_cap_t
getLineCap()
751 // cairo_line_cap_t cairo_get_line_cap (cairo_t *cr);
752 return cairo_get_line_cap(cairo
);
757 * Sets the current line join style within the cairo context. See
758 * cairo_line_join_t for details about how the available line join
760 * As with the other stroke parameters, the current line join style is
761 * examined by cairo_stroke(), cairo_stroke_extents(), and
762 * cairo_stroke_to_path(), but does not have any effect during path
765 * a cairo context, as a cairo_t
767 * a line joint style, as a cairo_line_join_t
769 public void setLineJoin(cairo_line_join_t lineJoin
)
771 // void cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
772 cairo_set_line_join(cairo
, lineJoin
);
776 * Gets the current line join style, as set by cairo_set_line_join().
780 * the current line join style.
782 public cairo_line_join_t
getLineJoin()
784 // cairo_line_join_t cairo_get_line_join (cairo_t *cr);
785 return cairo_get_line_join(cairo
);
789 * Sets the current line width within the cairo context. The line
790 * width value specifies the diameter of a pen that is circular in
791 * user space, (though device-space pen may be an ellipse in general
792 * due to scaling/shear/rotation of the CTM).
793 * Note: When the description above refers to user space and CTM it
794 * refers to the user space and CTM in effect at the time of the
795 * stroking operation, not the user space and CTM in effect at the
796 * time of the call to cairo_set_line_width(). The simplest usage
797 * makes both of these spaces identical. That is, if there is no
798 * change to the CTM between a call to cairo_set_line_with() and the
799 * stroking operation, then one can just pass user-space values to
800 * cairo_set_line_width() and ignore this note.
801 * As with the other stroke parameters, the current line width is
802 * examined by cairo_stroke(), cairo_stroke_extents(), and
803 * cairo_stroke_to_path(), but does not have any effect during path
805 * The default line width value is 2.0.
811 public void setLineWidth(double width
)
813 // void cairo_set_line_width (cairo_t *cr, double width);
814 cairo_set_line_width(cairo
, width
);
821 * the current line width value exactly as set by
822 * cairo_set_line_width(). Note that the value is unchanged even if
823 * the CTM has changed between the calls to cairo_set_line_width() and
824 * cairo_get_line_width().
826 public double getLineWidth()
828 // double cairo_get_line_width (cairo_t *cr);
829 return cairo_get_line_width(cairo
);
836 public void setMiterLimit(double limit
)
838 // void cairo_set_miter_limit (cairo_t *cr, double limit);
839 cairo_set_miter_limit(cairo
, limit
);
843 * Gets the current miter limit, as set by cairo_set_miter_limit().
847 * the current miter limit.
849 public double getMiterLimit()
851 // double cairo_get_miter_limit (cairo_t *cr);
852 return cairo_get_miter_limit(cairo
);
857 * Sets the compositing operator to be used for all drawing
858 * operations. See cairo_operator_t for details on the semantics of
859 * each available compositing operator.
860 * XXX: I'd also like to direct the reader's attention to some
861 * (not-yet-written) section on cairo's imaging model. How would I do
862 * that if such a section existed? (cworth).
866 * a compositing operator, specified as a cairo_operator_t
868 public void setOperator(cairo_operator_t op
)
870 // void cairo_set_operator (cairo_t *cr, cairo_operator_t op);
871 cairo_set_operator(cairo
, op
);
875 * Gets the current compositing operator for a cairo context.
879 * the current compositing operator.
881 public cairo_operator_t
getOperator()
883 // cairo_operator_t cairo_get_operator (cairo_t *cr);
884 return cairo_get_operator(cairo
);
888 * Sets the tolerance used when converting paths into trapezoids.
889 * Curved segments of the path will be subdivided until the maximum
890 * deviation between the original path and the polygonal approximation
891 * is less than tolerance. The default value is 0.1. A larger
892 * value will give better performance, a smaller value, better
893 * appearance. (Reducing the value from the default value of 0.1
894 * is unlikely to improve appearance significantly.)
898 * the tolerance, in device units (typically pixels)
900 public void setTolerance(double tolerance
)
902 // void cairo_set_tolerance (cairo_t *cr, double tolerance);
903 cairo_set_tolerance(cairo
, tolerance
);
907 * Gets the current tolerance value, as set by cairo_set_tolerance().
911 * the current tolerance value.
913 public double getTolerance()
915 // double cairo_get_tolerance (cairo_t *cr);
916 return cairo_get_tolerance(cairo
);
920 * Establishes a new clip region by intersecting the current clip
921 * region with the current path as it would be filled by cairo_fill()
922 * and according to the current fill rule (see cairo_set_fill_rule()).
923 * After cairo_clip, the current path will be cleared from the cairo
925 * The current clip region affects all drawing operations by
926 * effectively masking out any changes to the surface that are outside
927 * the current clip region.
928 * Calling cairo_clip() can only make the clip region smaller, never
929 * larger. But the current clip is part of the graphics state, so a
930 * temporary restriction of the clip region can be achieved by
931 * calling cairo_clip() within a cairo_save()/cairo_restore()
932 * pair. The only other means of increasing the size of the clip
933 * region is cairo_reset_clip().
939 // void cairo_clip (cairo_t *cr);
944 * Establishes a new clip region by intersecting the current clip
945 * region with the current path as it would be filled by cairo_fill()
946 * and according to the current fill rule (see cairo_set_fill_rule()).
947 * Unlike cairo_clip(), cairo_clip_preserve preserves the path within
949 * The current clip region affects all drawing operations by
950 * effectively masking out any changes to the surface that are outside
951 * the current clip region.
952 * Calling cairo_clip() can only make the clip region smaller, never
953 * larger. But the current clip is part of the graphics state, so a
954 * temporary restriction of the clip region can be achieved by
955 * calling cairo_clip() within a cairo_save()/cairo_restore()
956 * pair. The only other means of increasing the size of the clip
957 * region is cairo_reset_clip().
961 public void clipPreserve()
963 // void cairo_clip_preserve (cairo_t *cr);
964 cairo_clip_preserve(cairo
);
968 * Reset the current clip region to its original, unrestricted
969 * state. That is, set the clip region to an infinitely large shape
970 * containing the target surface. Equivalently, if infinity is too
971 * hard to grasp, one can imagine the clip region being reset to the
972 * exact bounds of the target surface.
973 * Note that code meant to be reusable should not call
974 * cairo_reset_clip() as it will cause results unexpected by
975 * higher-level code which calls cairo_clip(). Consider using
976 * cairo_save() and cairo_restore() around cairo_clip() as a more
977 * robust means of temporarily restricting the clip region.
981 public void resetClip()
983 // void cairo_reset_clip (cairo_t *cr);
984 cairo_reset_clip(cairo
);
988 * A drawing operator that fills the current path according to the
989 * current fill rule, (each sub-path is implicitly closed before being
990 * filled). After cairo_fill, the current path will be cleared from
991 * the cairo context. See cairo_set_fill_rule() and
992 * cairo_fill_preserve().
998 // void cairo_fill (cairo_t *cr);
1003 * A drawing operator that fills the current path according to the
1004 * current fill rule, (each sub-path is implicitly closed before being
1005 * filled). Unlike cairo_fill(), cairo_fill_preserve preserves the
1006 * path within the cairo context.
1007 * See cairo_set_fill_rule() and cairo_fill().
1011 public void fillPreserve()
1013 // void cairo_fill_preserve (cairo_t *cr);
1014 cairo_fill_preserve(cairo
);
1024 public void fillExtents(double* x1
, double* y1
, double* x2
, double* y2
)
1026 // void cairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);
1027 cairo_fill_extents(cairo
, x1
, y1
, x2
, y2
);
1031 * Tests whether the given point is inside the area that would be
1032 * filled by doing a cairo_fill() operation on cr given the current
1033 * path and filling parameters.
1034 * See cairo_fill(), cairo_set_fill_rule() and cairo_fill_preserve().
1038 * X coordinate of the point to test
1040 * Y coordinate of the point to test
1042 * A non-zero value if the point is inside, or zero if
1045 public cairo_bool_t
inFill(double x
, double y
)
1047 // cairo_bool_t cairo_in_fill (cairo_t *cr, double x, double y);
1048 return cairo_in_fill(cairo
, x
, y
);
1052 * A drawing operator that paints the current source
1053 * using the alpha channel of pattern as a mask. (Opaque
1054 * areas of pattern are painted with the source, transparent
1055 * areas are not painted.)
1061 public void mask(cairo_pattern_t
* pattern
)
1063 // void cairo_mask (cairo_t *cr, cairo_pattern_t *pattern);
1064 cairo_mask(cairo
, pattern
);
1068 * A drawing operator that paints the current source
1069 * using the alpha channel of surface as a mask. (Opaque
1070 * areas of surface are painted with the source, transparent
1071 * areas are not painted.)
1077 * X coordinate at which to place the origin of surface
1079 * Y coordinate at which to place the origin of surface
1081 public void maskSurface(Surface surface
, double surfaceX
, double surfaceY
)
1083 // void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y);
1084 cairo_mask_surface(cairo
, (surface
is null) ?
null : surface
.getSurfaceStruct(), surfaceX
, surfaceY
);
1088 * A drawing operator that paints the current source everywhere within
1089 * the current clip region.
1095 // void cairo_paint (cairo_t *cr);
1100 * A drawing operator that paints the current source everywhere within
1101 * the current clip region using a mask of constant alpha value
1102 * alpha. The effect is similar to cairo_paint(), but the drawing
1103 * is faded out using the alpha value.
1107 * alpha value, between 0 (transparent) and 1 (opaque)
1109 public void paintWithAlpha(double alpha
)
1111 // void cairo_paint_with_alpha (cairo_t *cr, double alpha);
1112 cairo_paint_with_alpha(cairo
, alpha
);
1116 * A drawing operator that strokes the current path according to the
1117 * current line width, line join, line cap, and dash settings. After
1118 * cairo_stroke, the current path will be cleared from the cairo
1119 * context. See cairo_set_line_width(), cairo_set_line_join(),
1120 * cairo_set_line_cap(), cairo_set_dash(), and
1121 * cairo_stroke_preserve().
1122 * Note: Degenerate segments and sub-paths are treated specially and
1123 * provide a useful result. These can result in two different
1125 * 1. Zero-length "on" segments set in cairo_set_dash(). If the cap
1126 * style is CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE then these
1127 * segments will be drawn as circular dots or squares respectively. In
1128 * the case of CAIRO_LINE_CAP_SQUARE, the orientation of the squares
1129 * is determined by the direction of the underlying path.
1130 * 2. A sub-path created by cairo_move_to() followed by either a
1131 * cairo_close_path() or one or more calls to cairo_line_to() to the
1132 * same coordinate as the cairo_move_to(). If the cap style is
1133 * CAIRO_LINE_CAP_ROUND then these sub-paths will be drawn as circular
1134 * dots. Note that in the case of CAIRO_LINE_CAP_SQUARE a degenerate
1135 * sub-path will not be drawn at all, (since the correct orientation
1136 * is indeterminate).
1137 * In no case will a cap style of CAIRO_LINE_CAP_BUTT cause anything
1138 * to be drawn in the case of either degenerate segments or sub-paths.
1142 public void stroke()
1144 // void cairo_stroke (cairo_t *cr);
1145 cairo_stroke(cairo
);
1149 * A drawing operator that strokes the current path according to the
1150 * current line width, line join, line cap, and dash settings. Unlike
1151 * cairo_stroke(), cairo_stroke_preserve preserves the path within the
1153 * See cairo_set_line_width(), cairo_set_line_join(),
1154 * cairo_set_line_cap(), cairo_set_dash(), and
1155 * cairo_stroke_preserve().
1159 public void strokePreserve()
1161 // void cairo_stroke_preserve (cairo_t *cr);
1162 cairo_stroke_preserve(cairo
);
1172 public void strokeExtents(double* x1
, double* y1
, double* x2
, double* y2
)
1174 // void cairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);
1175 cairo_stroke_extents(cairo
, x1
, y1
, x2
, y2
);
1179 * Tests whether the given point is inside the area that would be
1180 * stroked by doing a cairo_stroke() operation on cr given the
1181 * current path and stroking parameters.
1182 * See cairo_stroke(), cairo_set_line_width(), cairo_set_line_join(),
1183 * cairo_set_line_cap(), cairo_set_dash(), and
1184 * cairo_stroke_preserve().
1188 * X coordinate of the point to test
1190 * Y coordinate of the point to test
1192 * A non-zero value if the point is inside, or zero if
1195 public cairo_bool_t
inStroke(double x
, double y
)
1197 // cairo_bool_t cairo_in_stroke (cairo_t *cr, double x, double y);
1198 return cairo_in_stroke(cairo
, x
, y
);
1202 * Emits the current page for backends that support multiple pages, but
1203 * doesn't clear it, so, the contents of the current page will be retained
1204 * for the next page too. Use cairo_show_page() if you want to get an
1205 * empty page after the emission.
1209 public void copyPage()
1211 // void cairo_copy_page (cairo_t *cr);
1212 cairo_copy_page(cairo
);
1216 * Emits and clears the current page for backends that support multiple
1217 * pages. Use cairo_copy_page() if you don't want to clear the page.
1221 public void showPage()
1223 // void cairo_show_page (cairo_t *cr);
1224 cairo_show_page(cairo
);
1231 * Creates a copy of the current path and returns it to the user as a
1232 * cairo_path_t. See cairo_path_data_t for hints on how to iterate
1233 * over the returned data structure.
1234 * This function will always return a valid pointer, but the result
1235 * will have no data (data==NULL and
1236 * num_data==0), if either of the following
1238 * If there is insufficient memory to copy the path. In this
1239 * case path->status will be set to
1240 * CAIRO_STATUS_NO_MEMORY.
1241 * If cr is already in an error state. In this case
1242 * path->status will contain the same status that
1243 * would be returned by cairo_status().
1244 * In either case, path->status will be set to
1245 * CAIRO_STATUS_NO_MEMORY (regardless of what the error status in
1246 * cr might have been).
1250 * the copy of the current path. The caller owns the
1251 * returned object and should call cairo_path_destroy() when finished
1254 public cairo_path_t
* copyPath()
1256 // cairo_path_t* cairo_copy_path (cairo_t *cr);
1257 return cairo_copy_path(cairo
);
1261 * Gets a flattened copy of the current path and returns it to the
1262 * user as a cairo_path_t. See cairo_path_data_t for hints on
1263 * how to iterate over the returned data structure.
1264 * This function is like cairo_copy_path() except that any curves
1265 * in the path will be approximated with piecewise-linear
1266 * approximations, (accurate to within the current tolerance
1267 * value). That is, the result is guaranteed to not have any elements
1268 * of type CAIRO_PATH_CURVE_TO which will instead be replaced by a
1269 * series of CAIRO_PATH_LINE_TO elements.
1270 * This function will always return a valid pointer, but the result
1271 * will have no data (data==NULL and
1272 * num_data==0), if either of the following
1274 * If there is insufficient memory to copy the path. In this
1275 * case path->status will be set to
1276 * CAIRO_STATUS_NO_MEMORY.
1277 * If cr is already in an error state. In this case
1278 * path->status will contain the same status that
1279 * would be returned by cairo_status().
1283 * the copy of the current path. The caller owns the
1284 * returned object and should call cairo_path_destroy() when finished
1287 public cairo_path_t
* copyPathFlat()
1289 // cairo_path_t* cairo_copy_path_flat (cairo_t *cr);
1290 return cairo_copy_path_flat(cairo
);
1294 * Immediately releases all memory associated with path. After a call
1295 * to cairo_path_destroy() the path pointer is no longer valid and
1296 * should not be used further.
1297 * NOTE: cairo_path_destroy function should only be called with a
1298 * pointer to a cairo_path_t returned by a cairo function. Any path
1299 * that is created manually (ie. outside of cairo) should be destroyed
1302 * a path previously returned by either cairo_copy_path() or
1303 * cairo_copy_path_flat().
1305 public static void pathDestroy(cairo_path_t
* path
)
1307 // void cairo_path_destroy (cairo_path_t *path);
1308 cairo_path_destroy(path
);
1312 * Append the path onto the current path. The path may be either the
1313 * return value from one of cairo_copy_path() or
1314 * cairo_copy_path_flat() or it may be constructed manually. See
1315 * cairo_path_t for details on how the path data structure should be
1316 * initialized, and note that path->status must be
1317 * initialized to CAIRO_STATUS_SUCCESS.
1321 * path to be appended
1323 public void appendPath(cairo_path_t
* path
)
1325 // void cairo_append_path (cairo_t *cr, cairo_path_t *path);
1326 cairo_append_path(cairo
, path
);
1330 * Gets the current point of the current path, which is
1331 * conceptually the final point reached by the path so far.
1332 * The current point is returned in the user-space coordinate
1333 * system. If there is no defined current point then x and y will
1334 * both be set to 0.0.
1335 * Most path construction functions alter the current point. See the
1336 * following for details on how they affect the current point:
1337 * cairo_new_path(), cairo_move_to(), cairo_line_to(),
1338 * cairo_curve_to(), cairo_arc(), cairo_rel_move_to(),
1339 * cairo_rel_line_to(), cairo_rel_curve_to(), cairo_arc(),
1340 * cairo_text_path(), cairo_stroke_to_path()
1344 * return value for X coordinate of the current point
1346 * return value for Y coordinate of the current point
1348 public void getCurrentPoint(double* x
, double* y
)
1350 // void cairo_get_current_point (cairo_t *cr, double *x, double *y);
1351 cairo_get_current_point(cairo
, x
, y
);
1355 * Clears the current path. After this call there will be no path and
1360 public void newPath()
1362 // void cairo_new_path (cairo_t *cr);
1363 cairo_new_path(cairo
);
1367 * Begin a new sub-path. Note that the existing path is not
1368 * affected. After this call there will be no current point.
1369 * In many cases, this call is not needed since new sub-paths are
1370 * frequently started with cairo_move_to().
1371 * A call to cairo_new_sub_path() is particularly useful when
1372 * beginning a new sub-path with one of the cairo_arc() calls. This
1373 * makes things easier as it is no longer necessary to manually
1374 * compute the arc's initial coordinates for a call to
1380 public void newSubPath()
1382 // void cairo_new_sub_path (cairo_t *cr);
1383 cairo_new_sub_path(cairo
);
1387 * Adds a line segment to the path from the current point to the
1388 * beginning of the current sub-path, (the most recent point passed to
1389 * cairo_move_to()), and closes this sub-path. After this call the
1390 * current point will be at the joined endpoint of the sub-path.
1391 * The behavior of cairo_close_path() is distinct from simply calling
1392 * cairo_line_to() with the equivalent coordinate in the case of
1393 * stroking. When a closed sub-path is stroked, there are no caps on
1394 * the ends of the sub-path. Instead, there is a line join connecting
1395 * the final and initial segments of the sub-path.
1396 * If there is no current point before the call to cairo_close_path,
1397 * this function will have no effect.
1398 * Note: As of cairo version 1.2.4 any call to cairo_close_path will
1399 * place an explicit MOVE_TO element into the path immediately after
1400 * the CLOSE_PATH element, (which can be seen in cairo_copy_path() for
1401 * example). This can simplify path processing in some cases as it may
1402 * not be necessary to save the "last move_to point" during processing
1403 * as the MOVE_TO immediately after the CLOSE_PATH will provide that
1408 public void closePath()
1410 // void cairo_close_path (cairo_t *cr);
1411 cairo_close_path(cairo
);
1415 * Adds a circular arc of the given radius to the current path. The
1416 * arc is centered at (xc, yc), begins at angle1 and proceeds in
1417 * the direction of increasing angles to end at angle2. If angle2 is
1418 * less than angle1 it will be progressively increased by 2*M_PI
1419 * until it is greater than angle1.
1420 * If there is a current point, an initial line segment will be added
1421 * to the path to connect the current point to the beginning of the
1423 * Angles are measured in radians. An angle of 0.0 is in the direction
1424 * of the positive X axis (in user space). An angle of M_PI/2.0 radians
1425 * (90 degrees) is in the direction of the positive Y axis (in
1426 * user space). Angles increase in the direction from the positive X
1427 * axis toward the positive Y axis. So with the default transformation
1428 * matrix, angles increase in a clockwise direction.
1429 * (To convert from degrees to radians, use degrees * (M_PI /
1431 * This function gives the arc in the direction of increasing angles;
1432 * see cairo_arc_negative() to get the arc in the direction of
1433 * decreasing angles.
1434 * The arc is circular in user space. To achieve an elliptical arc,
1435 * you can scale the current transformation matrix by different
1436 * amounts in the X and Y directions. For example, to draw an ellipse
1437 * in the box given by x, y, width, height:
1439 * cairo_translate (cr, x + width / 2., y + height / 2.);
1440 * cairo_scale (cr, 1. / (height / 2.), 1. / (width / 2.));
1441 * cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI);
1442 * cairo_restore (cr);
1446 * X position of the center of the arc
1448 * Y position of the center of the arc
1450 * the radius of the arc
1452 * the start angle, in radians
1454 * the end angle, in radians
1456 public void arc(double xc
, double yc
, double radius
, double angle1
, double angle2
)
1458 // void cairo_arc (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2);
1459 cairo_arc(cairo
, xc
, yc
, radius
, angle1
, angle2
);
1463 * Adds a circular arc of the given radius to the current path. The
1464 * arc is centered at (xc, yc), begins at angle1 and proceeds in
1465 * the direction of decreasing angles to end at angle2. If angle2 is
1466 * greater than angle1 it will be progressively decreased by 2*M_PI
1467 * until it is greater than angle1.
1468 * See cairo_arc() for more details. This function differs only in the
1469 * direction of the arc between the two angles.
1473 * X position of the center of the arc
1475 * Y position of the center of the arc
1477 * the radius of the arc
1479 * the start angle, in radians
1481 * the end angle, in radians
1483 public void arcNegative(double xc
, double yc
, double radius
, double angle1
, double angle2
)
1485 // void cairo_arc_negative (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2);
1486 cairo_arc_negative(cairo
, xc
, yc
, radius
, angle1
, angle2
);
1490 * Adds a cubic Bzier spline to the path from the current point to
1491 * position (x3, y3) in user-space coordinates, using (x1, y1) and
1492 * (x2, y2) as the control points. After this call the current point
1494 * If there is no current point before the call to cairo_curve_to()
1495 * this function will behave as if preceded by a call to
1496 * cairo_move_to (cr, x1, y1).
1500 * the X coordinate of the first control point
1502 * the Y coordinate of the first control point
1504 * the X coordinate of the second control point
1506 * the Y coordinate of the second control point
1508 * the X coordinate of the end of the curve
1510 * the Y coordinate of the end of the curve
1512 public void curveTo(double x1
, double y1
, double x2
, double y2
, double x3
, double y3
)
1514 // void cairo_curve_to (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3);
1515 cairo_curve_to(cairo
, x1
, y1
, x2
, y2
, x3
, y3
);
1519 * Adds a line to the path from the current point to position (x, y)
1520 * in user-space coordinates. After this call the current point
1522 * If there is no current point before the call to cairo_line_to()
1523 * this function will behave as cairo_move_to (cr, x, y).
1527 * the X coordinate of the end of the new line
1529 * the Y coordinate of the end of the new line
1531 public void lineTo(double x
, double y
)
1533 // void cairo_line_to (cairo_t *cr, double x, double y);
1534 cairo_line_to(cairo
, x
, y
);
1538 * Begin a new sub-path. After this call the current point will be (x,
1543 * the X coordinate of the new position
1545 * the Y coordinate of the new position
1547 public void moveTo(double x
, double y
)
1549 // void cairo_move_to (cairo_t *cr, double x, double y);
1550 cairo_move_to(cairo
, x
, y
);
1554 * Adds a closed sub-path rectangle of the given size to the current
1555 * path at position (x, y) in user-space coordinates.
1556 * This function is logically equivalent to:
1557 * cairo_move_to (cr, x, y);
1558 * cairo_rel_line_to (cr, width, 0);
1559 * cairo_rel_line_to (cr, 0, height);
1560 * cairo_rel_line_to (cr, -width, 0);
1561 * cairo_close_path (cr);
1565 * the X coordinate of the top left corner of the rectangle
1567 * the Y coordinate to the top left corner of the rectangle
1569 * the width of the rectangle
1571 * the height of the rectangle
1573 public void rectangle(double x
, double y
, double width
, double height
)
1575 // void cairo_rectangle (cairo_t *cr, double x, double y, double width, double height);
1576 cairo_rectangle(cairo
, x
, y
, width
, height
);
1584 public void glyphPath(cairo_glyph_t
* glyphs
, int numGlyphs
)
1586 // void cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
1587 cairo_glyph_path(cairo
, glyphs
, numGlyphs
);
1594 public void textPath(char[] utf8
)
1596 // void cairo_text_path (cairo_t *cr, const char *utf8);
1597 cairo_text_path(cairo
, Str
.toStringz(utf8
));
1601 * Relative-coordinate version of cairo_curve_to(). All offsets are
1602 * relative to the current point. Adds a cubic Bzier spline to the
1603 * path from the current point to a point offset from the current
1604 * point by (dx3, dy3), using points offset by (dx1, dy1) and
1605 * (dx2, dy2) as the control points. After this call the current
1606 * point will be offset by (dx3, dy3).
1607 * Given a current point of (x, y), cairo_rel_curve_to (cr, dx1,
1608 * dy1, dx2, dy2, dx3, dy3) is logically equivalent to
1609 * cairo_curve_to (cr, x + dx1, y + dy1, x + dx2, y + dy2, x +
1611 * It is an error to call this function with no current point. Doing
1612 * so will cause cr to shutdown with a status of
1613 * CAIRO_STATUS_NO_CURRENT_POINT.
1617 * the X offset to the first control point
1619 * the Y offset to the first control point
1621 * the X offset to the second control point
1623 * the Y offset to the second control point
1625 * the X offset to the end of the curve
1627 * the Y offset to the end of the curve
1629 public void relCurveTo(double dx1
, double dy1
, double dx2
, double dy2
, double dx3
, double dy3
)
1631 // void cairo_rel_curve_to (cairo_t *cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
1632 cairo_rel_curve_to(cairo
, dx1
, dy1
, dx2
, dy2
, dx3
, dy3
);
1636 * Relative-coordinate version of cairo_line_to(). Adds a line to the
1637 * path from the current point to a point that is offset from the
1638 * current point by (dx, dy) in user space. After this call the
1639 * current point will be offset by (dx, dy).
1640 * Given a current point of (x, y), cairo_rel_line_to(cr, dx, dy)
1641 * is logically equivalent to cairo_line_to (cr, x + dx, y + dy).
1642 * It is an error to call this function with no current point. Doing
1643 * so will cause cr to shutdown with a status of
1644 * CAIRO_STATUS_NO_CURRENT_POINT.
1648 * the X offset to the end of the new line
1650 * the Y offset to the end of the new line
1652 public void relLineTo(double dx
, double dy
)
1654 // void cairo_rel_line_to (cairo_t *cr, double dx, double dy);
1655 cairo_rel_line_to(cairo
, dx
, dy
);
1659 * Begin a new sub-path. After this call the current point will offset
1661 * Given a current point of (x, y), cairo_rel_move_to(cr, dx, dy)
1662 * is logically equivalent to cairo_move_to (cr, x + dx, y + dy).
1663 * It is an error to call this function with no current point. Doing
1664 * so will cause cr to shutdown with a status of
1665 * CAIRO_STATUS_NO_CURRENT_POINT.
1673 public void relMoveTo(double dx
, double dy
)
1675 // void cairo_rel_move_to (cairo_t *cr, double dx, double dy);
1676 cairo_rel_move_to(cairo
, dx
, dy
);
1680 * Modifies the current transformation matrix (CTM) by translating the
1681 * user-space origin by (tx, ty). This offset is interpreted as a
1682 * user-space coordinate according to the CTM in place before the new
1683 * call to cairo_translate. In other words, the translation of the
1684 * user-space origin takes place after any existing transformation.
1688 * amount to translate in the X direction
1690 * amount to translate in the Y direction
1692 public void translate(double tx
, double ty
)
1694 // void cairo_translate (cairo_t *cr, double tx, double ty);
1695 cairo_translate(cairo
, tx
, ty
);
1699 * Modifies the current transformation matrix (CTM) by scaling the X
1700 * and Y user-space axes by sx and sy respectively. The scaling of
1701 * the axes takes place after any existing transformation of user
1706 * scale factor for the X dimension
1708 * scale factor for the Y dimension
1710 public void scale(double sx
, double sy
)
1712 // void cairo_scale (cairo_t *cr, double sx, double sy);
1713 cairo_scale(cairo
, sx
, sy
);
1717 * Modifies the current transformation matrix (CTM) by rotating the
1718 * user-space axes by angle radians. The rotation of the axes takes
1719 * places after any existing transformation of user space. The
1720 * rotation direction for positive angles is from the positive X axis
1721 * toward the positive Y axis.
1725 * angle (in radians) by which the user-space axes will be
1728 public void rotate(double angle
)
1730 // void cairo_rotate (cairo_t *cr, double angle);
1731 cairo_rotate(cairo
, angle
);
1735 * Modifies the current transformation matrix (CTM) by applying
1736 * matrix as an additional transformation. The new transformation of
1737 * user space takes place after any existing transformation.
1741 * a transformation to be applied to the user-space axes
1743 public void transform(cairo_matrix_t
* matrix
)
1745 // void cairo_transform (cairo_t *cr, const cairo_matrix_t *matrix);
1746 cairo_transform(cairo
, matrix
);
1750 * Modifies the current transformation matrix (CTM) by setting it
1755 * a transformation matrix from user space to device space
1757 public void setMatrix(cairo_matrix_t
* matrix
)
1759 // void cairo_set_matrix (cairo_t *cr, const cairo_matrix_t *matrix);
1760 cairo_set_matrix(cairo
, matrix
);
1764 * Stores the current transformation matrix (CTM) into matrix.
1768 * return value for the matrix
1770 public void getMatrix(cairo_matrix_t
* matrix
)
1772 // void cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
1773 cairo_get_matrix(cairo
, matrix
);
1777 * Resets the current transformation matrix (CTM) by setting it equal
1778 * to the identity matrix. That is, the user-space and device-space
1779 * axes will be aligned and one user-space unit will transform to one
1780 * device-space unit.
1784 public void identityMatrix()
1786 // void cairo_identity_matrix (cairo_t *cr);
1787 cairo_identity_matrix(cairo
);
1791 * Transform a coordinate from user space to device space by
1792 * multiplying the given point by the current transformation matrix
1797 * X value of coordinate (in/out parameter)
1799 * Y value of coordinate (in/out parameter)
1801 public void userToDevice(double* x
, double* y
)
1803 // void cairo_user_to_device (cairo_t *cr, double *x, double *y);
1804 cairo_user_to_device(cairo
, x
, y
);
1808 * Transform a distance vector from user space to device space. This
1809 * function is similar to cairo_user_to_device() except that the
1810 * translation components of the CTM will be ignored when transforming
1815 * X component of a distance vector (in/out parameter)
1817 * Y component of a distance vector (in/out parameter)
1819 public void userToDeviceDistance(double* dx
, double* dy
)
1821 // void cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
1822 cairo_user_to_device_distance(cairo
, dx
, dy
);
1826 * Transform a coordinate from device space to user space by
1827 * multiplying the given point by the inverse of the current
1828 * transformation matrix (CTM).
1832 * X value of coordinate (in/out parameter)
1834 * Y value of coordinate (in/out parameter)
1836 public void deviceToUser(double* x
, double* y
)
1838 // void cairo_device_to_user (cairo_t *cr, double *x, double *y);
1839 cairo_device_to_user(cairo
, x
, y
);
1843 * Transform a distance vector from device space to user space. This
1844 * function is similar to cairo_device_to_user() except that the
1845 * translation components of the inverse CTM will be ignored when
1846 * transforming (dx,dy).
1850 * X component of a distance vector (in/out parameter)
1852 * Y component of a distance vector (in/out parameter)
1854 public void deviceToUserDistance(double* dx
, double* dy
)
1856 // void cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
1857 cairo_device_to_user_distance(cairo
, dx
, dy
);
1864 * Selects a family and style of font from a simplified description as
1865 * a family name, slant and weight. This function is meant to be used
1866 * only for applications with simple font needs: Cairo doesn't provide
1867 * for operations such as listing all available fonts on the system,
1868 * and it is expected that most applications will need to use a more
1869 * comprehensive font handling and text layout library in addition to
1874 * a font family name, encoded in UTF-8
1876 * the slant for the font
1878 * the weight for the font
1880 public void selectFontFace(char[] family
, cairo_font_slant_t slant
, cairo_font_weight_t weight
)
1882 // void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight);
1883 cairo_select_font_face(cairo
, Str
.toStringz(family
), slant
, weight
);
1887 * Sets the current font matrix to a scale by a factor of size, replacing
1888 * any font matrix previously set with cairo_set_font_size() or
1889 * cairo_set_font_matrix(). This results in a font size of size user space
1890 * units. (More precisely, this matrix will result in the font's
1891 * em-square being a size by size square in user space.)
1895 * the new font size, in user space units
1897 public void setFontSize(double size
)
1899 // void cairo_set_font_size (cairo_t *cr, double size);
1900 cairo_set_font_size(cairo
, size
);
1904 * Sets the current font matrix to matrix. The font matrix gives a
1905 * transformation from the design space of the font (in this space,
1906 * the em-square is 1 unit by 1 unit) to user space. Normally, a
1907 * simple scale is used (see cairo_set_font_size()), but a more
1908 * complex font matrix can be used to shear the font
1909 * or stretch it unequally along the two axes
1913 * a cairo_matrix_t describing a transform to be applied to
1916 public void setFontMatrix(cairo_matrix_t
* matrix
)
1918 // void cairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix);
1919 cairo_set_font_matrix(cairo
, matrix
);
1923 * Stores the current font matrix into matrix. See
1924 * cairo_set_font_matrix().
1928 * return value for the matrix
1930 public void getFontMatrix(cairo_matrix_t
* matrix
)
1932 // void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix);
1933 cairo_get_font_matrix(cairo
, matrix
);
1937 * Sets a set of custom font rendering options for the cairo_t.
1938 * Rendering options are derived by merging these options with the
1939 * options derived from underlying surface; if the value in options
1940 * has a default value (like CAIRO_ANTIALIAS_DEFAULT), then the value
1941 * from the surface is used.
1945 * font options to use
1947 public void setFontOptions(cairo_font_options_t
* options
)
1949 // void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options);
1950 cairo_set_font_options(cairo
, options
);
1954 * Retrieves font rendering options set via cairo_set_font_options.
1955 * Note that the returned options do not include any options derived
1956 * from the underlying surface; they are literally the options
1957 * passed to cairo_set_font_options().
1961 * a cairo_font_options_t object into which to store
1962 * the retrieved options. All existing values are overwritten
1964 public void getFontOptions(cairo_font_options_t
* options
)
1966 // void cairo_get_font_options (cairo_t *cr, cairo_font_options_t *options);
1967 cairo_get_font_options(cairo
, options
);
1971 * A drawing operator that generates the shape from a string of UTF-8
1972 * characters, rendered according to the current font_face, font_size
1973 * (font_matrix), and font_options.
1974 * This function first computes a set of glyphs for the string of
1975 * text. The first glyph is placed so that its origin is at the
1976 * current point. The origin of each subsequent glyph is offset from
1977 * that of the previous glyph by the advance values of the previous
1979 * After this call the current point is moved to the origin of where
1980 * the next glyph would be placed in this same progression. That is,
1981 * the current point will be at the origin of the final glyph offset
1982 * by its advance values. This allows for easy display of a single
1983 * logical string with multiple calls to cairo_show_text().
1984 * NOTE: The cairo_show_text() function call is part of what the cairo
1985 * designers call the "toy" text API. It is convenient for short demos
1986 * and simple programs, but it is not expected to be adequate for the
1987 * most serious of text-using applications. See cairo_show_glyphs()
1988 * for the "real" text display API in cairo.
1992 * a string of text encoded in UTF-8
1994 public void showText(char[] utf8
)
1996 // void cairo_show_text (cairo_t *cr, const char *utf8);
1997 cairo_show_text(cairo
, Str
.toStringz(utf8
));
2005 public void showGlyphs(cairo_glyph_t
* glyphs
, int numGlyphs
)
2007 // void cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
2008 cairo_show_glyphs(cairo
, glyphs
, numGlyphs
);
2012 * Gets the current font face for a cairo_t.
2016 * the current font object. Can return NULL
2017 * on out-of-memory or if the context is already in
2018 * an error state. This object is owned by cairo. To keep
2019 * a reference to it, you must call cairo_font_face_reference().
2021 public cairo_font_face_t
* getFontFace()
2023 // cairo_font_face_t* cairo_get_font_face (cairo_t *cr);
2024 return cairo_get_font_face(cairo
);
2028 * Gets the font extents for the currently selected font.
2032 * a cairo_font_extents_t object into which the results
2035 public void fontExtents(cairo_font_extents_t
* extents
)
2037 // void cairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents);
2038 cairo_font_extents(cairo
, extents
);
2042 * Replaces the current cairo_font_face_t object in the cairo_t with
2043 * font_face. The replaced font face in the cairo_t will be
2044 * destroyed if there are no other references to it.
2048 * a cairo_font_face_t, or NULL to restore to the default font
2050 public void setFontFace(cairo_font_face_t
* fontFace
)
2052 // void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
2053 cairo_set_font_face(cairo
, fontFace
);
2057 * Replaces the current font face, font matrix, and font options in
2058 * the cairo_t with those of the cairo_scaled_font_t. Except for
2059 * some translation, the current CTM of the cairo_t should be the
2060 * same as that of the cairo_scaled_font_t, which can be accessed
2061 * using cairo_scaled_font_get_ctm().
2065 * a cairo_scaled_font_t
2068 public void setScaledFont(cairo_scaled_font_t
* scaledFont
)
2070 // void cairo_set_scaled_font (cairo_t *cr, const cairo_scaled_font_t *scaled_font);
2071 cairo_set_scaled_font(cairo
, scaledFont
);
2075 * Gets the extents for a string of text. The extents describe a
2076 * user-space rectangle that encloses the "inked" portion of the text,
2077 * (as it would be drawn by cairo_show_text()). Additionally, the
2078 * x_advance and y_advance values indicate the amount by which the
2079 * current point would be advanced by cairo_show_text().
2080 * Note that whitespace characters do not directly contribute to the
2081 * size of the rectangle (extents.width and extents.height). They do
2082 * contribute indirectly by changing the position of non-whitespace
2083 * characters. In particular, trailing whitespace characters are
2084 * likely to not affect the size of the rectangle, though they will
2085 * affect the x_advance and y_advance values.
2089 * a string of text, encoded in UTF-8
2091 * a cairo_text_extents_t object into which the results
2094 public void textExtents(char[] utf8
, cairo_text_extents_t
* extents
)
2096 // void cairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents);
2097 cairo_text_extents(cairo
, Str
.toStringz(utf8
), extents
);
2101 * Gets the extents for an array of glyphs. The extents describe a
2102 * user-space rectangle that encloses the "inked" portion of the
2103 * glyphs, (as they would be drawn by cairo_show_glyphs()).
2104 * Additionally, the x_advance and y_advance values indicate the
2105 * amount by which the current point would be advanced by
2106 * cairo_show_glyphs.
2107 * Note that whitespace glyphs do not contribute to the size of the
2108 * rectangle (extents.width and extents.height).
2112 * an array of cairo_glyph_t objects
2114 * the number of elements in glyphs
2116 * a cairo_text_extents_t object into which the results
2119 public void glyphExtents(cairo_glyph_t
* glyphs
, int numGlyphs
, cairo_text_extents_t
* extents
)
2121 // void cairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents);
2122 cairo_glyph_extents(cairo
, glyphs
, numGlyphs
, extents
);