渲染阴影质量在Android透明PNG [英] Quality of rendering shadow in transparent png on Android

查看:355
本文介绍了渲染阴影质量在Android透明PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用一个透明的PNG图像具有优良衰落的阴影始终存在围绕Android的屏幕上的阴影边缘线。它不emualator或Exclipse显示此。见照片。

When using a transparent PNG image which has a fine fading shadow always there is an edge line around the shadow on the Android screen. It does not show this in emualator or Exclipse. See photo.

我不知道是否有办法来改善这一点。这是与Android的屏幕无法显示全部24位颜色或一个事实,即在缩放和重采样图像?

I wonder if there is way to improve on this. Is this something to do with inability of Android screen to show all 24 bit colours or the fact that is scaling and resampling image?

在这个例子中,图像加载到的ImageButton图。我尝试了作为源或背景,这是相同的质量。

In this example the image is loaded into an ImageButton view. I tried it as source or background and it is the same quality.

推荐答案

您看到的是被称为条带,它是每个像素的显示器是16位的结果的假象。

The artefact you are seeing is known as "banding" and it is a consequence of your display being 16bits per pixel.

要解决这一问题的最佳方法是添加一些噪音,以在Photoshop或Paint.NET您的图像资源。

The best way to resolve this is to add some "noise" to your image asset in Photoshop or Paint.NET.

另外,你可以设置你的窗口为32bpp的与下面的行添加到您的活动的的onCreate(),在 super.onCreate()的setContentView()

Alternatively you can set your window to be 32bpp with the following line added to your activity's onCreate(), between super.onCreate() and setContentView(). :

    getWindow().setFormat(PixelFormat.RGBA_8888);

这篇关于渲染阴影质量在Android透明PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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