[whatwg] Canvas v5 API additions
ashley at scirra.com
Wed Mar 28 16:38:43 PDT 2012
On 28 March 2012 22:41, Ian Hickson <ian at hixie.ch> wrote:
> On Sat, 29 Oct 2011, Ashley Gullen wrote:
> > I had a quick go with setting ctx.mozImageSmoothingEnabled = false. It
> > works great with drawImage. However it does not appear to affect
> > repeated patterns. This makes for quite a strange effect where the
> > game's sprites are pixellated but the tiled backgrounds are bilinear
> > filtered. So it's half way there.
> This matches what the spec has done; you can make it also affect patterns
> if you like by first drawing the image scaled to another canvas and then
> using that as the pattern (so the pattern doesn't have to be scaled).
> If you just have everything scaled, though, you might be better off just
> drawing everything to the canvas without any scaling and then just scaling
> the whole thing once per frame, either by stretching the canvas and
> relying on CSS to turn off smoothing, or by using drawImage().
Why would anyone want to turn off smoothing for just drawImage and not
repeat patterns? Our games use repeat patterns to draw tiled textures as a
quicker way to render a grid of drawImage, so why not make them work the
same? If I wasn't clear, in the quoted post I thought the
fact mozImageSmoothingEnabled did not affect repeat patterns was a bug.
IMO the smoothing property should affect everything (perhaps even the
aliased lines request that was brought up). Things like a retro
pixel-style game will want a simple option to deliberately
alias/nearest-neighbour everything on the canvas, and having the smoothing
option affect some things but not others seems to just be an inconvenience.
- have you got a link to the spec including the smoothing property? can't
seem to find it
- don't get me wrong, this is great work, I'm just throwing in my thoughts
on the changes!
More information about the whatwg