W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2010

[whatwg] CSS canvas() function

From: Robert O'Callahan <robert@ocallahan.org>
Date: Wed, 24 Nov 2010 13:59:49 +1300
Message-ID: <AANLkTimbfZ2tO8BiV6M97M+s430yUmp9VbKcGOHDc99G@mail.gmail.com>
On Wed, Nov 24, 2010 at 1:13 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> Webkit has for some time now supported using the -webkit-canvas()
> function in CSS anywhere you could use an image
> (<http://webkit.org/blog/176/css-canvas-drawing/>, published in April
> 2008).  The function takes an ident, which can then be used in the
> window.getCSSCanvasContext() function in javascript to grab a context
> keyed to that ident.  Drawing on that context is then reflected
> everywhere on the page that references that canvas.
>
> In essence, this is defining a scriptable paint server, which seems
> useful enough that we'd really like it in the platform.
>

Out of interest, what use-cases do you have for this? Mozilla people
couldn't think of many that aren't already addressed by other means.

I'm willing to define a canvas() function in the CSS Image Values
> specification, but since this relies explicitly on an HTML feature, it
> feels like the full definition should exist in the HTML spec.
>

One of our goals for element() was to subsume canvas(). Is there a reason to
have an independent canvas() feature if we have element()?

Note that the setImageElement() API lets you render elements that are not in
a document, so you can get the effect of window.getCSSCanvasContext(type,
id, width, height) with
  var c = document.createElement("canvas");
  c.width = width; c.height = height;
  window.setImageElement(id, c);
  return c.getContext(type);

http://hacks.mozilla.org/2010/08/mozelement/

Rob
-- 
"Now the Bereans were of more noble character than the Thessalonians, for
they received the message with great eagerness and examined the Scriptures
every day to see if what Paul said was true." [Acts 17:11]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20101124/ecff0f35/attachment-0001.htm>
Received on Tuesday, 23 November 2010 16:59:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC