Skip to content

Most visited

Recently visited

navigation

ScriptGroup.Builder2

public static final class ScriptGroup.Builder2
extends Object

java.lang.Object
   ↳ android.support.v8.renderscript.ScriptGroup.Builder2


The builder class for creating script groups

A script group is created using closures (see class ScriptGroup.Closure). A closure is a function call to a kernel or invocable function. Each function argument or global variable accessed inside the function is bound to 1) a known value, 2) a script group input (see class ScriptGroup.Input), or 3) a future (see class ScriptGroup.Future). A future is the output of a closure, either the return value of the function or a global variable written by that function.

Closures are created using the addKernel(Script.KernelID, Type, Object...) or addInvoke(Script.InvokeID, Object...) methods. When a closure is created, futures from previously created closures can be used as its inputs. External script group inputs can be used as inputs to individual closures as well. An external script group input is created using the addInput() method. A script group is created by a call to the create(String, ScriptGroup.Future...) method, which accepts an array of futures as the outputs for the script group.

Closures in a script group can be evaluated in any order as long as the following conditions are met: 1) a closure must be evaluated before any other closures that take its futures as inputs; 2) all closures added before an invoke closure must be evaluated before it; and 3) all closures added after an invoke closure must be evaluated after it. As a special case, the order that the closures are added is a legal evaluation order. However, other evaluation orders are possible, including concurrently evaluating independent closures.

Summary

Public constructors

ScriptGroup.Builder2(RenderScript rs)

Returns a Builder object

Public methods

ScriptGroup.Input addInput()

Adds a script group input

ScriptGroup.Closure addInvoke(Script.InvokeID invoke, Object... argsAndBindings)

Adds a closure for an invocable function

ScriptGroup.Closure addKernel(Script.KernelID k, Type returnType, Object... argsAndBindings)

Adds a closure for a kernel

ScriptGroup create(String name, Future... outputs)

Creates a script group

Inherited methods

From class java.lang.Object

Public constructors

ScriptGroup.Builder2

added in version 23.0.0
ScriptGroup.Builder2 (RenderScript rs)

Returns a Builder object

Parameters
rs RenderScript: the RenderScript context

Public methods

addInput

added in version 23.0.0
ScriptGroup.Input addInput ()

Adds a script group input

Returns
ScriptGroup.Input a script group input, which can be used as an argument or a value to a global variable for creating closures

addInvoke

added in version 23.0.0
ScriptGroup.Closure addInvoke (Script.InvokeID invoke, 
                Object... argsAndBindings)

Adds a closure for an invocable function

Parameters
invoke Script.InvokeID: Invoke ID for the invocable function

argsAndBindings Object: arguments followed by bindings for global variables

Returns
ScriptGroup.Closure a closure

addKernel

added in version 23.0.0
ScriptGroup.Closure addKernel (Script.KernelID k, 
                Type returnType, 
                Object... argsAndBindings)

Adds a closure for a kernel

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

create

added in version 23.0.0
ScriptGroup create (String name, 
                Future... outputs)

Creates a script group

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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)