W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2014

Re: [whatwg] Drawing shapes on canvas

From: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 18 Feb 2014 13:37:54 -0800
Message-ID: <CAGN7qDBjbhKBxVpwreix1e7N1PjbksCq4f31Qe1XDRjVbF+UTw@mail.gmail.com>
To: Joe Gregorio <jcgregorio@google.com>
Cc: whatwg <whatwg@lists.whatwg.org>
On Thu, Jan 30, 2014 at 2:14 PM, Joe Gregorio <jcgregorio@google.com> wrote:

>
>
>
> On Mon, Jan 27, 2014 at 9:28 PM, Rik Cabanier <cabanier@gmail.com> wrote:
>
>> On Mon, Jan 27, 2014 at 3:15 PM, Joe Gregorio <jcgregorio@google.com>wrote:
>>
>>> Agreed on the complexity and the interactions. Unfortunately dropping
>>> all of them but addPath does seem to leave
>>> Path with a hole in functionality since CanvasRenderingContext2D has
>>> both a fillText() and strokeText(). How about simplifying
>>> to just these two add* methods:
>>>
>>>   void addPath(Path path, SVGMatrix? transformation);
>>>   void addText(DOMString text, SVGMatrix? transformation, unrestricted
>>> double x, unrestricted double y, optional unrestricted double maxWidth);
>>>
>>> Note the removal of the CanvasDrawingStyles from addText.
>>>
>>
>> Unfortunately, that doesn't really help.
>>  For instance, let's say you request the path for the letter 'o'. It's
>> represented by 2 closed paths.
>> What winding rule should you use when you fill that path? Should the
>> paths be oriented so you have to use a NZO fill or so you can use any
>> winding rule?
>>
>> What happens if the path for a letter intersect with another path (or
>> another letter)?
>>
>
> OK, I'm convinced that's going to be not very useful for filling if there
> aren't some
> guarantees about the winding of the resulting path, which is a hard
> problem.
> So I'm fine with just sticking to addPath, which I think was your original
> proposal ;-)
>
>   void addPath(Path path, SVGMatrix? transformation);
>

Thanks Joe!
Some people were unhappy with the SVGMatrix in the argument list but unless
we have something better soon, it's fine to implement. (We can always use a
union later)

Ian, could you remove the other APIs from the spec:

void addPathByStrokingPath(Path path, CanvasDrawingStyles styles,
SVGMatrix? transformation);
void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix?
transformation, unrestricted double x, unrestricted double y, optional
unrestricted double maxWidth);
void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles,
SVGMatrix? transformation, unrestricted double x, unrestricted double y,
optional unrestricted double maxWidth);
void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix?
transformation, Path path, optional unrestricted double maxWidth);
void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles,
SVGMatrix? transformation, Path path, optional unrestricted double
maxWidth);

No one has implemented them and they are confusing the browser vendors.
Until we have support for shapes, the output of these methods won't be
stable.
Received on Tuesday, 18 February 2014 21:38:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:16 UTC