![]() |
![]() |
![]() |
Cairo: A Vector Graphics Library | ![]() |
---|---|---|---|---|
typedef cairo_t; cairo_t* cairo_create (cairo_surface_t *target); cairo_t* cairo_reference (cairo_t *cr); void cairo_destroy (cairo_t *cr); cairo_status_t cairo_status (cairo_t *cr); void cairo_save (cairo_t *cr); void cairo_restore (cairo_t *cr); cairo_surface_t* cairo_get_target (cairo_t *cr); void cairo_push_group (cairo_t *cr); void cairo_push_group_with_content (cairo_t *cr, cairo_content_t content); cairo_pattern_t* cairo_pop_group (cairo_t *cr); void cairo_pop_group_to_source (cairo_t *cr); cairo_surface_t* cairo_get_group_target (cairo_t *cr); void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue); void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha); void cairo_set_source (cairo_t *cr, cairo_pattern_t *source); void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y); cairo_pattern_t* cairo_get_source (cairo_t *cr); enum cairo_antialias_t; void cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias); cairo_antialias_t cairo_get_antialias (cairo_t *cr); void cairo_set_dash (cairo_t *cr, double *dashes, int num_dashes, double offset); enum cairo_fill_rule_t; void cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule); cairo_fill_rule_t cairo_get_fill_rule (cairo_t *cr); enum cairo_line_cap_t; void cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap); cairo_line_cap_t cairo_get_line_cap (cairo_t *cr); enum cairo_line_join_t; void cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join); cairo_line_join_t cairo_get_line_join (cairo_t *cr); void cairo_set_line_width (cairo_t *cr, double width); double cairo_get_line_width (cairo_t *cr); void cairo_set_miter_limit (cairo_t *cr, double limit); double cairo_get_miter_limit (cairo_t *cr); enum cairo_operator_t; void cairo_set_operator (cairo_t *cr, cairo_operator_t op); cairo_operator_t cairo_get_operator (cairo_t *cr); void cairo_set_tolerance (cairo_t *cr, double tolerance); double cairo_get_tolerance (cairo_t *cr); void cairo_clip (cairo_t *cr); void cairo_clip_preserve (cairo_t *cr); void cairo_reset_clip (cairo_t *cr); void cairo_fill (cairo_t *cr); void cairo_fill_preserve (cairo_t *cr); void cairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2); cairo_bool_t cairo_in_fill (cairo_t *cr, double x, double y); void cairo_mask (cairo_t *cr, cairo_pattern_t *pattern); void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y); void cairo_paint (cairo_t *cr); void cairo_paint_with_alpha (cairo_t *cr, double alpha); void cairo_stroke (cairo_t *cr); void cairo_stroke_preserve (cairo_t *cr); void cairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2); cairo_bool_t cairo_in_stroke (cairo_t *cr, double x, double y); void cairo_copy_page (cairo_t *cr); void cairo_show_page (cairo_t *cr);
cairo_t is the main object used when drawing with cairo. To
draw with cairo, you create a cairo_t, set the target surface,
and drawing options for the cairo_t, create shapes with
functions like cairo_move_to()
and cairo_line_to()
, and then
draw shapes with cairo_stroke()
or cairo_fill()
.
cairo_t's can be pushed to a stack via cairo_save()
.
They may then safely be changed, without loosing the current state.
Use cairo_restore()
to restore to the saved state.
typedef struct _cairo cairo_t;
A cairo_t contains the current state of the rendering device, including coordinates of yet to be drawn shapes.
void cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
Since 1.2
void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha);
void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y);
typedef enum _cairo_antialias { CAIRO_ANTIALIAS_DEFAULT, CAIRO_ANTIALIAS_NONE, CAIRO_ANTIALIAS_GRAY, CAIRO_ANTIALIAS_SUBPIXEL } cairo_antialias_t;
Specifies the type of antialiasing to do when rendering text or shapes.
typedef enum _cairo_fill_rule { CAIRO_FILL_RULE_WINDING, CAIRO_FILL_RULE_EVEN_ODD } cairo_fill_rule_t;
cairo_fill_rule_t is used to select how paths are filled. For both fill rules, whether or not a point is included in the fill is determined by taking a ray from that point to infinity and looking at intersections with the path. The ray can be in any direction, as long as it doesn't pass through the end point of a segment or have a tricky intersection such as intersecting tangent to the path. (Note that filling is not actually implemented in this way. This is just a description of the rule that is applied.)
typedef enum _cairo_line_cap { CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE } cairo_line_cap_t;
enumeration for style of line-endings
typedef enum _cairo_line_join { CAIRO_LINE_JOIN_MITER, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_JOIN_BEVEL } cairo_line_join_t;
typedef enum _cairo_operator { CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, CAIRO_OPERATOR_OVER, CAIRO_OPERATOR_IN, CAIRO_OPERATOR_OUT, CAIRO_OPERATOR_ATOP, CAIRO_OPERATOR_DEST, CAIRO_OPERATOR_DEST_OVER, CAIRO_OPERATOR_DEST_IN, CAIRO_OPERATOR_DEST_OUT, CAIRO_OPERATOR_DEST_ATOP, CAIRO_OPERATOR_XOR, CAIRO_OPERATOR_ADD, CAIRO_OPERATOR_SATURATE } cairo_operator_t;
void cairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);
void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y);
void cairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2);