Element
open classElement: BaseObj
kotlin.Any | ||
↳ | android.renderscript.BaseObj | |
↳ | android.renderscript.Element |
An Element represents one item within an . 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 and a . The DataType encodes C type information of an Element, while the DataKind encodes how that Element should be interpreted by a android.renderscript.Sampler
. Note that objects with DataKind android.renderscript.Element.DataKind#USER
cannot be used as input for a android.renderscript.Sampler
. In general, objects that are intended for use with a android.renderscript.Sampler
should use bitmap-derived Elements such as android.renderscript.Element#RGBA_8888
or android.renderscript#Element.A_8.
Summary
Nested classes | |
---|---|
open |
Builder class for producing complex elements with matching field and name pairs. |
The special interpretation of the data if required. |
|
DataType represents the basic type information for a basic element. |
Public methods | |
---|---|
open static Element! |
ALLOCATION(rs: RenderScript!) |
open static Element! |
A_8(rs: RenderScript!) |
open static Element! |
BOOLEAN(rs: RenderScript!) Utility function for returning an Element containing a single Boolean. |
open static Element! |
ELEMENT(rs: RenderScript!) |
open static Element! |
F16(rs: RenderScript!) |
open static Element! |
F16_2(rs: RenderScript!) |
open static Element! |
F16_3(rs: RenderScript!) |
open static Element! |
F16_4(rs: RenderScript!) |
open static Element! |
F32(rs: RenderScript!) |
open static Element! |
F32_2(rs: RenderScript!) |
open static Element! |
F32_3(rs: RenderScript!) |
open static Element! |
F32_4(rs: RenderScript!) |
open static Element! |
F64(rs: RenderScript!) |
open static Element! |
F64_2(rs: RenderScript!) |
open static Element! |
F64_3(rs: RenderScript!) |
open static Element! |
F64_4(rs: RenderScript!) |
open static Element! |
FONT(rs: RenderScript!) |
open static Element! |
I16(rs: RenderScript!) |
open static Element! |
I16_2(rs: RenderScript!) |
open static Element! |
I16_3(rs: RenderScript!) |
open static Element! |
I16_4(rs: RenderScript!) |
open static Element! |
I32(rs: RenderScript!) |
open static Element! |
I32_2(rs: RenderScript!) |
open static Element! |
I32_3(rs: RenderScript!) |
open static Element! |
I32_4(rs: RenderScript!) |
open static Element! |
I64(rs: RenderScript!) |
open static Element! |
I64_2(rs: RenderScript!) |
open static Element! |
I64_3(rs: RenderScript!) |
open static Element! |
I64_4(rs: RenderScript!) |
open static Element! |
I8(rs: RenderScript!) Utility function for returning an Element containing a single SIGNED_8. |
open static Element! |
I8_2(rs: RenderScript!) |
open static Element! |
I8_3(rs: RenderScript!) |
open static Element! |
I8_4(rs: RenderScript!) |
open static Element! |
MATRIX4X4(rs: RenderScript!) |
open static Element! |
MATRIX_2X2(rs: RenderScript!) |
open static Element! |
MATRIX_3X3(rs: RenderScript!) |
open static Element! |
MATRIX_4X4(rs: RenderScript!) |
open static Element! |
MESH(rs: RenderScript!) |
open static Element! |
PROGRAM_FRAGMENT(rs: RenderScript!) |
open static Element! |
PROGRAM_RASTER(rs: RenderScript!) |
open static Element! |
PROGRAM_STORE(rs: RenderScript!) |
open static Element! |
PROGRAM_VERTEX(rs: RenderScript!) |
open static Element! |
RGBA_4444(rs: RenderScript!) |
open static Element! |
RGBA_5551(rs: RenderScript!) |
open static Element! |
RGBA_8888(rs: RenderScript!) |
open static Element! |
RGB_565(rs: RenderScript!) |
open static Element! |
RGB_888(rs: RenderScript!) |
open static Element! |
SAMPLER(rs: RenderScript!) |
open static Element! |
SCRIPT(rs: RenderScript!) |
open static Element! |
TYPE(rs: RenderScript!) |
open static Element! |
U16(rs: RenderScript!) |
open static Element! |
U16_2(rs: RenderScript!) |
open static Element! |
U16_3(rs: RenderScript!) |
open static Element! |
U16_4(rs: RenderScript!) |
open static Element! |
U32(rs: RenderScript!) |
open static Element! |
U32_2(rs: RenderScript!) |
open static Element! |
U32_3(rs: RenderScript!) |
open static Element! |
U32_4(rs: RenderScript!) |
open static Element! |
U64(rs: RenderScript!) |
open static Element! |
U64_2(rs: RenderScript!) |
open static Element! |
U64_3(rs: RenderScript!) |
open static Element! |
U64_4(rs: RenderScript!) |
open static Element! |
U8(rs: RenderScript!) Utility function for returning an Element containing a single UNSIGNED_8. |
open static Element! |
U8_2(rs: RenderScript!) |
open static Element! |
U8_3(rs: RenderScript!) |
open static Element! |
U8_4(rs: RenderScript!) |
open static Element! |
YUV(rs: RenderScript!) |
open static Element! |
createPixel(rs: RenderScript!, dt: Element.DataType!, dk: Element.DataKind!) Create a new pixel Element type. |
open static Element! |
createVector(rs: RenderScript!, dt: Element.DataType!, size: Int) Create a custom vector element of the specified DataType and vector size. |
open Int | |
open Element.DataKind! | |
open Element.DataType! | |
open Element! |
getSubElement(index: Int) For complex elements, this function will return the sub-element at index |
open Int |
getSubElementArraySize(index: Int) For complex elements, some sub-elements could be statically sized arrays. |
open Int |
Elements could be simple, such as an int or a float, or a structure with multiple sub elements, such as a collection of floats, float2, float4. |
open String! |
getSubElementName(index: Int) For complex elements, this function will return the sub-element name at index |
open Int |
getSubElementOffsetBytes(index: Int) This function specifies the location of a sub-element within the element |
open Int |
Returns the number of vector components. |
open Boolean |
isCompatible(e: Element!) Check if the current Element is compatible with another Element. |
open Boolean |
Return if a element is too complex for use as a data source for a Mesh or a Program. |
Inherited functions | |
---|---|
Public methods
ALLOCATION
open static funALLOCATION(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
A_8
open static funA_8(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
BOOLEAN
open static funBOOLEAN(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
Utility function for returning an Element containing a single Boolean.
Parameters | |
---|---|
rs |
RenderScript!: Context to which the element will belong. |
Return | |
---|---|
Element! |
Element |
ELEMENT
open static funELEMENT(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
F32
open static funF32(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
F32_2
open static funF32_2(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
F32_3
open static funF32_3(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
F32_4
open static funF32_4(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
F64
open static funF64(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
I16
open static funI16(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
I32
open static funI32(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
I64
open static funI64(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
I8
open static funI8(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
Utility function for returning an Element containing a single SIGNED_8.
Parameters | |
---|---|
rs |
RenderScript!: Context to which the element will belong. |
Return | |
---|---|
Element! |
Element |
MATRIX_2X2
open static funMATRIX_2X2(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
MATRIX_3X3
open static funMATRIX_3X3(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
MATRIX_4X4
open static funMATRIX_4X4(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
MESH
open static funMESH(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
PROGRAM_FRAGMENT
open static funPROGRAM_FRAGMENT(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
PROGRAM_RASTER
open static funPROGRAM_RASTER(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
PROGRAM_STORE
open static funPROGRAM_STORE(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
PROGRAM_VERTEX
open static funPROGRAM_VERTEX(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
RGBA_4444
open static funRGBA_4444(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
RGBA_5551
open static funRGBA_5551(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
RGBA_8888
open static funRGBA_8888(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
RGB_565
open static funRGB_565(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
RGB_888
open static funRGB_888(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
SAMPLER
open static funSAMPLER(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
SCRIPT
open static funSCRIPT(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
TYPE
open static funTYPE(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
U16
open static funU16(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
U32
open static funU32(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
U64
open static funU64(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
U8
open static funU8(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
Utility function for returning an Element containing a single UNSIGNED_8.
Parameters | |
---|---|
rs |
RenderScript!: Context to which the element will belong. |
Return | |
---|---|
Element! |
Element |
U8_4
open static funU8_4(rs: RenderScript!): Element!
Deprecated: Deprecated in Java.
createPixel
open static funcreatePixel(
rs: RenderScript!,
dt: Element.DataType!,
dk: Element.DataKind!
): Element!
Deprecated: Deprecated in Java.
Create a new pixel Element type. A matching DataType and DataKind must be provided. The DataType and DataKind must contain the same number of components. Vector size will be set to 1.
Parameters | |
---|---|
rs |
RenderScript!: The context associated with the new Element. |
dt |
Element.DataType!: The DataType for the new element. |
dk |
Element.DataKind!: The DataKind to specify the mapping of each component in the DataType. |
Return | |
---|---|
Element! |
Element |
createVector
open static funcreateVector(
rs: RenderScript!,
dt: Element.DataType!,
size: Int
): Element!
Deprecated: Deprecated in Java.
Create a custom vector element of the specified DataType and vector size. DataKind will be set to USER. Only primitive types (FLOAT_32, FLOAT_64, SIGNED_8, SIGNED_16, SIGNED_32, SIGNED_64, UNSIGNED_8, UNSIGNED_16, UNSIGNED_32, UNSIGNED_64, BOOLEAN) are supported.
Parameters | |
---|---|
rs |
RenderScript!: The context associated with the new Element. |
dt |
Element.DataType!: The DataType for the new Element. |
size |
Int: Vector size for the new Element. Range 2-4 inclusive supported. |
Return | |
---|---|
Element! |
Element |
getBytesSize
open fungetBytesSize(): Int
Deprecated: Deprecated in Java.
Return | |
---|---|
Int |
element size in bytes |
getDataKind
open fungetDataKind(): Element.DataKind!
Deprecated: Deprecated in Java.
Return | |
---|---|
Element.DataKind! |
element data kind |
getDataType
open fungetDataType(): Element.DataType!
Deprecated: Deprecated in Java.
Return | |
---|---|
Element.DataType! |
element data type |
getSubElement
open fungetSubElement(index: Int): Element!
Deprecated: Deprecated in Java.
For complex elements, this function will return the sub-element at index
Parameters | |
---|---|
index |
Int: index of the sub-element to return |
Return | |
---|---|
Element! |
sub-element in this element at given index |
getSubElementArraySize
open fungetSubElementArraySize(index: Int): Int
Deprecated: Deprecated in Java.
For complex elements, some sub-elements could be statically sized arrays. This function will return the array size for sub-element at index
Parameters | |
---|---|
index |
Int: index of the sub-element |
Return | |
---|---|
Int |
array size of sub-element in this element at given index |
getSubElementCount
open fungetSubElementCount(): Int
Deprecated: Deprecated in Java.
Elements could be simple, such as an int or a float, or a structure with multiple sub elements, such as a collection of floats, float2, float4. This function returns zero for simple elements or the number of sub-elements otherwise.
Return | |
---|---|
Int |
number of sub-elements in this element |
getSubElementName
open fungetSubElementName(index: Int): String!
Deprecated: Deprecated in Java.
For complex elements, this function will return the sub-element name at index
Parameters | |
---|---|
index |
Int: index of the sub-element |
Return | |
---|---|
String! |
sub-element in this element at given index |
getSubElementOffsetBytes
open fungetSubElementOffsetBytes(index: Int): Int
Deprecated: Deprecated in Java.
This function specifies the location of a sub-element within the element
Parameters | |
---|---|
index |
Int: index of the sub-element |
Return | |
---|---|
Int |
offset in bytes of sub-element in this element at given index |
getVectorSize
open fungetVectorSize(): Int
Deprecated: Deprecated in Java.
Returns the number of vector components. 2 for float2, 4 for float4, etc.
Return | |
---|---|
Int |
element vector size |
isCompatible
open funisCompatible(e: Element!): Boolean
Deprecated: Deprecated in Java.
Check if the current Element is compatible with another Element. Primitive Elements are compatible if they share the same underlying size and type (i.e. U8 is compatible with A_8). User-defined Elements must be equal in order to be compatible. This requires strict name equivalence for all sub-Elements (in addition to structural equivalence).
Parameters | |
---|---|
e |
Element!: The Element to check compatibility with. |
Return | |
---|---|
Boolean |
boolean true if the Elements are compatible, otherwise false. |
isComplex
open funisComplex(): Boolean
Deprecated: Deprecated in Java.
Return if a element is too complex for use as a data source for a Mesh or a Program.
Return | |
---|---|
Boolean |
boolean |