[cairo] cairo arc drawing limitation
Fabien Costantini
fab672000 at yahoo.fr
Thu Aug 31 05:55:21 PDT 2006
So if one of us develop a new cairo function, let's say draw_chord()
that achieves the functionnalities below
(like drawing an ellipse without touching the transformation matrix)
with an additional radius_y parameter like :
void cairo_chord(cairo_t *cr,
double xc,
double yc,
double radius_x,
double radius_y,
double angle1,
double angle2);Would there be chances that it is accepted as a contrib,
and would there be special recommandations to follow ?
(i.e: adding a draw_chord_negative() api as well to stay orthogonal with previous arc api)
Fabien
----- Message d'origine ----
De : Behdad Esfahbod <behdad at behdad.org>
À : Fabien Costantini <fab672000 at yahoo.fr>
Envoyé le : Lundi, 10 Juillet 2006, 5h01mn 11s
Objet : Re: [cairo] cairo arc drawing limitation
On Mon, 2006-07-10 at 06:21 -0400, Fabien Costantini wrote:
> Hi I just dived in documentation, and noticed that the only way to get an ellipse
> path drawn seems to use the transformation matrix.
>
> This approach, though at first sight elegant, seems quite limitative to me, in effect :
>
> 1. To achieve a scale, you have to know what is the current scaling policies, in particular, when dimensions are not in the [0,1] space but in standard pixel width,height coordinates; it implies that you keep track of the width and height of your current drawing surface to achieve aa correct scale. Also a matrix translate accumulation has to be done (and possibly the inverse translate after the operation)
>
> 2. most of the time you have to save and restore the context, that could be be avoided
>
> Wouldn't it be faster to run and simpler to code
> just to add one parameter to specify a height possibly different from the width in cairo_arc()
> andd cairo_negative_arc() ?
>
> It would then be more orthogonal with other path construction API like cairo_rectangle()
> (there is fortunately no need to use a cairo_square() function and a transformation matrix to draw a rectangle)
>
> Any thoughts ?
I tend to agree. It's just too hard to draw a rectangle with rounded
corners that are parts of an ellipse.
One more thing that comes to mind is the pen width discussion. Without
locked pen width, it's a bit limiting to use cairo_scale to draw
ellipses.
behdad
> Fabien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20060831/d2415b43/attachment.html
More information about the cairo
mailing list