user1874941
user1874941

Reputation: 3153

excanvas drawimage doesn't work on IE8

Hi I have managed to make excanvas work in IE8 for simple examples however I couldn't make the following canvas example which contain drawimage work at IE8. Does anyone have any experience with excanvas and drawimage. Thanks for your help...

var foo = document.getElementById("foo");
var canvas = document.createElement('canvas');`

canvas.setAttribute("width", 300);
canvas.setAttribute("height", 300);
foo.appendChild(canvas);
canvas= G_vmlCanvasManager.initElement(canvas);
var ctx = canvas.getContext('2d');
ctx.save();
ctx.clearRect( 0, 0, canvas.width, canvas.height );
ctx.translate( canvas.width/2 , canvas.height/2 );
ctx.drawImage( image, -165, -160 );
ctx.rotate( 100 * Math.PI / 180);
ctx.drawImage( image2, -13, -121.5 );
ctx.restore();

image1.src = 'img.png';
image2.src = 'img2.png';

Upvotes: 2

Views: 814

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24617

Use a test case to isolate drawImage:

<!DOCTYPE html>
<html>
<head>
<title>Overflow Test</title>
<style>
body {
  text-align: center
}
</style>
<!--[if IE]><script src="https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/excanvas.js"></script><![endif]-->
<script>
window.onload = function() {
  var ctx = document.getElementById('c').getContext('2d');
  var img = document.images[0];
  ctx.rotate(Math.PI / 8);
  ctx.drawImage(img, 50, 50);
  img.style.display = 'none';
};
</script>
</head>
<body>

<img src="http://opera.com/favicon.ico">

<canvas id="c" width="200" height="200"></canvas>

</body>
</html>

References

Explorer Canvas test cases: drawimage.html

Upvotes: 1

Related Questions