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 will return the ScriptGroup object.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ScriptGroup.Builder\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/renderscript/ScriptGroup.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|-----------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.renderscript.ScriptGroup.Builder](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 23.**\n|\n| Use [Builder2](/reference/kotlin/android/renderscript/ScriptGroup.Builder2) instead.\n\nHelper class to build a ScriptGroup. A ScriptGroup is created in two steps.\n\nFirst, all kernels to be used by the ScriptGroup should be added.\n\nSecond, 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.\n\nA 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.\n\nOnce all connections are made, a call to [create](#create()) will return the ScriptGroup object.\n\nSummary\n-------\n\n| Public constructors ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(android.renderscript.RenderScript))`(`rs:` `[RenderScript](/reference/kotlin/android/renderscript/RenderScript)!`)` Create a Builder for generating a ScriptGroup. |\n\n| Public methods ||\n|--------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ScriptGroup.Builder](#)! | [addConnection](#addConnection(android.renderscript.Type,%20android.renderscript.Script.KernelID,%20android.renderscript.Script.FieldID))`(`t:` `[Type](/reference/kotlin/android/renderscript/Type)!`, `from:` `[Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!`, `to:` `[Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)!`)` Adds a connection to the group. |\n| [ScriptGroup.Builder](#)! | [addConnection](#addConnection(android.renderscript.Type,%20android.renderscript.Script.KernelID,%20android.renderscript.Script.KernelID))`(`t:` `[Type](/reference/kotlin/android/renderscript/Type)!`, `from:` `[Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!`, `to:` `[Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!`)` Adds a connection to the group. |\n| [ScriptGroup.Builder](#)! | [addKernel](#addKernel(android.renderscript.Script.KernelID))`(`k:` `[Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!`)` Adds a Kernel to the group. |\n| [ScriptGroup](/reference/kotlin/android/renderscript/ScriptGroup)! | [create](#create())`()` Creates the Script group. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(rs: RenderScript!)\n```\n\nCreate a Builder for generating a ScriptGroup.\n\n| Parameters ||\n|------|-------------------------------------------------------------------------------------------------|\n| `rs` | [RenderScript](/reference/kotlin/android/renderscript/RenderScript)!: The RenderScript context. |\n\nPublic methods\n--------------\n\n### addConnection\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addConnection(\n t: Type!, \n from: Script.KernelID!, \n to: Script.FieldID!\n): ScriptGroup.Builder!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nAdds a connection to the group.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `t` | [Type](/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. |\n| `from` | [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!: The source for the connection. |\n| `to` | [Script.FieldID](/reference/kotlin/android/renderscript/Script.FieldID)!: The destination of the connection. |\n\n| Return ||\n|---------------------------|----------------------|\n| [ScriptGroup.Builder](#)! | Builder Returns this |\n\n### addConnection\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addConnection(\n t: Type!, \n from: Script.KernelID!, \n to: Script.KernelID!\n): ScriptGroup.Builder!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nAdds a connection to the group.\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `t` | [Type](/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. |\n| `from` | [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!: The source for the connection. |\n| `to` | [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!: The destination of the connection. |\n\n| Return ||\n|---------------------------|----------------------|\n| [ScriptGroup.Builder](#)! | Builder Returns this |\n\n### addKernel\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addKernel(k: Script.KernelID!): ScriptGroup.Builder!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nAdds a Kernel to the group.\n\n| Parameters ||\n|-----|------------------------------------------------------------------------------------------------|\n| `k` | [Script.KernelID](/reference/kotlin/android/renderscript/Script.KernelID)!: The kernel to add. |\n\n| Return ||\n|---------------------------|-----------------------|\n| [ScriptGroup.Builder](#)! | Builder Returns this. |\n\n### create\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun create(): ScriptGroup!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCreates the Script group.\n\n| Return ||\n|--------------------------------------------------------------------|---------------------------------|\n| [ScriptGroup](/reference/kotlin/android/renderscript/ScriptGroup)! | ScriptGroup The new ScriptGroup |"]]