Confirmed users
591
edits
| Line 98: | Line 98: | ||
// Index of the pixel in the array | // Index of the pixel in the array | ||
var idx = (x + y * width) * 4; | var idx = (x + y * canvas.width) * 4; | ||
// The RGB values | // The RGB values | ||
| Line 112: | Line 112: | ||
} | } | ||
} | } | ||
ctx.putImageData(canvasData, 0, 0); | |||
See in action http://people.mozilla.com/~prouget/demos/35days/gray.xhtml | |||
==== createImageData ==== | ==== createImageData ==== | ||