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

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

From: Justin Novosad <junov@chromium.org>
Date: Mon, 10 Dec 2012 14:03:47 -0500
Message-ID: <CABpaAqTvN+AeK2U1fMfTVQ6k8MUn1nxkKQ5V82ZfNqfuTiqgCQ@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: whatwg@lists.whatwg.org, Jeff Muizelaar <jmuizelaar@mozilla.com>, Vladimir Vukicevic <vladimir@pobox.com>, Kevin Gadd <kevin.gadd@gmail.com>
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.

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

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