Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. var photo = new Image();
  2. photo.src = "./Ship1.png";
  3. photo.addEventListener('load', eventPhotoLoaded, false);
  4. function drawImage()
  5. {
  6.  
  7. this.context.drawImage(photo, 0, 0, photo.width,photo.height, 0, 0, photo.width * currentScale, photo.height* currentScale);
  8. }
  9.  
  10. theCanvas.addEventListener('click', function(evt) {
  11. var rect = this.theCanvas.getBoundingClientRect();
  12. x = evt.clientX - rect.left;
  13. y = evt.clientY - rect.top;
  14.  
  15. //newGird is an array of cells containing R,G,B and Alpha values
  16. context.putImageData(newGird, x, y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement