W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2010

[whatwg] Canvas pixel manipulation and performance

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 11 Mar 2010 09:25:25 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1003110256210.21376@ps20323.dreamhostps.com>
On Thu, 26 Nov 2009, Jason Oster wrote:
> 
> I've been using canvas to draw pixel art (NES/SNES game screens and 
> sprites) similar to what an emulator would do.  Doing this kind of 
> drawing requires direct access to the pixel buffer.
> 
> My problem with the canvas spec (as it is now) is that it tends to 
> artificially bounds pixel drawing performance to JavaScript when doing 
> any sort of pixel access.  Setting four unsigned 8-bit array elements 
> (R, G, B, and A) is a slower operation that setting just one unsigned 
> 32-bit array element (RGBA or ABGR).  Sadly, we don't have this latter 
> option for canvas.
>
> My comment is a request for a new set of pixel access methods on the 
> CanvasRenderingContext2D object.  Specifically, alternatives to 
> createImageData(), getImageData(), and putImageData() methods for 
> providing an array of unsigned 32-bit elements for pixel manipulation.

This comes up every now and then, but in the big picture, this problem 
isn't a huge issue. I think it's better that we wait for the rest of the 
spec to be better implemented before we start adding more features to 
<canvas>. Even in <canvas>, there are a number of features that would 
probably be more important than this, such as reusable path objects, text 
on a path, or dotted or dashed line styles.

If we had data showing that it was a problem, that might change matters.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 11 March 2010 01:25:25 UTC

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