[whatwg] I believe source rectangles for HTML5 Canvas drawImage are specified incorrectly
Justin Novosad
junov at chromium.org
Mon Dec 10 11:03:47 PST 2012
On Mon, Dec 10, 2012 at 1:24 PM, Ian Hickson <ian at 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
More information about the whatwg
mailing list