[cairo-bugs] [Bug 24442] New cairo_path_t method - cairo_rounded_rectangle

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Oct 10 08:19:15 PDT 2009


http://bugs.freedesktop.org/show_bug.cgi?id=24442





--- Comment #1 from Kevin DeKorte <kdekorte at yahoo.com>  2009-10-10 08:19:13 PST ---
Version with a little less math

void cairo_rounded_rectangle(cairo_t *cr, double x, double y, double width,
double height, double radius)
{

        cairo_new_sub_path(cr);
        cairo_arc(cr, x + radius, y + height - radius, radius, 0.5 * M_PI,
M_PI);
        cairo_line_to(cr, x, y + radius);
        cairo_new_sub_path(cr);
        cairo_arc(cr, x + radius, y + radius, radius, M_PI, 1.5 * M_PI);
        cairo_line_to(cr, x + width - radius, y);
        cairo_new_sub_path(cr);
        cairo_arc(cr, x + width - radius, y + radius, radius, 1.5 * M_PI, 2.0 *
M_PI);
        cairo_line_to(cr, x + width, y + height - radius);
        cairo_new_sub_path(cr);
        cairo_arc(cr, x + width - radius, y + height - radius, radius, 2.0 *
M_PI, 0.5 * M_PI);
        cairo_line_to(cr, x + radius, y + height);

}


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list