[cairo] Arcs appear thicker than straight lines?
sandmann at cs.au.dk
Fri Dec 23 09:26:04 PST 2011
Yifan Yu <yvifan at gmail.com> writes:
> Hi, I'm trying to draw a simple rounded rectangle with four little arcs, using
> one of the methods described here. The result is fine, with just one problem:
> the arc lines appear thicker in line width than the straight lines (estimated
> as twice as thick, while the straight lines are thin and sharp). This is
> especially annoying when the radius of the arcs is small. Is it possible to
> make the arc lines as sharp and thin as the straight lines?
One thing that can cause this is if you are drawing in such a way that
half the straight line is sticking outside the surface you are drawing
on, which can happen if you are using coordinates of 0.0 with a line
width of 1.0.
In cairo, (0, 0) refers to the top left corner of the top left pixel of
the surface, and (0.5, 0.5) refers to the center of the top left
pixel. So to draw a rounded border with line width 1 on such a surface,
you want want to do something like
cairo_move_to (0.5, 10)
cairo_curve_to (..., 10, 0.5);
cairo line_to (width, 0.5)
Ie., using 0.5 and not 0.0. See also
More information about the cairo