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

[whatwg] [canvas] matrix based changes on bitmaps

From: Tyler Larson <talltyler@gmail.com>
Date: Mon, 23 Apr 2012 17:38:35 -0400
Message-ID: <66426E3E-8355-4EDA-A200-F630E0EE4892@gmail.com>
Can we add matrix transformations?
Looping over every pixel in JavaScript is slow. Many cool things could be taken care of much faster if the canvas had some form of matrix manipulations built in. 
All of the pixels could have one transformation operation defined and all of the pixels could be operated on at once in something lower level. 

It could look like this...

context.transformMatrix([0.5,0.5,0.5,0,0,
					0.5,0.5,0.5,0,0,
					0.5,0.5,0.5,0,0,
					0,0,0,1,0,
					0,0,0,0,1]);

It's far simpler than looping over an array of pixels and picking out the values of each color. 

Other graphics systems have ways of doing this already. You can easily find sample tutorials on how to create and transform matrixes. 
In some languages they have matrix objects that have methods for even easier manipulation of these transformations but I'm cool without this if it is easier.

-Tyler Larson
Received on Monday, 23 April 2012 14:38:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:07 GMT