asysbang

标题: Renderscript [打印本页]

作者: admin    时间: 2013-4-23 17:52
标题: Renderscript
官方介绍
http://developer.android.com/guide/topics/renderscript/index.html
Renderscript provides a platform-independent computation engine that operates at the native level. Use it to accelerate your apps that require extensive computational horsepower.

对于需要大量计算的应用来说,采用Renderscript无疑是最好的选择

首先看下Renderscript的实例,
动态壁纸:水面落叶、线性光幕效果、黑洞,都是用Renderscript实现的

源代码中提供了2个例子:
development/samples/RenderScript/
       HelloCompute/                 ----     (Eclipse可以找到)
       Levels/                             ----     (只能在源代码下找到)
       Balls/                                ----     (android4.0)
       Fountain/                          ----     (android4.0)
       MiscSamples/                   ----     (android4.0)


此外,packages/wallpapers/    下面有“水面落叶、线性光幕效果、黑洞”这些动态壁纸的源代码

下面是从Basic里面提取的Fall部分的例子 (需要android3.0以上版本运行)
主要修改内容是解决编译错误和 完善activity运行
原始的代码service那边是正常运行的,但是activity是不能运行的,所以把service里面的surfaceCreated  和surfaceChanged 拿到FallView 里面
[attach]23[/attach]


PS :  下面是一个根据水面落叶写的水波纹效果 ,写的比较详细
      http://download.csdn.net/download/singleton1900/4975456









欢迎光临 asysbang (http://asysbang.com/) Powered by Discuz! X2.5