[whatwg] Opera2d-game Extensions to Canvas: setPixel() and getPixel()
Hi. Since March of '06, Opera 9 has supported a custom extension to the canvas context called "opera-2dgame." Importantly, their extension adds these methods: getPixel(x, y) Returns the pixel value (colour, opacity) at (x, y). Returned in the form #rrggbb if fully opaque and rgba(r, g, b, a) if it has some alpha transparency. setPixel (x, y, color) Allows you to set the colour of the pixel at (x, y). The third argument should be a CSS color - you could provide a string such as red, a HTML colour code or even a rgba() value. I don't see any recent discussion of this. And I am also aware that the canvas drawing model is not pixel-oriented. Nonetheless, mightn't these functions be extremely useful? As the Opera folk point out, they bless game developers, and it occurs to me that they could be used for other neat, useful things, such as giving _javascript_ a rudimentary RAM drive. Description including several demo programs and a discussion of security issues is available here. Why not make getPixel () and setPixel() a standard? Regards, Jeff Creamer Computing Instructor Long Beach Unified School District cream...@roadrunner.com
Re: [whatwg] Opera2d-game Extensions to Canvas: setPixel() and getPixel()
Why not make getPixel () and setPixel() a standard? The ImageData APIs already provide the ability to do this and are already supported by Firefox, Opera and Safari. --Oliver
Re: [whatwg] Opera2d-game Extensions to Canvas: setPixel() and getPixel()--Ooops!
Aiee...sorry for the trouble; cancel my earlier note. [I realize putImageData and getImageData fill the bill : /.] Sincerely, Jeff C. Hi. Since March of '06, Opera 9 has supported a custom extension to the canvas context called "opera-2dgame." Importantly, their extension adds these methods: getPixel(x, y) Returns the pixel value (colour, opacity) at (x, y). Returned in the form #rrggbb if fully opaque and rgba(r, g, b, a) if it has some alpha transparency. setPixel (x, y, color) Allows you to set the colour of the pixel at (x, y). The third argument should be a CSS color - you could provide a string such as red, a HTML colour code or even a rgba() value. I don't see any recent discussion of this. And I am also aware that the canvas drawing model is not pixel-oriented. Nonetheless, mightn't these functions be extremely useful? As the Opera folk point out, they bless game developers, and it occurs to me that they could be used for other neat, useful things, such as giving _javascript_ a rudimentary RAM drive. Description including several demo programs and a discussion of security issues is available here. Why not make getPixel () and setPixel() a standard? Regards, Jeff Creamer Computing Instructor Long Beach Unified School District cream...@roadrunner.com