getHolder().setFormat(PixelFormat.RGBA_888);
Options options = new BitmapFactory.Options();
options.inDither=true;
options.inScaled = true;
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inPurgeable=true;
使用以上代码创建的位图如下:
当使用上述代码时,我得到以下结果……
- No colour banding on my Tablet device
Noticeable colour banding on test mobile (Samsung Galaxy Ace)
getHolder().setFormat(PixelFormat.RGBA_888); Options options = new BitmapFactory.Options(); options.inDither=true; options.inScaled = true; options.inPreferredConfig = Bitmap.Config.ARGB_565; options.inPurgeable=true;
No colour banding on my tablet
- Noticible colour banding on the Galaxy Ace
Same results as above
getHolder().setFormat(PixelFormat.RGB_565); Options options = new BitmapFactory.Options(); options.inDither=true; options.inScaled = true; options.inPreferredConfig = Bitmap.Config.RGB_565; options.inPurgeable=true;
Colour banding on my tablet
colour banding on the SG Ace
getHolder().setFormat(PixelFormat.RGB_565); Options options = new BitmapFactory.Options(); options.inDither=true; options.inScaled = true; options.inPreferredConfig = Bitmap.Config.ARGB_8888; options.inPurgeable=true;
Colour banding on my tablet
- colour banding on the SG Ace
请问以下行的目的是什么?
options.inPreferredConfig = Bitmap.Config.xxxxxxx
这似乎对已绘制的位图没有任何影响。
性能至关重要,所以我可能需要更改原始png文件,使它们不具有渐变 (即,将它们绘制为RGB565 - 这是可取的,还是应该坚持使用8888?) 或者应该通过抖动来解决? (因为你可以看到,我已经启用了它,但似乎没有帮助)。
有什么想法为什么Ace上总是有条纹?这可能是硬件限制吗?
谢谢大家,这很令人困惑。
(PS我已经阅读了官方指南,在发布问题之前我总是会查看它以及查看其他相关的SO问题,但官方指南(通常情况下)并不能为我解决这个问题,并且我找不到答案通过其他问题,所以如果它已经在这里,请原谅)。