public static final class ScriptGroup.Builder2
extends Object
| java.lang.Object | |
| android.support.v8.renderscript.ScriptGroup.Builder2 | |
用于创建脚本组的构建器类
脚本组是使用闭包创建的(请参阅类ScriptGroup.Closure )。 闭包是对内核或可调用函数的函数调用。 在函数内部访问的每个函数参数或全局变量都绑定到1)已知值,2)脚本组输入(请参见class ScriptGroup.Input )或3)将来(请参阅class ScriptGroup.Future )。 未来是闭包的输出,可以是函数的返回值,也可以是该函数编写的全局变量。
闭包使用addKernel(Script.KernelID, Type, Object...)或addInvoke(Script.InvokeID, Object...)方法创建。 在创建关闭时,以前创建的关闭的期货可以用作其输入。 外部脚本组输入也可用作个别关闭的输入。 使用addInput()方法创建外部脚本组输入。 通过调用create(String, ScriptGroup.Future...)方法创建脚本组,该方法接受一组期货作为脚本组的输出。
只要满足以下条件,脚本组中的闭包可以按任何顺序进行评估:1)在将期货作为输入的任何其他关闭之前,必须评估关闭; 2)在调用关闭之前添加的所有闭包必须在它之前进行评估; 3)在调用关闭之后添加的所有闭包必须在它之后被评估。 作为一种特殊情况,添加闭包的顺序是一个合法的评估顺序。 但是,其他评估指令也是可能的,包括同时评估独立关闭。
Public constructors |
|
|---|---|
ScriptGroup.Builder2(RenderScript rs) 返回一个Builder对象 |
|
公共方法(Public methods) |
|
|---|---|
ScriptGroup.Input |
addInput() 添加一个脚本组输入 |
ScriptGroup.Closure |
addInvoke(Script.InvokeID invoke, Object... argsAndBindings) 为可调用函数添加闭包 |
ScriptGroup.Closure |
addKernel(Script.KernelID k, Type returnType, Object... argsAndBindings) 为内核添加一个闭包 |
ScriptGroup |
create(String name, Future... outputs) 创建一个脚本组 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
ScriptGroup.Builder2 (RenderScript rs)
返回一个Builder对象
| 参数(Parameters) | |
|---|---|
rs |
RenderScript: the RenderScript context |
ScriptGroup.Input addInput ()
添加一个脚本组输入
| 返回(Returns) | |
|---|---|
ScriptGroup.Input |
a script group input, which can be used as an argument or a value to a global variable for creating closures |
ScriptGroup.Closure addInvoke (Script.InvokeID invoke, Object... argsAndBindings)
为可调用函数添加闭包
| 参数(Parameters) | |
|---|---|
invoke |
Script.InvokeID: Invoke ID for the invocable function |
argsAndBindings |
Object: arguments followed by bindings for global variables |
| 返回(Returns) | |
|---|---|
ScriptGroup.Closure |
a closure |
ScriptGroup.Closure addKernel (Script.KernelID k, Type returnType, Object... argsAndBindings)
为内核添加一个闭包
| 参数(Parameters) | |
|---|---|
k |
Script.KernelID: Kernel ID for the kernel function |
returnType |
Type
|
argsAndBindings |
Object: arguments followed by bindings for global variables |
| 返回(Returns) | |
|---|---|
ScriptGroup.Closure |
a closure |
ScriptGroup create (String name, Future... outputs)
创建一个脚本组
| 参数(Parameters) | |
|---|---|
name |
String: name for the script group. Legal names can only contain letters, digits, '-', or '_'. The name can be no longer than 100 characters. |
outputs |
Future: futures intended as outputs of the script group |
| 返回(Returns) | |
|---|---|
ScriptGroup |
a script group |