# ScriptGroup.Builder

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/renderscript/ScriptGroup.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.renderscript.ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#) |

*** ** * ** ***

| **This class was deprecated in API level 23.**
|
| Use[Builder2](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder2)instead.

Helper class to build a ScriptGroup. A ScriptGroup is created in two steps.

First, all kernels to be used by the ScriptGroup should be added.

Second, add connections between kernels. There are two types of connections: kernel to kernel and kernel to field. Kernel to kernel allows a kernel's output to be passed to another kernel as input. Kernel to field allows the output of one kernel to be bound as a script global. Kernel to kernel is higher performance and should be used where possible.

A ScriptGroup must contain a single directed acyclic graph (DAG); it cannot contain cycles. Currently, all kernels used in a ScriptGroup must come from different Script objects. Additionally, all kernels in a ScriptGroup must have at least one input, output, or internal connection.

Once all connections are made, a call to[create](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#create())will return the ScriptGroup object.

## Summary

|                                                                                                                                             Public constructors                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#Builder(android.renderscript.RenderScript))`(`rs:` `[RenderScript](https://developer.android.com/reference/kotlin/android/renderscript/RenderScript)!`)` Create a Builder for generating a ScriptGroup. |

|                                                                                                                                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                                                                                                                                    ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | [addConnection](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#addConnection(android.renderscript.Type,%20android.renderscript.Script.KernelID,%20android.renderscript.Script.FieldID))`(`t:` `[Type](https://developer.android.com/reference/kotlin/android/renderscript/Type)!`, `from:` `[Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!`, `to:` `[Script.FieldID](https://developer.android.com/reference/kotlin/android/renderscript/Script.FieldID)!`)` Adds a connection to the group.    |
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | [addConnection](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#addConnection(android.renderscript.Type,%20android.renderscript.Script.KernelID,%20android.renderscript.Script.KernelID))`(`t:` `[Type](https://developer.android.com/reference/kotlin/android/renderscript/Type)!`, `from:` `[Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!`, `to:` `[Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!`)` Adds a connection to the group. |
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | [addKernel](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#addKernel(android.renderscript.Script.KernelID))`(`k:` `[Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!`)` Adds a Kernel to the group.                                                                                                                                                                                                                                                                                                |
| [ScriptGroup](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup)!                  | [create](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#create())`()` Creates the Script group.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Public constructors

### Builder

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(rs: RenderScript!)
```

Create a Builder for generating a ScriptGroup.

|                                                            Parameters                                                             ||
|------|-----------------------------------------------------------------------------------------------------------------------------|
| `rs` | [RenderScript](https://developer.android.com/reference/kotlin/android/renderscript/RenderScript)!:The RenderScript context. |

## Public methods

### addConnection

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addConnection(
    t: Type!, 
    from: Script.KernelID!, 
    to: Script.FieldID!
): ScriptGroup.Builder!
```

**Deprecated:** *Deprecated in Java.*

Adds a connection to the group.

|                                                                                                   Parameters                                                                                                   ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `t`    | [Type](https://developer.android.com/reference/kotlin/android/renderscript/Type)!:The type of the connection. This is used to determine the kernel launch sizes on the source side of this connection. |
| `from` | [Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!:The source for the connection.                                                                 |
| `to`   | [Script.FieldID](https://developer.android.com/reference/kotlin/android/renderscript/Script.FieldID)!:The destination of the connection.                                                               |

|                                                                 Return                                                                 ||
|------------------------------------------------------------------------------------------------------------------|----------------------|
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | Builder Returns this |

### addConnection

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addConnection(
    t: Type!, 
    from: Script.KernelID!, 
    to: Script.KernelID!
): ScriptGroup.Builder!
```

**Deprecated:** *Deprecated in Java.*

Adds a connection to the group.

|                                                                                                 Parameters                                                                                                 ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `t`    | [Type](https://developer.android.com/reference/kotlin/android/renderscript/Type)!:The type of the connection. This is used to determine the kernel launch sizes for both sides of this connection. |
| `from` | [Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!:The source for the connection.                                                             |
| `to`   | [Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!:The destination of the connection.                                                         |

|                                                                 Return                                                                 ||
|------------------------------------------------------------------------------------------------------------------|----------------------|
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | Builder Returns this |

### addKernel

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addKernel(k: Script.KernelID!): ScriptGroup.Builder!
```

**Deprecated:** *Deprecated in Java.*

Adds a Kernel to the group.

|                                                           Parameters                                                            ||
|-----|----------------------------------------------------------------------------------------------------------------------------|
| `k` | [Script.KernelID](https://developer.android.com/reference/kotlin/android/renderscript/Script.KernelID)!:The kernel to add. |

|                                                                 Return                                                                  ||
|------------------------------------------------------------------------------------------------------------------|-----------------------|
| [ScriptGroup.Builder](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup.Builder#)! | Builder Returns this. |

### create

Added in[API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun create(): ScriptGroup!
```

**Deprecated:** *Deprecated in Java.*

Creates the Script group.

|                                                              Return                                                              ||
|-------------------------------------------------------------------------------------------------|---------------------------------|
| [ScriptGroup](https://developer.android.com/reference/kotlin/android/renderscript/ScriptGroup)! | ScriptGroup The new ScriptGroup |