IE(9未満)ブラウザでキャンバス機能をサポートするためにexcanvas.jsライブラリを使用しています。私が現在直面している問題は、excanvas が drawImage() メソッドの最初の引数としてイメージを想定していることです。最初の引数として別のキャンバスまたはビデオをサポートしないことがわかりました。この機能を実現するための回避策は何ですか? 私のコードはこのようなものです。
var canvas1 = document.getElementById("canvas1"); // Get the first canvas Element
var canvas2 = document.getElementById("canvas2"); // Get the second canvas element
if (typeof G_vmlCanvasManager != 'undefined') {
canvas1 = G_vmlCanvasManager.initElement(canvas1); // Initialise with excanvas
canvas2 = G_vmlCanvasManager.initElement(canvas2);
}
if (canvas1.getContext) {
var ctx1 = canvas1.getContext("2d");
var ctx2 = canvas2.getContext("2d");
var img = new Image();
img.onload = function () {
ctx1.drawImage(this, 0, 0, 200, 200); // Draw the image on first canvas
ctx2.drawImage(canvas1, 0, 0, 200, 200); // Draw the image on to the second canvas using the first canvas
}
img.src = "image1.jpg";
}
Ie8 以下のブラウザでは動作しません。この問題をどのように解決できますか?