[英]How can I load PNG-Files as ARGB_8888 even if they have no alpha channel?
I have the following code to load png files: 我有以下代码来加载png文件:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inDither = false;
map = BitmapFactory.decodeResource(getResources(), mapid, options);
Unfortunately it loads images as RGB_565 if they have no alpha channel. 不幸的是,如果没有alpha通道,它将图像加载为RGB_565。 How can I prevent this and consistently load them every time unchanged (no dithering, no conversion, or anything else) ?
如何防止这种情况,并在每次不变时(无抖动,无转换或其他任何操作)始终加载它们?
If this is not possible then is there maybe another way to load PNG files as ARGB_8888 without BitmapFactory ? 如果这不可能,那么是否有另一种方法可以在没有BitmapFactory的情况下将PNG文件加载为ARGB_8888?
Or is there maybe another format that can be used instead of PNG that also supports an Alpha channel and always delivers ARGB_8888 bitmaps ? 还是有可能使用另一种格式代替PNG,该格式也支持Alpha通道并始终提供ARGB_8888位图?
PS: I am using Android 2.3.4. PS:我正在使用Android 2.3.4。
I got an idea. 我有个主意
I think it should run. 我认为它应该运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.