var targetSize = Math.max($(window).width(), $(window).height());
var canvas = $("#canvas")[0];
canvas.setAttribute('width', $(window).width());
canvas.setAttribute('height', $(window).height());
var context = canvas.getContext("2d");
var img = new Image(); // Create new img element
img.onload = function () {
angle = Math.PI / 4;
context.setTransform(1, 0, 0, 1, 0, 0); //attempt to reset transform
context.drawImage(img, 0, 0);
};
img.src = '../../Images/FloorPlans/GroundFloor.jpg'; // Set source path
This code produces the first image below on firefox17 on my nexus7. The original image is NOT angled, all of the lines should be north-south and east-west. It appears correctly on Firefox and chrome on the desktop, and chrome on my nexus7.
If i try to "un-skewer" the image using...
context.setTransform(1, 0, Math.tan(angle), 1, 0, 0);
I get the second output below! My target platform has to be FF on the Nexus7 :(
How can this be fixed? Or is this a firefox bug?