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

Re: [whatwg] I believe source rectangles for HTML5 Canvas drawImage are specified incorrectly

From: Jeff Muizelaar <jmuizelaar@mozilla.com>
Date: Mon, 10 Sep 2012 16:49:55 -0400
Message-Id: <0036000A-F5C2-4188-B62B-B9D38038AED3@mozilla.com>
To: Vladimir Vukicevic <vladimir@pobox.com>
Cc: whatwg@lists.whatwg.org, Kevin Gadd <kevin.gadd@gmail.com>, Justin Novosad <junov@chromium.org>

On 2012-09-10, at 3:43 PM, Vladimir Vukicevic wrote:

> This is pretty tricky to get right -- there's just a general graphics
> problem in this case.  There are valid use cases for both sampling outside
> and not sampling outside the source rectangle, as well as implementation
> issues for being able to do source rectangle clamping.  For example, should
> you be able to take a source image and draw it scaled up using 4 rectangles
> (one for each quadrant) and have the result be equal to just doing it in
> one draw?  Or take any random subimage (for example, for efficient updates
> of some destination) and draw it in.
> 
> I do agree that the spec needs some clarity here, but I don't think that
> just stating that drawImage should always sample in the source is the right
> thing.  At best, I think a new mode toggle or flag would be needed to allow
> you to select.

FWIW, there are also negative performance implications to clamping samples to the source rect. Many graphics APIs do not support this kind sampling, and supporting this behaviour on top of those apis requires a temporary copy of the subimage to be made. 

-Jeff
Received on Monday, 10 September 2012 20:50:24 UTC

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