W3C home > Mailing lists > Public > public-html@w3.org > July 2011

Re: hit testing and retained graphics

From: Maciej Stachowiak <mjs@apple.com>
Date: Fri, 01 Jul 2011 17:21:25 -0700
Cc: Richard Schwerdtfeger <schwer@us.ibm.com>, public-canvas-api@w3.org, public-html@w3.org, public-html-a11y@w3.org, jbrewer@w3.org
Message-id: <924E4C9D-70ED-40A5-9124-C5094174E949@apple.com>
To: Edward O'Connor <eoconnor@apple.com>

On Jul 1, 2011, at 1:14 PM, Edward O'Connor wrote:

> 
> 
> Here's a sketch of a simple-as-possible path object for enhanced hit
> testing support in <canvas> that may be more palatable to implementors.
> Suppose the 2d context API had a method to get the current path. An
> author calls this method after drawing some path onto the <canvas> and
> squirrels away the returned object foo. Later on, in a click handler on
> the <canvas>, the author can call foo.isPointInPath(x,y) to see if the
> click has happened in that path. Some things to note about this
> proposal:

Interesting idea. Explicit Path objects would be a useful addition to the canvas API beyond hit testing. For example, you could easily construct a path and reuse for drawing multiple time. This would require the ability to stroke or fill paths given a path object in addition to the hit testing support.

Personally I think it was an oversight in the original canvas API that it only has a current path and not path objects. Many other graphics APIs (including CoreGraphics, the API that inspired canvas) have explicit objects for paths.

Regards,
Maciej
Received on Saturday, 2 July 2011 00:22:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:17:36 GMT