在iPhone上加载到画布上的图片是否有最大尺寸? [英] Is there a max size for images being loaded onto canvas on iPhone?

查看:172
本文介绍了在iPhone上加载到画布上的图片是否有最大尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个有滚动背景的webapp游戏。背景只是一个真正高的图像,被复制到较小的画布在切片中,以给运动的感觉。我开始的图像文件是6000px高(我的画布是640px高)。

I am building a webapp game that has a scrolling background. The background is just a really tall image that is copied to the smaller canvas in slices to give the sensation of movement. The image file I started with was 6000px tall (my canvas is 640px tall). All desktop browsers and iPad2 (iOS 6) loaded the image file fine and the animation looks great.

然而,在iPhone 4S(iOS 5)上,背景从不会加载到图片文件所有!我解决了这个问题,只是切割大的背景图像,直到它是在2000px高,有iPhone终于加载到画布上的图形,一切工作从那里很好。

However, on iPhone 4S (iOS 5) - the background never loads at all! I solved the problem by just cutting the big background image down until it was under 2000px tall, and there the iPhone finally loaded the graphics onto the canvas and everything works great from there.

所以我的问题是 - 有一个最大的文件大小,javascript canvas.context 可以处理?也许只是在某些设备?

So my question is - is there a maximum file size that the javascript canvas.context can handle? Maybe just on certain devices?

我尝试了各种其他的工作,以确保文件被完全加载之前JS代码在画布上运行,没有效果。 / p>

I tried all kinds of other work arounds to ensure the file was completely loaded before the JS code ran on the canvas, to no avail.

推荐答案

我发现这个堆栈溢出的帖子可能会完全回答你的问题。

I found this previous post in stack overflow that may answer you question fully.

< canvas>的最大尺寸元素

这篇关于在iPhone上加载到画布上的图片是否有最大尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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