< canvas>的最大尺寸元件 [英] Maximum size of a <canvas> element

查看:152
本文介绍了< canvas>的最大尺寸元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的canvas元素的高度为600到1000像素,宽度为几十或几十万像素。然而,在一定数量的像素(显然未知)后,画布不再显示我用JS绘制的形状。

I'm working with a canvas element with a height of 600 to 1000 pixels and a width of several tens or hundreds of thousands of pixels. However, after a certain number of pixels (obviously unknown), the canvas no longer display shapes I draw with JS.

有人知道是否有限制?谢谢。

Does anyone know if there's a limit? Thanks.

编辑:已在Chrome 12和Firefox 4中测试。

Edit: tested both in Chrome 12 and Firefox 4.

推荐答案

已于2014年10月13日更新

Updated 10/13/2014

所有已测试的浏览器都对canvas元素的高度/但许多浏览器也限制了canvas元素的总面积。对于我可以测试的浏览器,限制如下:

All tested browsers have limits to the height/width of canvas elements, but many browsers also limit the total area of the canvas element. The limits are as follows for the browsers I'm able to test:

宽度:32,767像素

最大区域:268,435,456像素(例如,16,384 x 16,384)

Maximum height/width: 32,767 pixels
Maximum area: 268,435,456 pixels (e.g., 16,384 x 16,384)

最大高度/宽度:32,767像素

最大面积:472,907,7​​76像素(例如,22,528 x 20,992)

Maximum height/width: 32,767 pixels
Maximum area: 472,907,776 pixels (e.g., 22,528 x 20,992)

最大高度/宽度:8,192像素

最大面积:N / A

Maximum height/width: 8,192 pixels
Maximum area: N/A

最大高度/宽度:4,096像素

最大面积:N / A

Maximum height/width: 4,096 pixels
Maximum area: N/A

我目前无法测试其他浏览器。

I'm not able to test other browsers at this time. Refer to the other answers on this page for additional limits.

在大多数浏览器上超过最大长度/宽度/使画布无法使用。 (它将忽略任何绘制命令,即使在可用区域中)。IE和IE Mobile将在可用空间内执行所有绘制命令。

Exceeding the maximum length/width/area on most browsers renders the canvas unusable. (It will ignore any draw commands, even in the usable area.) IE and IE Mobile will honor all draw commands within the usable space.

这篇关于< canvas>的最大尺寸元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆