virtual canvas putimagedata not working
问题 Am new to concept of virtual canvas, any idea why the below code does not work? <script type="text/javascript"> $(document).ready(function () { var c1 = document.createElement('canvas'); var ctx1 = c1.getContext("2d"); var c2 = document.getElementById('Canvas2'); var ctx2 = c2.getContext("2d"); c1.width = c2.width; c1.height = c2.height; img1 = new Image(); img1.src = 'A1.png'; img1.onload = function () { ctx1.drawImage(this, 0, 0); }; imgdata = ctx1.getImageData(0, 0, c2.width, c2.height);