canmove, Confirmed users
1,577
edits
| Line 82: | Line 82: | ||
==== Update the canvas ==== | ==== Update the canvas ==== | ||
Now that you've got a set of pixels updated you can use | Now that you've got a set of pixels updated you can use the simple putImageData() call. This call takes the ''canvasData'' object and the x,y location where you would like to draw the rectangle of pixel data into the canvas: | ||
var canvas = document.getElementById('myCanvasElt'); | var canvas = document.getElementById('myCanvasElt'); | ||
var ctx = canvas.getContext('2d'); | var ctx = canvas.getContext('2d'); | ||
var canvasData = ctx. | var canvasData = ctx.putImageData(canvasData, 0, 0); | ||
=== Examples === | === Examples === | ||