Re: Please consider elliptical arc in canvas

It'd be nice. The programming-method (using cubic bezier) has been used 
and copied by many coders.
It's certainly not easy.

Antoine Quint and Kevin Lindsey were good enough to release CanvaSVG 
into the public domain, no attribution required.
They skipped implementing the "A" command.
http://code.google.com/p/canvasvg/

We've also skipped it in most of our projects.
arc implementations had a difficult introduction:
https://bugzilla.mozilla.org/show_bug.cgi?id=471281

Note that Canvas does not support even-odd fills, either. Mozilla has 
added an extension for their own use, as they're implementing PDF.

I've long since given up on that battle. It's just not been much of an 
issue.

I'll focus my efforts on getting the drawPath-style command added. I do 
understand that even-odd and arc commands are an issue
with low-level Canvas implementations of SVG. SVG itself has varying 
support with vendors. We use openclipart.org as a baseline
for what should be in a basic SVG implementation. We've done fairly well 
in that area.

The StackBlur algo has been a big help:
http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html


-Charles


On 11/13/2011 6:37 PM, Shaofei Cheng wrote:
> That will be fine.
> But if a drawPath-style API is added and "A" command is supported, I 
> think still the ellipse arc api is needed to to keep the two API set 
> of path align.
>
>
> At 2011-11-14 04:47:33,"Charles Pritchard" <chuck@jumis.com> wrote:
>
>     There seems to be consensus that a drawPath-style method can be
>     added to Canvas 2d. So you'd no longer need an svg path
>     implementation.
>
>     Would that sufficiently address the issue?
>
>     -Charles
>
>
>
>     On Nov 13, 2011, at 3:27 AM, "Shaofei Cheng" <csf178@163.com
>     <mailto:csf178@163.com>> wrote:
>
>>     Hey guys,
>>     These days I'm working on a simple wrapping of canvas and just
>>     noticed that canvas leaks of elliptical canvas.arc APIs for path.
>>
>>     What I want to implement is like the following:
>>
>>     var canvas = new CanvasWraper(myCanvas);
>>     canvas.drawPath("M200,300 Q400,50 600,300 T1000,300");
>>
>>     The main purpose is to draw a path in canvas in SVG grammar.
>>     Everything goes well except the "A" command. Canvas 2d context do
>>     not have a API for arc of ellipse. So in the following
>>     picture(which is a sample of SVG). The left graph could be draw
>>     with canvas but the right could not.
>>     This path grammar is also supported by silverlight.
>>
>>     So I suggest to add a elliptical arc API for path. With that we
>>     can keep the feature align with SVG.Also I think elliptical arc
>>     could be useful for some graphics games.
>>
>>     (We are able to approx elliptical arc with cubic bezer, but I
>>     think the algorithm is too complex for web developers )
>>
>>
>>     Thanks,
>>     Shaofei Cheng
>>
>>
>>
>>
>>
>>
>
>

Received on Tuesday, 15 November 2011 02:28:41 UTC