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:
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;