W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2006

[whatwg] Canvas 2d methods

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 03 Jul 2006 14:53:31 -0700
Message-ID: <002901c69eeb$203d28a0$3401a8c0@TERRA>

----- Original Message ----- 
From: "David Hyatt" <hyatt@apple.com>
To: "WHAT Working Group Mailing List" <whatwg at whatwg.org>
Cc: "Ian Hickson" <ian at hixie.ch>; "H?kon Wium Lie" <howcome at opera.com>; 
"Vladimir Vukicevic" <vladimir at pobox.com>; "Andrew Fedoniouk" 
<news at terrainformatica.com>; "Benjamin Joffe" <canvasgame at gmail.com>
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
> (hyatt at apple.com)

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).

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 
Implementation can cache them if creation of such is expensive in particular 

Andrew Fedoniouk.
Received on Monday, 3 July 2006 14:53:31 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:47 UTC