Re: [whatwg] canvas 2d's ellipse

I think the API should look like this:

void ellipse(unrestricted double x, optional unrestricted double y,
unrestricted double radiusX, optional unrestricted double radiusY, optional
unrestricted double rotation, optional unrestricted double startAngle,
optional unrestricted double endAngle, optional boolean anticlockwise);


with the following behavior:
- if radiusY is omitted, it's the same as radiusX
- if rotation is omitted, it's equal to 0
- if startAngle is omitted, it's equal to 0
- if endAngle is omitted, it's equal to 0
- if anticlockwise is omitted, it's equal to false

startAngle and endAngle always refer to points on the circle. If they
coincide, the end result is a full circle (with a closepath).

On Tue, Apr 30, 2013 at 2:20 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> People on the blink team are starting to implement 'ellipse' [1].
> Looking at this API, I have a couple of questions:
>
> 1. Why are most of the parameters not optional?
> Currently, none of the parameter to ellipse are optional.
> So, if you want to draw a simple circle, you have to supply 8 parameters,
> even though only 3 are needed.
> All other calls have anticlockwise optional, why not ellipse?
>
> 2. when is an ellipse closed?
> It's not clear from the prose if there is ever a 'closepath'. So, if you
> have square end caps, you will see a discontinuity unless you call
> 'closepath'.
>
> 3. the following lines are somewhat confusing:
>
> If the anticlockwise argument false and endAngle-startAngle is equal to or
> greater than 2ð, or, if the anticlockwise argument is true
> andstartAngle-endAngle is equal to or greater than 2ð, then the arc is the
> whole circumference of this ellipse.
>
> and:
>
> Since the points are on the ellipse, as opposed to being simply angles
> from zero, the arc can never cover an angle greater than 2ð radians.
>
> Why not simply say that the angles define the points on the ellips and
> draw the arc between them? That seems more clear.
>
> 1:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-ellipse
>

Received on Wednesday, 1 May 2013 04:13:00 UTC