----- Original Message -----
From: "David Hyatt" <[EMAIL PROTECTED]>
To: "WHAT Working Group Mailing List" <[EMAIL PROTECTED]>
Cc: "Ian Hickson" <[EMAIL PROTECTED]>; "Håkon Wium Lie" <[EMAIL PROTECTED]>;
"Vladimir Vukicevic" <[EMAIL PROTECTED]>; "Andrew Fedoniouk"
<[EMAIL PROTECTED]>; "Benjamin Joffe" <[EMAIL PROTECTED]>
Sent: Monday, July 03, 2006 2:02 PM
Subject: Re: [whatwg] Canvas 2d methods
I don't think it's intuitive to support chaining only on those methods
that happen to return null right now.
dave
([EMAIL PROTECTED])
Dave, take a look on this from different angle:
Typicall design of drawing surface wrappers (2d contexts) is a set of
methods -
"graphical stream commands". set pen, set brush, move here, draw up to
there, etc.
Such command/methods does not need to return anything. So they can return
context itself to use chained calls.
There are obvious exceptions from this rule (create*** methods).
http://whatwg.org/specs/web-apps/current-work/#the-2d
So I would rephrase "there are methods that happen to return *not*
null right now"
While I am on this....
I think that methods like
CanvasGradient createLinearGradient(x0, y0, x1, y1);
can be changed to
Context setLinearGradient(x0, y0, x1, y1);
They create gradient brush and set is a current. Why do we need this two
stage process: create then set?
And I think that these CanvasGradient don't need to be seen in script at
all.
Implementation can cache them if creation of such is expensive in particular
engine.
Andrew Fedoniouk.
http://terrainformatica.com