Element
public
class
Element
extends BaseObj
| java.lang.Object | ||
| ↳ | android.renderscript.BaseObj | |
| ↳ | android.renderscript.Element | |
This class was deprecated
in API level 31.
Renderscript has been deprecated in API level 31. Please refer to the migration
guide for the proposed alternatives.
An Element represents one item within an Allocation. An Element is roughly equivalent to a C
type in a RenderScript kernel. Elements may be basic or complex. Some basic
elements are
- A single float value (equivalent to a float in a kernel)
- A four-element float vector (equivalent to a float4 in a kernel)
- An unsigned 32-bit integer (equivalent to an unsigned int in a kernel)
- A single signed 8-bit integer (equivalent to a char in a kernel)
A complex element is roughly equivalent to a C struct
and contains a number of basic or complex Elements. From Java code, a complex
element contains a list of sub-elements and names that represents a
particular data structure. Structs used in RS scripts are available to Java
code by using the ScriptField_structname class that is reflected from
a particular script.
Basic Elements are comprised of a Element.DataType and a Element.DataKind. The DataType encodes C type
information of an Element, while the DataKind encodes how that Element should
be interpreted by a Sampler. Note that Allocation objects with DataKind Element.DataKind.USER cannot be used as input for a
Sampler. In general, Allocation objects that are intended for use with a
Sampler should use bitmap-derived Elements such
as RGBA_8888(RenderScript) or A_8(RenderScript).
Developer Guides
For more information about creating an application that uses RenderScript, read the RenderScript developer guide.