pwambach / angular-canvas-painter

Angular.js directive to paint on a canvas on desktop or touch devices
MIT License
116 stars 35 forks source link

Load existing image into canvas #5

Closed TheNitek closed 9 years ago

TheNitek commented 9 years ago

It would be nice to be able to load an existing image into the canvas by providing a URL. Currently I have to do it in my controller using something like this:

var imageObj = new Image();
imageObj.onload = function () {
 var context = $('#pwCanvasMain').get(0).getContext('2d');
 context.drawImage(this, 0, 0);
};
imageObj.src = 'http://example.org/image.png';
pwambach commented 9 years ago

Sure would be a nice feature. I'll have a look at it or just create a PR if you want to...

pwambach commented 9 years ago

i added an option 'imageSrc' in v0.3.0