【问题标题】:Is it possible to have live wallpaper with 32 bit (ARGB_8888) surface format?是否可以使用 32 位 (ARGB_8888) 表面格式的动态壁纸?
【发布时间】:2012-05-02 11:01:59
【问题描述】:

在渲染我的动态壁纸时,我有一些条带渐变伪影。 This article 完美解释了这背后的原因:为了消除大部分并提高效率,我可以在 32 位位图之上绘制 32 位位图 :)

所以我问自己一个问题:如何为动态壁纸做到这一点?而且找不到答案:) 在动态壁纸中,我们有一个由 android 框架为我们创建的表面。它发生了,所以它是一个 RGB_565 表面,因为:

// code inside my WallpaperService.Engine subclass
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
   Log.d("test", "format is: "+format); // => prints 4, which is PixelFormat.RGB_565
}

而且我似乎无法要求 Android 框架将其更改为 ARGB_8888。或者有吗?

附注当然我知道我可以做上面文章中描述的其他事情,比如应用抖动等,所以请不要费心指点我。我想找到我提出的问题的确切答案:)

【问题讨论】:

    标签: android surfaceview live-wallpaper artifacts dithering


    【解决方案1】:

    在 onCreate() 中设置 PixelFormat

    holder.setFormat(PixelFormat.RGBA_8888);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多