Hi guys!
I've switched from calculator programming to trying to learn all sorts of different types of coding. I've recently been working with Javascript (which I really like!).

I've been "porting" an old project of mine over to a javascript canvas. It is supposed to feel like playing on the calculator, but of course isn't emulating or anything. I'm trying to do a pxl-test( esque function in my Javascript to test if a specific pixel is on on the canvas. My imgData for the canvas keeps on returning as all 0's. I have a background on my canvas, text drawn to it, and some fill lines as a test. But the data is all 0's.
I'm trying to figure out why I can't manage to 'capture' the canvas pixel data.
Thanks!



This is code that just sets the context. Menu is a function defined within this main function.

Code:

function main() {
    var canvas = document.getElementById('canvas');
    var ctx = canvas.getContext('2d');
    if (canvas.getContext) {
        menu();
    } else {
        alert("Didn't load javascript");
    }
    //alert("end");
    return;
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement