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

Re: [whatwg] [canvas] matrix based changes on bitmaps

From: Rik Cabanier <cabanier@gmail.com>
Date: Fri, 21 Sep 2012 15:49:08 +0200
Message-ID: <CAGN7qDA57b5cabrtohqGc3XDLRvEVnevKMZOxv90ni4VWs+iAQ@mail.gmail.com>
To: Tyler Larson <talltyler@gmail.com>
Cc: whatwg@whatwg.org
On Mon, Apr 23, 2012 at 11:38 PM, Tyler Larson <talltyler@gmail.com> wrote:

> 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.
Support CSS Filters will satisfy this use case.
There are a number of built-in filters (such as sepia and constrast) and
even support for vertex and fragment shaders.
The current spec doesn't have a shorthand for the generic 'matrix' but it
allows you to refer to an SVG filter where there is support for this.

Received on Friday, 21 September 2012 13:49:58 UTC

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