java.lang.Object | |
↳ | android.renderscript.Element |
The most basic data type. An element represents one cell of a memory allocation. Element is the basic data type of Renderscript. An element can be of two forms: Basic elements or Complex forms. Examples of basic elements are:
Complex elements contain a list of sub-elements and names that represents a structure of data. The fields can be accessed by name from a script or shader. The memory layout is defined and ordered. Data alignment is determinied by the most basic primitive type. i.e. a float4 vector will be alligned to sizeof(float) and not sizeof(float4). The ordering of elements in memory will be the order in which they were added with each component aligned as necessary. No re-ordering will be done.
The primary source of elements are from scripts. A script that exports a bind point for a data structure generates a Renderscript element to represent the data exported by the script. The other common source of elements is from bitmap formats.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Element.Builder | Builder class for producing complex elements with matching field and name pairs. | ||||||||||
Element.DataKind | The special interpretation of the data if required. | ||||||||||
Element.DataType | DataType represents the basic type information for a basic element. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Utility function for returning an Element containing a single Boolean.
| |||||||||||
Utility function for returning an Element containing a single SIGNED_8.
| |||||||||||
Utility function for returning an Element containing a single UNSIGNED_8.
| |||||||||||
Create a new pixel Element type.
| |||||||||||
Create a custom vector element of the specified DataType and vector size.
| |||||||||||
destroy disconnects the object from the native object effectivly
rendering this java object dead.
| |||||||||||
Return if a element is too complex for use as a data source for a Mesh or
a Program.
| |||||||||||
setName assigns a name to an object.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called before the object's memory is reclaimed by the VM.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Utility function for returning an Element containing a single Boolean.
rs | Context to which the element will belong. |
---|
Utility function for returning an Element containing a single SIGNED_8.
rs | Context to which the element will belong. |
---|
Utility function for returning an Element containing a single UNSIGNED_8.
rs | Context to which the element will belong. |
---|
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.
rs | The context associated with the new Element. |
---|---|
dt | The DataType for the new element. |
dk | The DataKind to specify the mapping of each component in the DataType. |
Create a custom vector element of the specified DataType and vector size. DataKind will be set to USER.
rs | The context associated with the new Element. |
---|---|
dt | The DataType for the new element. |
size | Vector size for the new Element. Range 2-4 inclusive supported. |
destroy disconnects the object from the native object effectivly rendering this java object dead. The primary use is to force immediate cleanup of resources when its believed the GC will not respond quickly enough.
Return if a element is too complex for use as a data source for a Mesh or a Program.
setName assigns a name to an object. This object can later be looked up by this name. This name will also be retained if the object is written to an A3D file.
name | The name to assign to the object. |
---|
Called before the object's memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue
, because it provides more control
over the way the VM deals with references during garbage collection.
Throwable |
---|