[cairo] Elliptical Arcs

Peter p.schregle at impuls-imaging.com
Fri Mar 28 08:57:21 PDT 2008


"Adrian Johnson" <ajohnson at redneon.com> schrieb im Newsbeitrag 
news:47ECFFAA.1060000 at redneon.com...
> Peter wrote:
>> Is it planned to have elliptical arcs within Cairo?
>>
>> The suggested procedure of scaling a circular arc with a transform seems 
>> not
>> to work with 'thick' arcs, since the outline thickness is scaled as well.
>
> The way to do this is to transform the ctm before calling cairo_arc() to
> get the elliptical shape, then restore the ctm before calling
> cairo_stroke(). Once the path is set, changing the ctm will not change
> the path. The stroke pen shape is based on the current ctm, not the ctm
> when the path was set.
>
> For example:
>
>    cairo_save (cr);
>    cairo_scale (cr, 1, 2);
>    cairo_arc (cr, 100, 100, 50, 0, 2*M_PI);
>    cairo_restore (cr);
>    cairo_set_line_width (cr, 10);
>    cairo_stroke(cr);

Thanks, that works for me. 





More information about the cairo mailing list