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

Re: [whatwg] isPointInPath v. set of pixels in canvas hit regions

From: Simon Fraser <smfr@me.com>
Date: Thu, 05 Jul 2012 16:03:40 -0700
Message-id: <88EF7EF2-A945-4A38-B4AD-E50187AD8915@me.com>
To: Ian Hickson <ian@hixie.ch>
Cc: whatwg@lists.whatwg.org, Edward O'Connor <eoconnor@apple.com>
On Jul 5, 2012, at 2:25 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 5 Jul 2012, Edward O'Connor wrote:
>> 
>> As things currently stand in the spec, implementations basically need to 
>> keep N+1 bitmaps per canvas, where N is the number of hit regions. I 
>> doubt any implementors would be enthusiastic to implement hit regions 
>> like this. From a WebKit perspective, we'd much prefer keeping a Path 
>> for each hit region, and then simply using isPointInPath for hit 
>> testing. This also implies that the current piggybacking of "Clear 
>> regions that cover the pixels" in clearRect() could go away. Yay! :)
> 
> You only need one bitmap to implement the hit testing.
> 
> (Or you can do it using paths, sure. The effect is the same, but it's 
> probably quicker to use a bitmap.)

I don't think the spec should be written with a particular implementation in mind, nor should it dictate one.

I also strongly object to having to update this hit testing bitmap and/or path set on drawing operations like clearRect(). That will potentially hurt performance. I think its up to the author to manage their set of paths appropriately, independently from the drawing operations.

Simon
Received on Thursday, 5 July 2012 23:04:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:09 GMT