android - 安卓高效率获取截图问题?
PHP中文网
PHP中文网 2017-04-17 17:43:20
0
3
596

手机有Root,需要能在100ms左右完成截图并返回Bitmap的功能

目前了解到的想要获取到截图的Bitmap有几种

1:利用系统命令screenshot/screencap -p ,然后再读取,受手机限制,至少1500-2000ms,我在魅族MX5上反而用了3000。。完全无法忍受。

2:利用ddmlib,效率更低。。

3:读取framebuffer,这个在4.2以后的版本就失败了。只能读取黑屏或者带手机厂商logo的黑图。

4:反射系统自带的SurfaceControl方法,失败的,操作后没有任何提示,也得不到结果。

5:自编译的android.jar。方法可以调用,依然是操作后没有任何提示,应该是要添加systemuid。但是这样编译的话,只能在少部分手机上才能用,没什么意义。

6:在5.1以上版本使用MediaProjection,只需要60ms,不过不兼容5.1以下版本

目前用的是第一种,不过截屏效率实在太慢了。

不知道还有没有别的效率高点的办法,求大神赐救~~

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
刘奇

Get the drawing cache information directly view.getDrawingCache()
Then createBitmap I do this

洪涛

My phone is not rooted and there is a surfaceview on the screen to be captured. How can I implement the screen capture function?

Peter_Zhu

Hello, I am a college student studying Android development. Now I want to make an Android co-screen software. I have been working on it for a long time and have studied many things but have not been able to figure it out. I saw on the blog that you are also studying this technology. I hope to consult. You have some technical questions because I don’t know how to contact you. If it is convenient, you can add me on QQ 381855657. The ancients said that when you help others, you will also be happy (^__^) Hehehe, thank you very much! ! ! ! !

No friends 2016/9/12 19:44:27

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!