I have crop the partial canvas drawing and move to top left corner. I tried with translate, settransmation, but no luck. translate works before clip, but after clip, translate not moves clipped region. could not find sample code any forum
<html>
<body>
<canvas id="myCanvas" width="400" height="300" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "yellow";
ctx.fillRect(100, 100, 150, 100)
ctx.setTransform(1,0.5, -0.2, 1, 60, 10);
ctx.fillStyle = "blue";
ctx.fillRect(100, 100, 150, 100);
ctx.beginPath();
ctx.rect(100, 100, canvas.width,canvas.height);
ctx.clip();
ctx.setTransform(1,0.5, -0.2, 1, 60, 10);
ctx.translate(-100,-100);
</script>
</body>
</html>
Could someone guide me to fix this code?