I'm still trying to wrap my brain around JavaScript's "inheritance" model so forgive me if this is question is simply answered by pointing to JS docs.
I basically want to pass in my own custom and inherited Image object to the drawImage method on the canvas context. The end goal is to be able to store additional render data in the derived class, and while there are alternatives to store the additional data, I thought an inheritance implementation might be cleaner in this instance.
Is there a way to get the derived type to render?
function MyImage() {}
MyImage.prototype = new Image();
...
var test = new MyImage();
test.src = "myimage.jpg";
test.onload = function() { context.drawImage(test,0,0); }; //Fails to render
...
var test2 = new Image();
test2.src = "myimage.jpg";
test2.onload = function() {context.drawImage(test2,0,0);}; //Renders correctly