绘制一个大的位图背景SurfaceView的Andr​​oid [英] Drawing a Large Bitmap Background to SurfaceView Android

查看:95
本文介绍了绘制一个大的位图背景SurfaceView的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到最好的方式(preformance明智)绘制一个大的位图 SurfaceView 在Android作为一个固定的背景图像。我目前只使用 Canvas.drawBitmap()方法,但它受到了很多我带来了FPS下降。什么是一些我可以加快这方面?

I am trying to find the best way (preformance-wise) to draw a large Bitmap to a SurfaceView in Android as a stationary background image. I am currently just using the Canvas.drawBitmap() method but it brings my FPS down by a lot. What are some ways that I can speed this up?

推荐答案

尝试使用不透明图像,并设置Xfermode上油漆null或PorterDuff.Mode.SRC。这将禁用混合可以是昂贵的。此外,还应确保图像不拉伸(无缩放),它是在相同的格式surfaceview表面。

Try to use an opaque image and set the Xfermode on the Paint to either null or PorterDuff.Mode.SRC. This will disable blending which can be expensive. Also make sure your image is not stretched (no scaling) and that it's in the same format as the surfaceview's surface.

这篇关于绘制一个大的位图背景SurfaceView的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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