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

On Mon, Dec 10, 2012 at 1:24 PM, Ian Hickson <ian@hixie.ch> wrote:

>
> The reason to prefer the current behaviour is if you want to just update a
> small part of an image. For example, if you draw a bit photo, then draw
> text over it, then want to remove the text by just drawing the photo over
> where the text was but not redrawing the whole thing. If we clamped to
> source rectangle, we'd get artefacts in this case that couldn't be worked
> around (unlike the problems with scaling sprites, which can be worked
> around, albeit in a suboptimal fashion).
>
>
I disagree. There is an efficient workaround for updating a subregion of an
image without getting filtering artifacts around the edges : use clipping
to limit the update region
On the other hand, the workaround to prevent color bleeding when using
spritemap is much less efficient since it requires padding, which is
wasteful by definition, and in cases where the sprite can be downsized, the
padding margins may have to be very large.

   -Justin

Received on Monday, 10 December 2012 19:04:15 UTC