public class

Type

extends Object
java.lang.Object
   ↳ android.renderscript.Type

Class Overview

Type is an allocation template. It consists of an Element and one or more dimensions. It describes only the layout of memory but does not allocate any storage for the data that is described.

A Type consists of several dimensions. Those are X, Y, Z, LOD (level of detail), Faces (faces of a cube map). The X,Y,Z dimensions can be assigned any positive integral value within the constraints of available memory. A single dimension allocation would have an X dimension of greater than zero while the Y and Z dimensions would be zero to indicate not present. In this regard an allocation of x=10, y=1 would be considered 2 dimensionsal while x=10, y=0 would be considered 1 dimensional.

The LOD and Faces dimensions are booleans to indicate present or not present.

Summary

Nested Classes
class Type.Builder Builder class for Type. 
enum Type.CubemapFace  
Public Methods
synchronized void destroy()
destroy disconnects the object from the native object effectivly rendering this java object dead.
int getCount()
Return the total number of accessable cells in the Type.
Element getElement()
Return the element associated with this Type.
int getX()
Return the value of the X dimension.
int getY()
Return the value of the Y dimension or 0 for a 1D allocation.
int getZ()
Return the value of the Z dimension or 0 for a 1D or 2D allocation.
boolean hasFaces()
Return if the Type is a cube map.
boolean hasMipmaps()
Return if the Type has a mipmap chain.
void setName(String name)
setName assigns a name to an object.
Protected Methods
void finalize()
Called before the object's memory is reclaimed by the VM.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public synchronized void destroy ()

Since: API Level 11

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.

public int getCount ()

Since: API Level 11

Return the total number of accessable cells in the Type.

Returns
  • int

public Element getElement ()

Since: API Level 11

Return the element associated with this Type.

Returns
  • Element

public int getX ()

Since: API Level 11

Return the value of the X dimension.

Returns
  • int

public int getY ()

Since: API Level 11

Return the value of the Y dimension or 0 for a 1D allocation.

Returns
  • int

public int getZ ()

Since: API Level 11

Return the value of the Z dimension or 0 for a 1D or 2D allocation.

Returns
  • int

public boolean hasFaces ()

Since: API Level 11

Return if the Type is a cube map.

Returns
  • boolean

public boolean hasMipmaps ()

Since: API Level 11

Return if the Type has a mipmap chain.

Returns
  • boolean

public void setName (String name)

Since: API Level 11

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.

Parameters
name The name to assign to the object.

Protected Methods

protected void finalize ()

Since: API Level 11

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.

Throws
Throwable