RenderScript是Android平台的一种类C脚本语言,Google虽然一直在之前的各个Android版本内置的动态墙纸中使用该技术实现3D图形特效,但一直未将其集成在公开发布的SDK中。至Android3.0版本开始,SDK中已将RenderScript技术集成了进来,开发者可在Eclipse下开发基于RenderScript的3D应用,并在Android3.0版本以上的平板电脑中运行。
RenderScript是一种3D运行时框架,其提供构造3D场景的API函数,同时为最大程度的优化性能,还支持平台无关的shade语言。开发者不仅可以采用RenderScript技术来开发3D应用,还可以用来作特定的高性能数据处理。
关于RenderScript的详细内容大家可参见SDK:
http://developer.android.com/guide/topics/renderscript/index.html
http://developer.android.com/guide/topics/renderscript/graphics.html
http://developer.android.com/guide/topics/renderscript/compute.html
本文主要对SDK中对RenderScript的特点作扼要的整理,后续将继续讨论如何采用RenderScript进行应用开发。
RenderScript的优点:
(1)Portability:RenderScript is designed to run on many types of devices withdifferent CPU and GPU architectures. It supports all of thesearchitectures without having to target each device, because thecode is compiled and cached on the device at runtime.
(2)Portability:RenderScript is designed to run on many types of devices withdifferent CPU and GPU architectures. It supports all of thesearchitectures without having to target each device, because thecode is compiled and cached on the device at runtime.
(3)Usability:RenderScript simplifies development when possible, such aseliminating JNI glue code and simplifying mesh setup.
RenderScript的不足:
(1)Portability: RenderScript is designed to run on many types ofdevices with different CPU and GPU architectures. It supports allof these architectures without having to target each device,because the code is compiled and cached on the device at runtime.
(2)Debugging visibility: RenderScript can potentially execute(planned feature for later releases) on processors other than themain CPU (such as the GPU), so if this occurs, debugging becomesmore difficult.
(3)Less features: RenderScript does not provide as many features asOpenGL such as all the compressed texture formats or GL extensions.
RenderScript应用包括三个层次:
(1)Native RenderScript layer
Thenative RenderScript layer consists of your RenderScript code, whichis compiled and executed in a compact and well defined runtime. YourRenderScript code has access to a limited amount of functions becauseit cannot access the NDK or standard C functions, since they must beguaranteed to run on a standard CPU. The RenderScript runtime wasdesigned to run on different types of processors, which may not bethe CPU, so it cannot guarantee support for standard C libraries.What RenderScript does offer is an API that supports intensivecomputation and graphics rendering with a collection of math andgraphics APIs.
(2) Reflected layer
Thereflected layer is a set of classes that the Android build toolsgenerate to allow access to the native RenderScript code from theAndroid VM. This layer defines entry points for RenderScriptfunctions and variables, so that you can interact with them with theAndroid framework. This layer also provides methods and constructorsthat allow you to allocate memory for pointers that are defined inyour RenderScript code.
(3)Android framework layer
TheAndroid framework layer consists of the usual Android framework APIs,which include the RenderScript APIs in android.renderscript
.This layer handles things such as the Activity lifecycle and memorymanagement of your application. It issues high level commands to thenative RenderScript code through the reflected layer and receivesevents from the user such as touch and input events and relays themto your RenderScript code, if needed.
RenderScript的实例:
<sdk_root>/samples/android-11/RenderScript
.
分享到:
相关推荐
Dynamic blur of Image Views for Android. This library is based on RenderScript. You can find more detail about RenderScript here: RenderScript Includes library and small example project. Gradle ...
主要介绍了Android RenderScript高斯模糊的相关代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
“RenderScript案例学习代码”中包含12个案例工程。分别为:RenderScript绘制字符串、RenderScript绘制颜色矩形、RenderScript绘制纹理矩形、RenderScript混合、RenderScript采样、RenderScript旋转的圆环(剪裁方式)...
Android RenderScript教程 作者:Ian G. Clifton链接: : 概述 该存储库包含我编写的RenderScript教程的源代码。 源代码与教程文章可能会有一些差异(例如,为了使所有代码适合一个存储库而进行了一些小的改进和...
主要为大家详细介绍了Android RenderScript实现高斯模糊的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
renderScript_fina ,max批量渲染工具,可以一键渲染多个文件
用于低版本(API Level8及以上)的安卓系统的图像处理的库文件,例如模糊、矩阵运算等的图像处理
毛玻璃效果(亦称磨砂效果),近两年在移动端的UI设计上越来越流行,下面这篇文章主要介绍了Android利用RenderScript实现毛玻璃模糊效果的相关资料,文中给出了详细的示例代码,需要的朋友可以参考学习,下面来一起...
RenderScriptPlayground是一个示例性Android应用程序,显示了如何将RenderScript与Android Studio和Gradle一起使用。 应用程序正在使用RenderScript支持库,因此它应可与Android Froyo(2.2)一起使用。 入门 1.克隆...
renderscript Google官方源码。
史上最强YUV转换RenderScript,支持转换为RGBA、BGRA,同时支持旋转和翻转。 YUV数据格式支持NV21、YV12、YUV420_888,对应Android Camera1API和Camera2 API的YUV处理。 这段时间在做一些Android Camera数据处理相关...
实现高斯模糊的工具包,github开源项目https://github.com/android/renderscript-intrinsics-replacement-toolkit打包生成。
简单的RenderScript实现照片取反色
android.support.v8.renderscript相关类找不到的错误可以下载使用
Day 3_ Graphics and Camera Android Bootcamp 2017 - Color Management Android Bootcamp 2017 ...Android Bootcamp 2017—RenderScript Android Bootcamp 2017—Sdcardfs Android Bootcamp 2017—Soong Build System
RenderScriptBlurExample 如何使用 Android 支持包 V8 ScriptIntrinsicBlur (RenderScript) 模糊 Bitmap 的示例有关详细信息,请参阅BlurFragment 。
使用OpenGL的Android快速画笔绘画模拟_Java_RenderScript