在尝试将大型2D图像数组绘制到画布上时,我遇到了问题.使用一个单独的程序,我正在拍摄一个大的图像文件并将其分解成更小,更均匀的部分.我正在使用2D数组来表示图像的这个"网格",理想情况下,当我在网格中分配每个元素的src时,该图像一旦准备就会被绘制到画布上的正确点.但是,我的代码无效.
var grid = new Array()
/*grid is set to be a 2D array of 'totalRows' rows and 'totalCols' columns*/
/*In the following code, pieceWidth and pieceHeight are the respective height/widths
of each of the smaller 'pieces' of the main image. X and Y are the coordinates on
the canvas that each image will be drawn at. All of the images are located in the
same directory (The src's are set to http://localhost/etc), and each individual
filename is in the …Run Code Online (Sandbox Code Playgroud)