[cairo] how do you draw an outline of a circle/ellipse

Mark Olesen markjolesen at gmail.com
Wed Nov 11 00:32:23 PST 2015


I am unable to create an outline of a circle/ellipse.
cairo_stroke below fills instead of creating an outline.
Any ideas?

double width= 100;
double height= 100;
double x= 100;
double y= 100;

cairo_save (cr);
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
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_stroke (cr);
cairo_restore (cr);

Following is the version of cairo I am using:
lrwxrwxrwx 1 root root      21 Oct 31 05:03 /usr/lib/libcairo.so ->
libcairo.so.2.11400.4
lrwxrwxrwx 1 root root      21 Oct 31 05:03 /usr/lib/libcairo.so.2 ->
libcairo.so.2.11400.4
-rwxr-xr-x 1 root root 1236288 Oct 31 05:03 /usr/lib/libcairo.so.2.11400.4

If I get rid of scale, and put in a value for radius, such as 10, it will
draw the outline. However, I will need cairo_scale to create an ellipse.


Thanks in advance,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20151111/20a16dc1/attachment.html>


More information about the cairo mailing list