//....................................
function proc1() { // 方法1
//....................................
g.clearRect(0, 0, w, h);
img.onload = function() {
g.drawImage(img, 0, 0, w/2, h);
g.drawImage(img, x1, y1, w/4, h/2);
};
img.src = "pic.jpg";
}
//....................................
function proc2() { // 方法2
//....................................
g.clearRect(0, 0, w, h);
img.src = "pic.jpg";
img.onload = function() {
g.drawImage(img, 0, 0, w/2, h);
g.drawImage(img, x1, y1, w/4, h/2);
};
}
//....................................
function proc3() { // 方法3
//....................................
g.clearRect(0, 0, w, h);
img.src = "pic.jpg";
g.drawImage(img, 0, 0, w/2, h);
g.drawImage(img, x1, y1, w/4, h/2);
}