# Type

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/renderscript/Type#nestedclasses)\|[Methods](https://developer.android.com/reference/android/renderscript/Type#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/renderscript/Type#inhmethods)  

# Type

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/renderscript/Type "View this page in Kotlin")\|Java

`
public


class
Type
`  
`


``

extends `[BaseObj](https://developer.android.com/reference/android/renderscript/BaseObj)`


``


`

|---|---|---------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.renderscript.BaseObj](https://developer.android.com/reference/android/renderscript/BaseObj) ||
|   | ↳ | android.renderscript.Type |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 31.**   
Renderscript has been deprecated in API level 31. Please refer to the[migration guide](https://developer.android.com/guide/topics/renderscript/migration-guide)for the proposed alternatives.

<br />

A Type describes the[Element](https://developer.android.com/reference/android/renderscript/Element)and dimensions used for an[Allocation](https://developer.android.com/reference/android/renderscript/Allocation)or a parallel operation. Types are created through[Type.Builder](https://developer.android.com/reference/android/renderscript/Type.Builder).

A Type always includes an[Element](https://developer.android.com/reference/android/renderscript/Element)and an X dimension. A Type may be multidimensional, up to three dimensions. A nonzero value in the Y or Z dimensions indicates that the dimension is present. Note that a Type with only a given X dimension and a Type with the same X dimension but Y = 1 are not equivalent.

A Type also supports inclusion of level of detail (LOD) or cube map faces. LOD and cube map faces are booleans to indicate present or not present.

A Type also supports YUV format information to support an[Allocation](https://developer.android.com/reference/android/renderscript/Allocation)in a YUV format. The YUV formats supported are[ImageFormat.YV12](https://developer.android.com/reference/android/graphics/ImageFormat#YV12),[ImageFormat.NV21](https://developer.android.com/reference/android/graphics/ImageFormat#NV21), and[ImageFormat.YUV_420_888](https://developer.android.com/reference/android/graphics/ImageFormat#YUV_420_888)  

### Developer Guides

For more information about creating an application that uses RenderScript, read the[RenderScript](https://developer.android.com/guide/topics/renderscript)developer guide.

<br />

## Summary

|                                                     ### Nested classes                                                      ||
|----------|-------------------------------------------------------------------------------------------------------------------|
| ` class` | [Type.Builder](https://developer.android.com/reference/android/renderscript/Type.Builder) Builder class for Type. |

|                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                              ||
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[Type](https://developer.android.com/reference/android/renderscript/Type) | ` `[createX](https://developer.android.com/reference/android/renderscript/Type#createX(android.renderscript.RenderScript,%20android.renderscript.Element,%20int))`(`[RenderScript](https://developer.android.com/reference/android/renderscript/RenderScript)` rs, `[Element](https://developer.android.com/reference/android/renderscript/Element)` e, int dimX) ` Utility function for creating basic 1D types.                                       |
| ` static `[Type](https://developer.android.com/reference/android/renderscript/Type) | ` `[createXY](https://developer.android.com/reference/android/renderscript/Type#createXY(android.renderscript.RenderScript,%20android.renderscript.Element,%20int,%20int))`(`[RenderScript](https://developer.android.com/reference/android/renderscript/RenderScript)` rs, `[Element](https://developer.android.com/reference/android/renderscript/Element)` e, int dimX, int dimY) ` Utility function for creating basic 2D types.                    |
| ` static `[Type](https://developer.android.com/reference/android/renderscript/Type) | ` `[createXYZ](https://developer.android.com/reference/android/renderscript/Type#createXYZ(android.renderscript.RenderScript,%20android.renderscript.Element,%20int,%20int,%20int))`(`[RenderScript](https://developer.android.com/reference/android/renderscript/RenderScript)` rs, `[Element](https://developer.android.com/reference/android/renderscript/Element)` e, int dimX, int dimY, int dimZ) ` Utility function for creating basic 3D types. |
| ` int`                                                                              | ` `[getCount](https://developer.android.com/reference/android/renderscript/Type#getCount())`() ` Return the total number of accessable cells in the Type.                                                                                                                                                                                                                                                                                               |
| ` `[Element](https://developer.android.com/reference/android/renderscript/Element)  | ` `[getElement](https://developer.android.com/reference/android/renderscript/Type#getElement())`() ` Return the element associated with this Type.                                                                                                                                                                                                                                                                                                      |
| ` int`                                                                              | ` `[getX](https://developer.android.com/reference/android/renderscript/Type#getX())`() ` Return the value of the X dimension.                                                                                                                                                                                                                                                                                                                           |
| ` int`                                                                              | ` `[getY](https://developer.android.com/reference/android/renderscript/Type#getY())`() ` Return the value of the Y dimension or 0 for a 1D allocation.                                                                                                                                                                                                                                                                                                  |
| ` int`                                                                              | ` `[getYuv](https://developer.android.com/reference/android/renderscript/Type#getYuv())`() ` Get the YUV format                                                                                                                                                                                                                                                                                                                                         |
| ` int`                                                                              | ` `[getZ](https://developer.android.com/reference/android/renderscript/Type#getZ())`() ` Return the value of the Z dimension or 0 for a 1D or 2D allocation.                                                                                                                                                                                                                                                                                            |
| ` boolean`                                                                          | ` `[hasFaces](https://developer.android.com/reference/android/renderscript/Type#hasFaces())`() ` Return if the Type is a cube map.                                                                                                                                                                                                                                                                                                                      |
| ` boolean`                                                                          | ` `[hasMipmaps](https://developer.android.com/reference/android/renderscript/Type#hasMipmaps())`() ` Return if the Type has a mipmap chain.                                                                                                                                                                                                                                                                                                             |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.renderscript.BaseObj](https://developer.android.com/reference/android/renderscript/BaseObj)` ` |-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                               | ` `[destroy](https://developer.android.com/reference/android/renderscript/BaseObj#destroy())`() ` Frees any native resources associated with this object.                                                                                              | | ` boolean`                                                            | ` `[equals](https://developer.android.com/reference/android/renderscript/BaseObj#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Compare the current BaseObj with another BaseObj for equality. | | ` void`                                                               | ` `[finalize](https://developer.android.com/reference/android/renderscript/BaseObj#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                   | | ` `[String](https://developer.android.com/reference/java/lang/String) | ` `[getName](https://developer.android.com/reference/android/renderscript/BaseObj#getName())`() `                                                                                                                                                      | | ` int`                                                                | ` `[hashCode](https://developer.android.com/reference/android/renderscript/BaseObj#hashCode())`() ` Calculates the hash code value for a BaseObj.                                                                                                      | | ` void`                                                               | ` `[setName](https://developer.android.com/reference/android/renderscript/BaseObj#setName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` setName assigns a name to an object.                        | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### createX

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Type createX (RenderScript rs, 
                Element e, 
                int dimX)
```

Utility function for creating basic 1D types. The type is created without mipmaps enabled.

<br />

|                       Parameters                        ||
|--------|-------------------------------------------------|
| `rs`   | `RenderScript`: The RenderScript context <br /> |
| `e`    | `Element`: The Element for the Type <br />      |
| `dimX` | `int`: The X dimension, must be \> 0 <br />     |

|                                        Returns                                         ||
|---------------------------------------------------------------------------|-------------|
| [Type](https://developer.android.com/reference/android/renderscript/Type) | Type <br /> |

### createXY

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Type createXY (RenderScript rs, 
                Element e, 
                int dimX, 
                int dimY)
```

Utility function for creating basic 2D types. The type is created without mipmaps or cubemaps.

<br />

|                       Parameters                        ||
|--------|-------------------------------------------------|
| `rs`   | `RenderScript`: The RenderScript context <br /> |
| `e`    | `Element`: The Element for the Type <br />      |
| `dimX` | `int`: The X dimension, must be \> 0 <br />     |
| `dimY` | `int`: The Y dimension, must be \> 0 <br />     |

|                                        Returns                                         ||
|---------------------------------------------------------------------------|-------------|
| [Type](https://developer.android.com/reference/android/renderscript/Type) | Type <br /> |

### createXYZ

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Type createXYZ (RenderScript rs, 
                Element e, 
                int dimX, 
                int dimY, 
                int dimZ)
```

Utility function for creating basic 3D types. The type is created without mipmaps.

<br />

|                       Parameters                        ||
|--------|-------------------------------------------------|
| `rs`   | `RenderScript`: The RenderScript context <br /> |
| `e`    | `Element`: The Element for the Type <br />      |
| `dimX` | `int`: The X dimension, must be \> 0 <br />     |
| `dimY` | `int`: The Y dimension, must be \> 0 <br />     |
| `dimZ` | `int`: The Z dimension, must be \> 0 <br />     |

|                                        Returns                                         ||
|---------------------------------------------------------------------------|-------------|
| [Type](https://developer.android.com/reference/android/renderscript/Type) | Type <br /> |

### getCount

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getCount ()
```

Return the total number of accessable cells in the Type.

<br />

|      Returns      ||
|-------|------------|
| `int` | int <br /> |

### getElement

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Element getElement ()
```

Return the element associated with this Type.

<br />

|                                             Returns                                             ||
|---------------------------------------------------------------------------------|----------------|
| [Element](https://developer.android.com/reference/android/renderscript/Element) | Element <br /> |

### getX

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getX ()
```

Return the value of the X dimension.

<br />

|      Returns      ||
|-------|------------|
| `int` | int <br /> |

### getY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getY ()
```

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

<br />

|      Returns      ||
|-------|------------|
| `int` | int <br /> |

### getYuv

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getYuv ()
```

Get the YUV format

<br />

|      Returns      ||
|-------|------------|
| `int` | int <br /> |

### getZ

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getZ ()
```

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

<br />

|      Returns      ||
|-------|------------|
| `int` | int <br /> |

### hasFaces

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean hasFaces ()
```

Return if the Type is a cube map.

<br />

|          Returns          ||
|-----------|----------------|
| `boolean` | boolean <br /> |

### hasMipmaps

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean hasMipmaps ()
```

Return if the Type has a mipmap chain.

<br />

|          Returns          ||
|-----------|----------------|
| `boolean` | boolean <br /> |