[whatwg] Usemap and ismap for canvas tag

ddailey ddailey at zoominternet.net
Tue Mar 4 19:47:15 PST 2008


Greg, I remember seeing the quote here:
> "<canvas> is designed for creating images dynamically in scripts. SVG
> focuses on pre-computed image documents, and is more complex and
> slower to generate dynamically."

at some point in time and thinking to myself that it was basically 
inaccurate. I realize it is probably not you who wrote this delightful 
aphorism of guidance for the rest of us, so it is not with you that I would 
raise objection.

 For me, SVG does not at all focus on pre-computed image documents, but 
rather it is because of its dynamic qualities that I use it.  It is more 
complex than canvas, that is for sure. I think in terms of speed, though, it 
all depends on what you are doing. Try running a Gaussian blur of a 
dynamically generated mouse-driven turbulence displacement of a bitmap 
through your own JavaScript on a canvas image -- then let's talk benchmarks. 
[references available upon request]

But certainly and absolutely I would have never shown SVG more than a 
passing glance if it had been focused on pre-computed image documents -- how 
boring! VML was perfectly interactive and canvas-like for most mundane 
purposes, it just didn't have bitblits. If MS had had the foresight to put 
bitblits in VML we'd all be using Silverlight now and Microsoft would buy 
Google. </kidding>

I think the aphoristic quote may have propagated from the relatively 
confined arena of WHATWG to the more noticeable archives of the W3C (am not 
sure about this) but it might be nice for whoever runs the canvas boat to 
steer the comparison a little more precisely.

regards,
David


----- Original Message ----- 
From: "Greg Houston" <gregory.houston at gmail.com>
To: <whatwg at lists.whatwg.org>
Sent: Monday, March 03, 2008 11:40 PM
Subject: Re: [whatwg] Usemap and ismap for canvas tag


>> Wouldn't it make more sense just to use SVG?
>
> Dynamic interactive charts and graphs seem to fall into the gray area
> between what is more appropriate for canvas or SVG.
>
> "<canvas> is designed for creating images dynamically in scripts. SVG
> focuses on pre-computed image documents, and is more complex and
> slower to generate dynamically."
>
> So canvas is tuned more for creating dynamic charts and graphs whereas
> SVG is better apt for static sprites and interface elements with the
> bonus that it "can automatically detect interaction".
>
> WHATWG SVG and Canvas Comparison:
> http://wiki.whatwg.org/wiki/SVG_and_canvas
>
> My second idea of being able to add canvas shapes directly to the DOM
> may be too much. Though since canvas "renders onto a fixed-resolution
> bitmap" and is basically a flat image, giving the canvas element the
> usemap and ismap properties doesn't seem like it would be a big issue.
> Browser agents could probably use pretty much the exact same code for
> both the img and canvas tag where image maps are concerned. The
> benefit would be being able to add hot spots for links and tooltips to
> canvas drawings. It seems silly that something as dynamic as the
> canvas element would have less interactivity than the img element.
>
> Greg
>
> 





More information about the whatwg mailing list