Adds a circular arc of the given radius to the current path. The arc is centered at (xc, yc), begins at angle1 and proceeds in the direction of increasing angles to end at angle2. If angle2 is less than angle1 it will be progressively increased by <literal>2*M_PI</literal> until it is greater than angle1.

cairo_arc(cr, xc, yc, radius, angle1, angle2)

Arguments

cr

[cairo_t *] a cairo context

xc

[double] X position of the center of the arc

yc

[double] Y position of the center of the arc

radius

[double] the radius of the arc

angle1

[double] the start angle, in radians

angle2

[double] the end angle, in radians

Details

If there is a current point, an initial line segment will be added to the path to connect the current point to the beginning of the arc. If this initial line is undesired, it can be avoided by calling cairo_new_sub_path() before calling cairo_arc().

Angles are measured in radians. An angle of 0.0 is in the direction of the positive X axis (in user space). An angle of <literal>M_PI/2.0</literal> radians (90 degrees) is in the direction of the positive Y axis (in user space). Angles increase in the direction from the positive X axis toward the positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.

(To convert from degrees to radians, use <literal>degrees * (M_PI / 180.)</literal>.)

This function gives the arc in the direction of increasing angles; see cairo_arc_negative() to get the arc in the direction of decreasing angles.

The arc is circular in user space. To achieve an elliptical arc, you can scale the current transformation matrix by different amounts in the X and Y directions. For example, to draw an ellipse in the box given by x, y, width, height:

<informalexample><programlisting> cairo_save (cr); cairo_translate (cr, x + width / 2., y + height / 2.); cairo_scale (cr, width / 2., height / 2.); cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI); cairo_restore (cr); </programlisting></informalexample>

Since: 1.0

C function prototype: void cairo_arc (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2)

See also

Other cairo--: cairo_append_path(), cairo_arc_negative(), cairo_clip_extents(), cairo_clip_preserve(), cairo_clip(), cairo_close_path(), cairo_copy_page(), cairo_copy_path_flat(), cairo_copy_path(), cairo_create(), cairo_curve_to(), cairo_device_to_user_distance(), cairo_device_to_user(), cairo_fill_extents(), cairo_fill_preserve(), cairo_fill(), cairo_font_extents(), cairo_get_antialias(), cairo_get_current_point(), cairo_get_dash_count(), cairo_get_dash(), cairo_get_fill_rule(), cairo_get_font_face(), cairo_get_font_matrix(), cairo_get_group_target(), cairo_get_line_cap(), cairo_get_line_join(), cairo_get_line_width(), cairo_get_matrix(), cairo_get_miter_limit(), cairo_get_operator(), cairo_get_source(), cairo_get_target(), cairo_get_tolerance(), cairo_has_current_point(), cairo_identity_matrix(), cairo_in_clip(), cairo_in_fill(), cairo_in_stroke(), cairo_line_to(), cairo_mask_surface(), cairo_mask(), cairo_move_to(), cairo_new_path(), cairo_new_sub_path(), cairo_paint_with_alpha(), cairo_paint(), cairo_path_extents(), cairo_pop_group_to_source(), cairo_pop_group(), cairo_push_group_with_content(), cairo_push_group(), cairo_rectangle(), cairo_rel_curve_to(), cairo_rel_line_to(), cairo_rel_move_to(), cairo_reset_clip(), cairo_restore(), cairo_rotate(), cairo_save(), cairo_scale(), cairo_select_font_face(), cairo_set_antialias(), cairo_set_dash(), cairo_set_fill_rule(), cairo_set_font_face(), cairo_set_font_matrix(), cairo_set_font_size(), cairo_set_line_cap(), cairo_set_line_join(), cairo_set_line_width(), cairo_set_matrix(), cairo_set_miter_limit(), cairo_set_operator(), cairo_set_source_rgba(), cairo_set_source_rgb(), cairo_set_source_surface(), cairo_set_source(), cairo_set_tolerance(), cairo_show_page(), cairo_show_text(), cairo_status(), cairo_stroke_extents(), cairo_stroke_preserve(), cairo_stroke(), cairo_tag_begin(), cairo_tag_end(), cairo_text_extents(), cairo_text_path(), cairo_transform(), cairo_translate(), cairo_user_to_device_distance(), cairo_user_to_device()