Jump to content

troido

Members
  • Posts

    2
  • Joined

  • Last visited

Previous Fields

  • Languages
    HTML, CSS, javascript

troido's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Yes, i meant getImageData(...).In the code I use I had this, but i made a mistake in the post.I corrected the post now. The loop will probably work (if var i starts as 3 instead of 0) but i wanted to know if there is also an solution that works a little faster.
  2. Hello,I want to make a script to check if there is anything drawn on a canvas.I tried to use this script: [/font][font=arial,helvetica,sans-serif]var ctx = document.getElementById("canvas").getContext("2d");[/font][font=arial,helvetica,sans-serif]/* Some other code, including some drawing code[/font][font=arial,helvetica,sans-serif]All drawings are black, with alpha value 255 */[/font] [font=arial,helvetica,sans-serif]var a = ctx.[color=#000000][size=1]getImageData(0,0,room.width,room.height)[/size][/color].data.indexOf(255); // to see if anything is drawn[/font][font=arial,helvetica,sans-serif] But for some reason it didn't work.I have also tested some other array methods, but they didn't work either on the imageData.dataIs there some way to make this work?Using a for loop instead would probably be to slow. Michiel
×
×
  • Create New...