I've two images, first is large image which is placed first and then another image is placed on it. Now I want to cut out area of second image over the first.
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var first_img = new Image(),
second_img = new Image();
first_img.src = 'http://www.html5canvastutorials.com/demos/assets/darth-vader.jpg';
second_img.src = 'http://tux.crystalxp.net/png/mimipunk-tux-cartoon-1820.png';
var draw = function(){
second_img.onload = function() {
context.drawImage(second_img, 50, 50);
};
first_img.onload = function() {
context.drawImage(first_img, 50, 50);
};
};
draw();
edit second image is png and have irregular shape, I want the first image having transparency of area of the first image