"位图太大而不能上传到纹理"位图、而不、太大、纹理

2023-09-11 20:27:11 作者:我与世界只差一个你

我加载一个位图到一个ImageView的,看到这个错误。我收集这些限制涉及大小限制OpenGL硬件纹理(2048×2048)。我需要加载的图像是约4000像素的捏缩放图像中的高。

I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of about 4,000 pixels high.

我试着关闭硬件加速在清单中,但没有喜悦。

I've tried turning off hardware acceleration in the manifest, but no joy.

    <application
        android:hardwareAccelerated="false"
        ....
        >

是否有可能加载图像大于2048像素到ImageView的?

Is it possible to load an image larger than 2048 pixels into an ImageView?

推荐答案

所有的渲染是基于OpenGL,所以没有你不能超过这个限制。 请注意,这将需要大量的内存。 有了这样的大图片,如果你要放大出来,在移动environement沉重内存的限制,应设置类似于您在谷歌地图,例如查看系统。随着图像分割在若干片,几个定义。

All rendering is based on OpenGL, so no you can't go over this limit. Note that this would take a huge amount of memory. With such big images, if you want to zoom in out, and in a mobile environement with heavy memory constraints, you should setup a system similar to what you see in google maps for example. With the image split in several pieces, and several definitions.

 
精彩推荐
图片推荐