[whatwg] Canvas 2D context proposal: point/linear filtering modes

Ashley Gullen ashley at scirra.com
Fri Oct 28 19:17:44 PDT 2011


On 29/10/2011 02:15, Boris Zbarsky wrote:
> On 10/28/11 3:26 PM, Ashley Gullen wrote:
>> Overall, I think this proposal is very simple, straightforward to
>> standardise and implement, genuinely useful, and would significantly
>> encourage 2D gaming in HTML5 for comparitively little effort. Is it
>> possible that this could be included in the standard? Any
>> comments/suggestions/vendor-specific extensions I've missed?
>
> There is experimental support for this in Gecko at the moment via the 
> boolean mozImageSmoothingEnabled property on the 2d context.  At the 
> time this was added there was talk about getting more feedback from 
> this group; not sure whether that ever happened.
>
> I would be curious to know whether this property solves your use cases.
>
> I do think we should add some capabilities to at least force 
> nearest-neighbor interpolation; this is a commonly requested feature.
>
> -Boris
>

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.

Do any other browsers have vendor-specific switches for this?  That 
would be a good workaround for the time being.

Ashley Gullen
Scirra.com





More information about the whatwg mailing list