gpt4 book ai didi

javascript - EDGE 无法使用 JS 将大图像复制到 Canvas 中?

转载 作者:行者123 更新时间:2023-11-30 15:51:20 25 4
gpt4 key购买 nike

我有这段代码,将图像“smoothchartshowAnalisysCopy”(500px X 250px)的部分复制到大的“analysisFullGraph1”(32172px X 250px)中。

适用于 IE、firefox、chrome、safari 和 vivaldi,但不适用于Edge...

边缘,只能复制大图的开头...可能最大位置14000px...

var c   = document.getElementById('analysisFullGraph1'); 32172px X 250px
var ctx = c.getContext('2d');

var imageNow = document.querySelector('#smoothchartshowAnalisysCopy');
var ctxImageNow = imageNow.getContext('2d');


function copy(){
var elmnt = document.querySelector('#analysisFullGraphContainer1');
var x = elmnt.scrollLeft;
var y = elmnt.scrollTop;
var imgData = ctx.getImageData(x, 0, 828, 270);
ctxImageNow.putImageData(imgData, 0, 0);

}

我找不到有关 Microsoft DOC 的信息,甚至在 google 中也找不到..

感谢您提供的任何帮助!

最佳答案

The maximum size of the rendered area on a canvas is from 0,0 to 8192 x 8192 pixels, regardless of the size of the canvas. For example, a canvas is created with a width and height of 8292 pixels. A rectangular fill is then applied as "ctx.fillRect (0,0, canvas.width, canvas.height)".Only the area within the coordinates (0, 0, 8192, 8192) can be rendered, leaving a 100 pixel border on the right and bottom of the canvas. link

我搜索了 Microsoft Edge canvas size limit - 这是第二个链接

关于javascript - EDGE 无法使用 JS 将大图像复制到 Canvas 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39284254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com