[whatwg] Canvas pixel manipulation and performance

Jason Oster parasyte at kodewerx.org
Fri Dec 4 09:30:44 PST 2009


I guess this suggestion to access the full pixel data in a single array 
element has fallen by the wayside.  Are there any direct objections to 
including additional API to allow this kind of behavior?  It seems most 
developers believe it would be unnecessary, but I haven't heard much in 
the way of reasoning (technical nor personal).

I cannot comment on the "typical uses" of accessing pixel data from 
script; if it is [in general] more important to have each of the R,G,B,A 
components separated for script access, or not.  But for cases involving 
indexed palettes, having the ability to directly treat each pixel as a 
single property is very much desired.

It is not going to provide a huge boost in performance.  At worst, it 
will help make code cleaner.  But at best, it will do that and 
[slightly?] reduce the performance penalty of reading/writing 3 
superfluous (in my eyes) array accesses.  The only negative aspect I can 
think of with additional API functions is the introduction of new 
developer confusion; "Which one do I use?"

Thanks for listening,
Jay



More information about the whatwg mailing list