W3C home > Mailing lists > Public > public-canvas-api@w3.org > October to December 2011

Re:Re: Please consider elliptical arc in canvas

From: Shaofei Cheng <csf178@163.com>
Date: Mon, 14 Nov 2011 12:11:15 +0800 (CST)
To: "Shaofei Cheng" <csf178@163.com>
Cc: "Charles Pritchard" <chuck@jumis.com>, "public-canvas-api@w3.org" <public-canvas-api@w3.org>
Message-ID: <3216cfd4.ca94.133a0459a0b.Coremail.csf178@163.com>
Comparing to drawPath-style API, I would prefer a elliptical arc api. For drawPath-style API could be implemented by user if we have elliptical arc api. (The atteched js file is a simple implement of  drawPath-style API)But elliptical arc api could not be implemented with  drawPath-style path api.

Besides, if beginPath-style APIs are not removed. Users would expect the only difference between the two API sets is code style. But in fact, the "A" command do not have replacement in beginPath-style API set.

At 2011-11-14 10:37:25,"Shaofei Cheng" <csf178@163.com> 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?


On Nov 13, 2011, at 3:27 AM, "Shaofei Cheng" <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 )

Shaofei Cheng

Received on Monday, 14 November 2011 04:11:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:31:54 UTC