RenderScript Allocation Creation Functions
Stay organized with collections
Save and categorize content based on your preferences.
Overview
The functions below can be used to create Allocations from a Script.
These functions can be called directly or indirectly from an invokable function. If some control-flow path can result in a call to these functions from a RenderScript kernel function, a compiler error will be generated.
Summary
| Functions | |
|---|---|
| rsCreateAllocation | Create an rs_allocation object of given Type. |
| rsCreateElement | Creates an rs_element object of the specified data type |
| rsCreatePixelElement | Creates an rs_element object of the specified data type and data kind |
| rsCreateType | Creates an rs_type object with the specified Element and shape attributes |
| rsCreateVectorElement | Creates an rs_element object of the specified data type and vector width |
Functions
rsCreateAllocation : Create an rs_allocation object of given Type.
Parameters
| type | Type of the Allocation |
|---|---|
| usage | Usage flag for the allocation |
| mipmap | |
| usages | |
| ptr | |
| dimX | |
| dimY | |
| dimZ |
Creates an rs_allocation object of the given Type and usage.
RS_ALLOCATION_USAGE_SCRIPT and RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE are the only supported usage flags for Allocations created from within a RenderScript Script.
You can also use rsCreateAllocation_
E.g. rsCreateAllocation_int4() returns an Allocation of int4 data type of specified dimensions.
rsCreateElement : Creates an rs_element object of the specified data type
Parameters
| data_type | Data type of the Element |
|---|---|
| data_kind | |
| isNormalized | |
| vecSize |
Creates an rs_element object of the specified data type. The data kind of the Element will be set to RS_KIND_USER and vector_width will be set to 1, indicating non-vector.
rsCreatePixelElement : Creates an rs_element object of the specified data type and data kind
Parameters
| data_type | Data type of the Element |
|---|---|
| data_kind | Data kind of the Element |
Creates an rs_element object of the specified data type and data kind. The vector_width of the Element will be set to 1, indicating non-vector.
rsCreateType : Creates an rs_type object with the specified Element and shape attributes
Parameters
| element | Element to be associated with the Type |
|---|---|
| dimX | Size along the X dimension |
| dimY | Size along the Y dimension |
| dimZ | Size along the Z dimension |
| mipmaps | Flag indicating if the Type has a mipmap chain |
| faces | Flag indicating if the Type is a cubemap |
| yuv_format | YUV layout for the Type |
Creates an rs_type object with the specified Element and shape attributes.
dimX specifies the size of the X dimension.
dimY, if present and non-zero, indicates that the Y dimension is present and indicates its size.
dimZ, if present and non-zero, indicates that the Z dimension is present and indicates its size.
mipmaps indicates the presence of level of detail (LOD).
faces indicates the presence of cubemap faces.
yuv_format indicates the associated YUV format (or RS_YUV_NONE).
rsCreateVectorElement : Creates an rs_element object of the specified data type and vector width
Parameters
| data_type | Data type of the Element |
|---|---|
| vector_width | Vector width (either 2, 3, or 4) |
Creates an rs_element object of the specified data type and vector width. Value of vector_width must be 2, 3 or 4. The data kind of the Element will be set to RS_KIND_USER.