Im am currently using LibCanvas to do canvas drawing in my html page, but I can’t seem to figure out how to draw an image. Can anyone help me with this?
EDIT: I am currently using this piece code, I see the image being drawn but then it dissapears;
var libcanvas = new LibCanvas('canvas', { preloadImages: false }).start();
var img = new Image();
img.src = 'images/draw.png';
img.width = 400;
img.height = 400;
libcanvas.addEvent('ready', function()
{
libcanvas.ctx.drawImage(img);
});
It depends on your aim.
If you just want to draw image – you can use plain context, without creating LibCanvas object:
Your image dissapears because you draw it not in frame. So, second way – is to draw it in “render” part:
The right way if you try to create big app – is creating special object:
In such way you can easy make it, e.g. draggable:
For answers about LibCanvas you can write to me, shocksilien@gmail.com