Added in API level 11
Deprecated in API level 31

Allocation

open class Allocation : BaseObj
kotlin.Any
   ↳ android.renderscript.BaseObj
   ↳ android.renderscript.Allocation

This class provides the primary method through which data is passed to and from RenderScript kernels. An Allocation provides the backing store for a given android.renderscript.Type.

An Allocation also contains a set of usage flags that denote how the Allocation could be used. For example, an Allocation may have usage flags specifying that it can be used from a script as well as input to a . A developer must synchronize across these different usages using android.renderscript.Allocation#syncAll in order to ensure that different users of the Allocation have a consistent view of memory. For example, in the case where an Allocation is used as the output of one kernel and as Sampler input in a later kernel, a developer must call syncAll(Allocation.USAGE_SCRIPT) prior to launching the second kernel to ensure correctness.

An Allocation can be populated with the #copyFrom routines. For more complex Element types, the #copyFromUnchecked methods can be used to copy from byte arrays or similar constructs.

Summary

Nested classes

Controls mipmap behavior when using the bitmap creation and update functions.

abstract

Interface to handle notification when new buffers are available via USAGE_IO_INPUT.

Constants
static Int

The Allocation will be used as the source of shader constants by one or more programs.

static Int

The Allocation will be used as a target for offscreen rendering This was deprecated in API level 16.

static Int

The Allocation will be used as a texture source by one or more graphics programs.

static Int

The Allocation will be used as a graphics mesh.

static Int

The Allocation will be used as a android.view.Surface consumer.

static Int

The Allocation will be used as a android.view.Surface producer.

static Int

The Allocation will be bound to and accessed by scripts.

static Int

The Allocation's backing store will be inherited from another object (usually a android.graphics.Bitmap); copying to or from the original source Bitmap will cause a synchronization rather than a full copy.

Public methods
open Unit
copy1DRangeFrom(off: Int, count: Int, array: Any!)

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeFrom(off: Int, count: Int, d: IntArray!)

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeFrom(off: Int, count: Int, d: ShortArray!)

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeFrom(off: Int, count: Int, d: ByteArray!)

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeFrom(off: Int, count: Int, d: FloatArray!)

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeFrom(off: Int, count: Int, data: Allocation!, dataOff: Int)

Copy part of an Allocation into this Allocation.

open Unit
copy1DRangeFromUnchecked(off: Int, count: Int, array: Any!)

Copy an array into a 1D region of this Allocation.

open Unit

Copy an array into a 1D region of this Allocation.

open Unit

Copy an array into a 1D region of this Allocation.

open Unit

Copy an array into a 1D region of this Allocation.

open Unit

Copy an array into a 1D region of this Allocation.

open Unit
copy1DRangeTo(off: Int, count: Int, array: Any!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeTo(off: Int, count: Int, d: IntArray!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeTo(off: Int, count: Int, d: ShortArray!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeTo(off: Int, count: Int, d: ByteArray!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeTo(off: Int, count: Int, d: FloatArray!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeToUnchecked(off: Int, count: Int, array: Any!)

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeToUnchecked(off: Int, count: Int, d: IntArray!)

Copy a 1D region of this Allocation into an array.

open Unit

Copy a 1D region of this Allocation into an array.

open Unit
copy1DRangeToUnchecked(off: Int, count: Int, d: ByteArray!)

Copy a 1D region of this Allocation into an array.

open Unit

Copy a 1D region of this Allocation into an array.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, array: Any!)

Copy from an array into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, data: ByteArray!)

Copy from an array into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, data: ShortArray!)

Copy from an array into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, data: IntArray!)

Copy from an array into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, data: FloatArray!)

Copy from an array into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, w: Int, h: Int, data: Allocation!, dataXoff: Int, dataYoff: Int)

Copy a rectangular region from an Allocation into a rectangular region in this Allocation.

open Unit
copy2DRangeFrom(xoff: Int, yoff: Int, data: Bitmap!)

Copy a android.graphics.Bitmap into an Allocation.

open Unit
copy2DRangeTo(xoff: Int, yoff: Int, w: Int, h: Int, array: Any!)

Copy from a rectangular region in this Allocation into an array.

open Unit
copy2DRangeTo(xoff: Int, yoff: Int, w: Int, h: Int, data: ByteArray!)

Copy from a rectangular region in this Allocation into an array.

open Unit
copy2DRangeTo(xoff: Int, yoff: Int, w: Int, h: Int, data: ShortArray!)

Copy from a rectangular region in this Allocation into an array.

open Unit
copy2DRangeTo(xoff: Int, yoff: Int, w: Int, h: Int, data: IntArray!)

Copy from a rectangular region in this Allocation into an array.

open Unit
copy2DRangeTo(xoff: Int, yoff: Int, w: Int, h: Int, data: FloatArray!)

Copy from a rectangular region in this Allocation into an array.

open Unit
copy3DRangeFrom(xoff: Int, yoff: Int, zoff: Int, w: Int, h: Int, d: Int, array: Any!)

Copy from an array into a 3D region in this Allocation.

open Unit
copy3DRangeFrom(xoff: Int, yoff: Int, zoff: Int, w: Int, h: Int, d: Int, data: Allocation!, dataXoff: Int, dataYoff: Int, dataZoff: Int)

Copy a rectangular region into the allocation from another allocation.

open Unit
copy3DRangeTo(xoff: Int, yoff: Int, zoff: Int, w: Int, h: Int, d: Int, array: Any!)

open Unit

Copy an array of RS objects to the Allocation.

open Unit
copyFrom(array: Any!)

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into an Allocation from a android.graphics.Bitmap.

open Unit

Copy an Allocation from an Allocation.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy into this Allocation from an array.

open Unit

Copy from the Allocation into a android.graphics.Bitmap.

open Unit
copyTo(array: Any!)

Copy from the Allocation into an array.

open Unit

Copy from the Allocation into a byte array.

open Unit

Copy from the Allocation into a short array.

open Unit

Copy from the Allocation into a int array.

open Unit

Copy from the Allocation into a float array.

open static Array<Allocation!>!
createAllocations(rs: RenderScript!, t: Type!, usage: Int, numAlloc: Int)

Creates a new Allocation Array with the given , and usage flags.

open static Allocation!

Creates a cubemap Allocation from a android.graphics.Bitmap containing the horizontal list of cube faces.

open static Allocation!

Creates a non-mipmapped cubemap Allocation for use as a graphics texture from a android.graphics.Bitmap containing the horizontal list of cube faces.

open static Allocation!
createCubemapFromCubeFaces(rs: RenderScript!, xpos: Bitmap!, xneg: Bitmap!, ypos: Bitmap!, yneg: Bitmap!, zpos: Bitmap!, zneg: Bitmap!, mips: Allocation.MipmapControl!, usage: Int)

Creates a cubemap Allocation from 6 android.graphics.Bitmap objects containing the cube faces.

open static Allocation!
createCubemapFromCubeFaces(rs: RenderScript!, xpos: Bitmap!, xneg: Bitmap!, ypos: Bitmap!, yneg: Bitmap!, zpos: Bitmap!, zneg: Bitmap!)

Creates a non-mipmapped cubemap Allocation for use as a sampler input from 6 android.graphics.Bitmap objects containing the cube faces.

open static Allocation!

Creates an Allocation from a android.graphics.Bitmap.

open static Allocation!

Creates an Allocation from a android.graphics.Bitmap.

open static Allocation!

Creates an Allocation from the Bitmap referenced by resource ID.

open static Allocation!

Creates a non-mipmapped Allocation to use as a graphics texture from the android.graphics.Bitmap referenced by resource ID.

open static Allocation!
createFromString(rs: RenderScript!, str: String!, usage: Int)

Creates an Allocation containing string data encoded in UTF-8 format.

open static Allocation!
createSized(rs: RenderScript!, e: Element!, count: Int, usage: Int)

Creates an Allocation with a specified number of given elements

open static Allocation!
createSized(rs: RenderScript!, e: Element!, count: Int)

Creates an Allocation with a specified number of given elements

open static Allocation!
createTyped(rs: RenderScript!, type: Type!, mips: Allocation.MipmapControl!, usage: Int)

Creates a new Allocation with the given , mipmap flag, and usage flags.

open static Allocation!
createTyped(rs: RenderScript!, type: Type!, usage: Int)

Creates an Allocation with the size specified by the type and no mipmaps generated by default

open static Allocation!
createTyped(rs: RenderScript!, type: Type!)

Creates an Allocation for use by scripts with a given and no mipmaps

open Unit

For USAGE_IO_OUTPUT, destroy() implies setSurface(null).

open Unit

Generate a mipmap chain.

open ByteBuffer!

Gets or creates a ByteBuffer that contains the raw data of the current Allocation.

open Int

Get the size of the Allocation in bytes.

open Element!

Get the android.renderscript.Element of the of the Allocation.

open Long

Gets the stride of the Allocation.

open Surface!

Returns the handle to a raw buffer that is being managed by the screen compositor.

open Long

Get the timestamp for the most recent buffer held by this Allocation.

open Type!

Get the android.renderscript.Type of the Allocation.

open Int

Get the usage flags of the Allocation.

open Unit

Receive the latest input into the Allocation.

open Unit

Send a buffer to the output stream.

open Unit
resize(dimX: Int)

Resize a 1D allocation.

open Unit
setAutoPadding(useAutoPadding: Boolean)

Specifies the mapping between the Allocation's cells and an array's elements when data is copied from the Allocation to the array, or vice-versa.

open Unit

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

open Unit
setFromFieldPacker(xoff: Int, component_number: Int, fp: FieldPacker!)

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

open Unit
setFromFieldPacker(xoff: Int, yoff: Int, zoff: Int, component_number: Int, fp: FieldPacker!)

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

open Unit

Set a notification handler for USAGE_IO_INPUT.

open Unit

Associate a android.view.Surface with this Allocation.

open Unit
syncAll(srcLocation: Int)

Propagate changes from one usage of the Allocation to the other usages of the Allocation.

Protected methods
open Unit

Inherited functions

Constants

USAGE_GRAPHICS_CONSTANTS

Added in API level 11
static val USAGE_GRAPHICS_CONSTANTS: Int

Deprecated: Deprecated in Java.

The Allocation will be used as the source of shader constants by one or more programs. This was deprecated in API level 16.

Value: 8

USAGE_GRAPHICS_RENDER_TARGET

Added in API level 14
Deprecated in API level 31
static val USAGE_GRAPHICS_RENDER_TARGET: Int

Deprecated: Deprecated in Java.

The Allocation will be used as a target for offscreen rendering This was deprecated in API level 16.

Value: 16

USAGE_GRAPHICS_TEXTURE

Added in API level 11
static val USAGE_GRAPHICS_TEXTURE: Int

Deprecated: Deprecated in Java.

The Allocation will be used as a texture source by one or more graphics programs.

Value: 2

USAGE_GRAPHICS_VERTEX

Added in API level 11
static val USAGE_GRAPHICS_VERTEX: Int

Deprecated: Deprecated in Java.

The Allocation will be used as a graphics mesh. This was deprecated in API level 16.

Value: 4

USAGE_IO_INPUT

Added in API level 16
Deprecated in API level 31
static val USAGE_IO_INPUT: Int

Deprecated: Deprecated in Java.

The Allocation will be used as a android.view.Surface consumer. This usage will cause the Allocation to be created as read-only.

Value: 32

USAGE_IO_OUTPUT

Added in API level 16
Deprecated in API level 31
static val USAGE_IO_OUTPUT: Int

Deprecated: Deprecated in Java.

The Allocation will be used as a android.view.Surface producer. The dimensions and format of the will be forced to those of the Allocation.

Value: 64

USAGE_SCRIPT

Added in API level 11
static val USAGE_SCRIPT: Int

Deprecated: Deprecated in Java.

The Allocation will be bound to and accessed by scripts.

Value: 1

USAGE_SHARED

Added in API level 18
Deprecated in API level 31
static val USAGE_SHARED: Int

Deprecated: Deprecated in Java.

The Allocation's backing store will be inherited from another object (usually a android.graphics.Bitmap); copying to or from the original source Bitmap will cause a synchronization rather than a full copy. syncAll may also be used to synchronize the Allocation and the source Bitmap.

This is set by default for allocations created with #createFromBitmap in API version 18 and higher.

Value: 128

Public methods

copy1DRangeFrom

Added in API level 21
Deprecated in API level 31
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This variant is type checked and will generate exceptions if the Allocation's does not match the component type of the array passed in.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
array Any!: The source array.

copy1DRangeFrom

Added in API level 11
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    d: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This variant is type checked and will generate exceptions if the Allocation's is not an 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d IntArray!: the source array

copy1DRangeFrom

Added in API level 11
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    d: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This variant is type checked and will generate exceptions if the Allocation's is not an 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ShortArray!: the source array

copy1DRangeFrom

Added in API level 11
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    d: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This variant is type checked and will generate exceptions if the Allocation's is not an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ByteArray!: the source array

copy1DRangeFrom

Added in API level 11
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    d: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d FloatArray!: the source array.

copy1DRangeFrom

Added in API level 14
Deprecated in API level 31
open fun copy1DRangeFrom(
    off: Int,
    count: Int,
    data: Allocation!,
    dataOff: Int
): Unit

Deprecated: Deprecated in Java.

Copy part of an Allocation into this Allocation.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
data Allocation!: the source data allocation.
dataOff Int: off The offset of the first element in data to be copied.

copy1DRangeFromUnchecked

Added in API level 21
Deprecated in API level 31
open fun copy1DRangeFromUnchecked(
    off: Int,
    count: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
array Any!: The source array

copy1DRangeFromUnchecked

Added in API level 11
open fun copy1DRangeFromUnchecked(
    off: Int,
    count: Int,
    d: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d IntArray!: the source array

copy1DRangeFromUnchecked

Added in API level 11
open fun copy1DRangeFromUnchecked(
    off: Int,
    count: Int,
    d: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ShortArray!: the source array

copy1DRangeFromUnchecked

Added in API level 11
open fun copy1DRangeFromUnchecked(
    off: Int,
    count: Int,
    d: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ByteArray!: the source array

copy1DRangeFromUnchecked

Added in API level 11
open fun copy1DRangeFromUnchecked(
    off: Int,
    count: Int,
    d: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy an array into a 1D region of this Allocation. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d FloatArray!: the source array

copy1DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeTo(
    off: Int,
    count: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method is type checked and will generate exceptions if the Allocation's does not match the component type of the array passed in.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
array Any!: The source array.

copy1DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeTo(
    off: Int,
    count: Int,
    d: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d IntArray!: the source array

copy1DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeTo(
    off: Int,
    count: Int,
    d: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's is neither a 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ShortArray!: the source array

copy1DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeTo(
    off: Int,
    count: Int,
    d: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's is neither an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ByteArray!: the source array

copy1DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeTo(
    off: Int,
    count: Int,
    d: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d FloatArray!: the source array.

copy1DRangeToUnchecked

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeToUnchecked(
    off: Int,
    count: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
array Any!: The dest array

copy1DRangeToUnchecked

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeToUnchecked(
    off: Int,
    count: Int,
    d: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d IntArray!: the source array

copy1DRangeToUnchecked

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeToUnchecked(
    off: Int,
    count: Int,
    d: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ShortArray!: the source array

copy1DRangeToUnchecked

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeToUnchecked(
    off: Int,
    count: Int,
    d: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d ByteArray!: the source array

copy1DRangeToUnchecked

Added in API level 23
Deprecated in API level 31
open fun copy1DRangeToUnchecked(
    off: Int,
    count: Int,
    d: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy a 1D region of this Allocation into an array. This method does not guarantee that the Allocation is compatible with the input buffer.

The size of the region is: count * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
off Int: The offset of the first element to be copied.
count Int: The number of elements to be copied.
d FloatArray!: the source array

copy2DRangeFrom

Added in API level 21
Deprecated in API level 31
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's does not match the input data type.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
array Any!: Data to be placed into the Allocation

copy2DRangeFrom

Added in API level 11
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's is not an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
data ByteArray!: to be placed into the Allocation

copy2DRangeFrom

Added in API level 11
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's is not a 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
data ShortArray!: to be placed into the Allocation

copy2DRangeFrom

Added in API level 11
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's is not a 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
data IntArray!: to be placed into the Allocation

copy2DRangeFrom

Added in API level 11
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
data FloatArray!: to be placed into the Allocation

copy2DRangeFrom

Added in API level 14
Deprecated in API level 31
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: Allocation!,
    dataXoff: Int,
    dataYoff: Int
): Unit

Deprecated: Deprecated in Java.

Copy a rectangular region from an Allocation into a rectangular region in this Allocation.

Parameters
xoff Int: X offset of the region in this Allocation
yoff Int: Y offset of the region in this Allocation
w Int: Width of the region to update.
h Int: Height of the region to update.
data Allocation!: source Allocation.
dataXoff Int: X offset in source Allocation
dataYoff Int: Y offset in source Allocation

copy2DRangeFrom

Added in API level 11
open fun copy2DRangeFrom(
    xoff: Int,
    yoff: Int,
    data: Bitmap!
): Unit

Deprecated: Deprecated in Java.

Copy a android.graphics.Bitmap into an Allocation. The height and width of the update will use the height and width of the .

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
data Bitmap!: the Bitmap to be copied

copy2DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy2DRangeTo(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy from a rectangular region in this Allocation into an array. This method is type checked and will generate exceptions if the Allocation's android.renderscript.Element does not match the component type of the array passed in.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to copy in this Allocation
yoff Int: Y offset of the region to copy in this Allocation
w Int: Width of the region to copy
h Int: Height of the region to copy
array Any!: Dest Array to be copied into

copy2DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy2DRangeTo(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: ByteArray!
): Unit

Deprecated: Deprecated in Java.

Copy from a rectangular region in this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's android.renderscript.Element is neither an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to copy in this Allocation
yoff Int: Y offset of the region to copy in this Allocation
w Int: Width of the region to copy
h Int: Height of the region to copy
data ByteArray!: Dest Array to be copied into

copy2DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy2DRangeTo(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: ShortArray!
): Unit

Deprecated: Deprecated in Java.

Copy from a rectangular region in this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's android.renderscript.Element is neither a 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to copy in this Allocation
yoff Int: Y offset of the region to copy in this Allocation
w Int: Width of the region to copy
h Int: Height of the region to copy
data ShortArray!: Dest Array to be copied into

copy2DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy2DRangeTo(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: IntArray!
): Unit

Deprecated: Deprecated in Java.

Copy from a rectangular region in this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's android.renderscript.Element is neither a 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to copy in this Allocation
yoff Int: Y offset of the region to copy in this Allocation
w Int: Width of the region to copy
h Int: Height of the region to copy
data IntArray!: Dest Array to be copied into

copy2DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy2DRangeTo(
    xoff: Int,
    yoff: Int,
    w: Int,
    h: Int,
    data: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Copy from a rectangular region in this Allocation into an array. This variant is type checked and will generate exceptions if the Allocation's android.renderscript.Element is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

The size of the region is: w * h * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to copy in this Allocation
yoff Int: Y offset of the region to copy in this Allocation
w Int: Width of the region to copy
h Int: Height of the region to copy
data FloatArray!: Dest Array to be copied into

copy3DRangeFrom

Added in API level 23
Deprecated in API level 31
open fun copy3DRangeFrom(
    xoff: Int,
    yoff: Int,
    zoff: Int,
    w: Int,
    h: Int,
    d: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

Copy from an array into a 3D region in this Allocation. The array is assumed to be tightly packed. This variant is type checked and will generate exceptions if the Allocation's does not match the input data type.

The size of the region is: w * h * d * getElement.android.renderscript.Element#getBytesSize.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the region.

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the region. The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the region. The padding bytes for the cells must not be part of the array.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
zoff Int: Z offset of the region to update in this Allocation
w Int: Width of the region to update
h Int: Height of the region to update
d Int: Depth of the region to update
array Any!: to be placed into the allocation

copy3DRangeFrom

Added in API level 23
Deprecated in API level 31
open fun copy3DRangeFrom(
    xoff: Int,
    yoff: Int,
    zoff: Int,
    w: Int,
    h: Int,
    d: Int,
    data: Allocation!,
    dataXoff: Int,
    dataYoff: Int,
    dataZoff: Int
): Unit

Deprecated: Deprecated in Java.

Copy a rectangular region into the allocation from another allocation.

Parameters
xoff Int: X offset of the region to update in this Allocation
yoff Int: Y offset of the region to update in this Allocation
zoff Int: Z offset of the region to update in this Allocation
w Int: Width of the region to update.
h Int: Height of the region to update.
d Int: Depth of the region to update.
data Allocation!: source allocation.
dataXoff Int: X offset of the region in the source Allocation
dataYoff Int: Y offset of the region in the source Allocation
dataZoff Int: Z offset of the region in the source Allocation

copy3DRangeTo

Added in API level 23
Deprecated in API level 31
open fun copy3DRangeTo(
    xoff: Int,
    yoff: Int,
    zoff: Int,
    w: Int,
    h: Int,
    d: Int,
    array: Any!
): Unit

Deprecated: Deprecated in Java.

copyFrom

Added in API level 11
open fun copyFrom(d: Array<BaseObj!>!): Unit

Deprecated: Deprecated in Java.

Copy an array of RS objects to the Allocation.

Parameters
d Array<BaseObj!>!: Source array.

copyFrom

Added in API level 21
Deprecated in API level 31
open fun copyFrom(array: Any!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's does not match the array's primitive type.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
array Any!: The source array

copyFrom

Added in API level 11
open fun copyFrom(d: IntArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's is not a 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d IntArray!: the source array

copyFrom

Added in API level 11
open fun copyFrom(d: ShortArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's is not a 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ShortArray!: the source array

copyFrom

Added in API level 11
open fun copyFrom(d: ByteArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's is not an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ByteArray!: the source array

copyFrom

Added in API level 11
open fun copyFrom(d: FloatArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d FloatArray!: the source array

copyFrom

Added in API level 11
open fun copyFrom(b: Bitmap!): Unit

Deprecated: Deprecated in Java.

Copy into an Allocation from a android.graphics.Bitmap. The height, width, and format of the bitmap must match the existing allocation.

If the android.graphics.Bitmap is the same as the used to create the Allocation with #createFromBitmap and USAGE_SHARED is set on the Allocation, this will synchronize the Allocation with the latest data from the , potentially avoiding the actual copy.

Parameters
b Bitmap!: the source bitmap

copyFrom

Added in API level 18
Deprecated in API level 31
open fun copyFrom(a: Allocation!): Unit

Deprecated: Deprecated in Java.

Copy an Allocation from an Allocation. The types of both allocations must be identical.

Parameters
a Allocation!: the source allocation

copyFromUnchecked

Added in API level 21
Deprecated in API level 31
open fun copyFromUnchecked(array: Any!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This method does not guarantee that the Allocation is compatible with the input buffer; it copies memory without reinterpretation.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
array Any!: The source array

copyFromUnchecked

Added in API level 11
open fun copyFromUnchecked(d: IntArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This method does not guarantee that the Allocation is compatible with the input buffer; it copies memory without reinterpretation.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d IntArray!: the source array

copyFromUnchecked

Added in API level 11
open fun copyFromUnchecked(d: ShortArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This method does not guarantee that the Allocation is compatible with the input buffer; it copies memory without reinterpretation.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ShortArray!: the source array

copyFromUnchecked

Added in API level 11
open fun copyFromUnchecked(d: ByteArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This method does not guarantee that the Allocation is compatible with the input buffer; it copies memory without reinterpretation.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ByteArray!: the source array

copyFromUnchecked

Added in API level 11
open fun copyFromUnchecked(d: FloatArray!): Unit

Deprecated: Deprecated in Java.

Copy into this Allocation from an array. This method does not guarantee that the Allocation is compatible with the input buffer; it copies memory without reinterpretation.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells must be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d FloatArray!: the source array

copyTo

Added in API level 11
open fun copyTo(b: Bitmap!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into a android.graphics.Bitmap. The bitmap must match the dimensions of the Allocation.

Parameters
b Bitmap!: The bitmap to be set from the Allocation.

copyTo

Added in API level 21
Deprecated in API level 31
open fun copyTo(array: Any!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into an array. The method is type checked and will generate exceptions if the Allocation's does not match the input data type.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells will be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
array Any!: The array to be set from the Allocation.

copyTo

Added in API level 11
open fun copyTo(d: ByteArray!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into a byte array. This variant is type checked and will generate exceptions if the Allocation's is neither an 8 bit integer nor a vector of 8 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells will be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ByteArray!: The array to be set from the Allocation.

copyTo

Added in API level 11
open fun copyTo(d: ShortArray!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into a short array. This variant is type checked and will generate exceptions if the Allocation's is not a 16 bit integer nor a vector of 16 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells will be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d ShortArray!: The array to be set from the Allocation.

copyTo

Added in API level 11
open fun copyTo(d: IntArray!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into a int array. This variant is type checked and will generate exceptions if the Allocation's is not a 32 bit integer nor a vector of 32 bit integers android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells will be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d IntArray!: The array to be set from the Allocation.

copyTo

Added in API level 11
open fun copyTo(d: FloatArray!): Unit

Deprecated: Deprecated in Java.

Copy from the Allocation into a float array. This variant is type checked and will generate exceptions if the Allocation's is neither a 32 bit float nor a vector of 32 bit floats android.renderscript.Element.DataType.

If the Allocation does not have Vec3 Elements, then the size of the array in bytes must be at least the size of the Allocation getBytesSize().

If the Allocation has Vec3 Elements and AutoPadding is disabled, then the size of the array in bytes must be at least the size of the Allocation getBytesSize(). The padding bytes for the cells will be part of the array.

If the Allocation has Vec3 Elements and AutoPadding is enabled, then the size of the array in bytes must be at least 3/4 the size of the Allocation getBytesSize(). The padding bytes for the cells must not be part of the array.

Parameters
d FloatArray!: The array to be set from the Allocation.

createAllocations

Added in API level 24
Deprecated in API level 31
open static fun createAllocations(
    rs: RenderScript!,
    t: Type!,
    usage: Int,
    numAlloc: Int
): Array<Allocation!>!

Deprecated: Deprecated in Java.

Creates a new Allocation Array with the given , and usage flags. Note: If the input allocation is of usage: USAGE_IO_INPUT, the created Allocation will be sharing the same BufferQueue.

Parameters
rs RenderScript!: RenderScript context
t Type!: RenderScript type describing data layout
usage Int: bit field specifying how the Allocation is utilized
numAlloc Int: Number of Allocations in the array.
Return
Array<Allocation!>! Allocation[]

createCubemapFromBitmap

Added in API level 11
open static fun createCubemapFromBitmap(
    rs: RenderScript!,
    b: Bitmap!,
    mips: Allocation.MipmapControl!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates a cubemap Allocation from a android.graphics.Bitmap containing the horizontal list of cube faces. Each face must be a square, have the same size as all other faces, and have a width that is a power of 2.

Parameters
rs RenderScript!: Context to which the allocation will belong.
b Bitmap!: Bitmap with cubemap faces layed out in the following format: right, left, top, bottom, front, back
mips Allocation.MipmapControl!: specifies desired mipmap behaviour for the cubemap
usage Int: bit field specifying how the cubemap is utilized
Return
Allocation! allocation containing cubemap data

createCubemapFromBitmap

Added in API level 11
open static fun createCubemapFromBitmap(
    rs: RenderScript!,
    b: Bitmap!
): Allocation!

Deprecated: Deprecated in Java.

Creates a non-mipmapped cubemap Allocation for use as a graphics texture from a android.graphics.Bitmap containing the horizontal list of cube faces. Each face must be a square, have the same size as all other faces, and have a width that is a power of 2.

Parameters
rs RenderScript!: Context to which the allocation will belong.
b Bitmap!: bitmap with cubemap faces layed out in the following format: right, left, top, bottom, front, back
Return
Allocation! allocation containing cubemap data

createCubemapFromCubeFaces

Added in API level 11
open static fun createCubemapFromCubeFaces(
    rs: RenderScript!,
    xpos: Bitmap!,
    xneg: Bitmap!,
    ypos: Bitmap!,
    yneg: Bitmap!,
    zpos: Bitmap!,
    zneg: Bitmap!,
    mips: Allocation.MipmapControl!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates a cubemap Allocation from 6 android.graphics.Bitmap objects containing the cube faces. Each face must be a square, have the same size as all other faces, and have a width that is a power of 2.

Parameters
rs RenderScript!: Context to which the allocation will belong.
xpos Bitmap!: cubemap face in the positive x direction
xneg Bitmap!: cubemap face in the negative x direction
ypos Bitmap!: cubemap face in the positive y direction
yneg Bitmap!: cubemap face in the negative y direction
zpos Bitmap!: cubemap face in the positive z direction
zneg Bitmap!: cubemap face in the negative z direction
mips Allocation.MipmapControl!: specifies desired mipmap behaviour for the cubemap
usage Int: bit field specifying how the cubemap is utilized
Return
Allocation! allocation containing cubemap data

createCubemapFromCubeFaces

Added in API level 11
open static fun createCubemapFromCubeFaces(
    rs: RenderScript!,
    xpos: Bitmap!,
    xneg: Bitmap!,
    ypos: Bitmap!,
    yneg: Bitmap!,
    zpos: Bitmap!,
    zneg: Bitmap!
): Allocation!

Deprecated: Deprecated in Java.

Creates a non-mipmapped cubemap Allocation for use as a sampler input from 6 android.graphics.Bitmap objects containing the cube faces. Each face must be a square, have the same size as all other faces, and have a width that is a power of 2.

Parameters
rs RenderScript!: Context to which the allocation will belong.
xpos Bitmap!: cubemap face in the positive x direction
xneg Bitmap!: cubemap face in the negative x direction
ypos Bitmap!: cubemap face in the positive y direction
yneg Bitmap!: cubemap face in the negative y direction
zpos Bitmap!: cubemap face in the positive z direction
zneg Bitmap!: cubemap face in the negative z direction
Return
Allocation! allocation containing cubemap data

createFromBitmap

Added in API level 11
open static fun createFromBitmap(
    rs: RenderScript!,
    b: Bitmap!,
    mips: Allocation.MipmapControl!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation from a android.graphics.Bitmap.

Parameters
rs RenderScript!: Context to which the allocation will belong.
b Bitmap!: Bitmap source for the allocation data
mips Allocation.MipmapControl!: specifies desired mipmap behaviour for the allocation
usage Int: bit field specifying how the allocation is utilized
Return
Allocation! Allocation containing bitmap data

createFromBitmap

Added in API level 11
open static fun createFromBitmap(
    rs: RenderScript!,
    b: Bitmap!
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation from a android.graphics.Bitmap.

With target API version 18 or greater, this Allocation will be created with USAGE_SHARED, USAGE_SCRIPT, and USAGE_GRAPHICS_TEXTURE. With target API version 17 or lower, this Allocation will be created with USAGE_GRAPHICS_TEXTURE.

Parameters
rs RenderScript!: Context to which the allocation will belong.
b Bitmap!: bitmap source for the allocation data
Return
Allocation! Allocation containing bitmap data

createFromBitmapResource

Added in API level 11
open static fun createFromBitmapResource(
    rs: RenderScript!,
    res: Resources!,
    id: Int,
    mips: Allocation.MipmapControl!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation from the Bitmap referenced by resource ID.

Parameters
rs RenderScript!: Context to which the allocation will belong.
res Resources!: application resources
id Int: resource id to load the data from
mips Allocation.MipmapControl!: specifies desired mipmap behaviour for the allocation
usage Int: bit field specifying how the allocation is utilized
Return
Allocation! Allocation containing resource data

createFromBitmapResource

Added in API level 11
open static fun createFromBitmapResource(
    rs: RenderScript!,
    res: Resources!,
    id: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates a non-mipmapped Allocation to use as a graphics texture from the android.graphics.Bitmap referenced by resource ID.

With target API version 18 or greater, this allocation will be created with USAGE_SCRIPT and USAGE_GRAPHICS_TEXTURE. With target API version 17 or lower, this allocation will be created with USAGE_GRAPHICS_TEXTURE.

Parameters
rs RenderScript!: Context to which the allocation will belong.
res Resources!: application resources
id Int: resource id to load the data from
Return
Allocation! Allocation containing resource data

createFromString

Added in API level 11
open static fun createFromString(
    rs: RenderScript!,
    str: String!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation containing string data encoded in UTF-8 format.

Parameters
rs RenderScript!: Context to which the allocation will belong.
str String!: string to create the allocation from
usage Int: bit field specifying how the allocaiton is utilized

createSized

Added in API level 11
open static fun createSized(
    rs: RenderScript!,
    e: Element!,
    count: Int,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation with a specified number of given elements

Parameters
rs RenderScript!: Context to which the Allocation will belong.
e Element!: Element to use in the Allocation
count Int: the number of Elements in the Allocation
usage Int: bit field specifying how the Allocation is utilized
Return
Allocation! allocation

createSized

Added in API level 11
open static fun createSized(
    rs: RenderScript!,
    e: Element!,
    count: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation with a specified number of given elements

Parameters
rs RenderScript!: Context to which the Allocation will belong.
e Element!: Element to use in the Allocation
count Int: the number of Elements in the Allocation
Return
Allocation! allocation

createTyped

Added in API level 11
open static fun createTyped(
    rs: RenderScript!,
    type: Type!,
    mips: Allocation.MipmapControl!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates a new Allocation with the given , mipmap flag, and usage flags.

Parameters
type Type!: RenderScript type describing data layout
mips Allocation.MipmapControl!: specifies desired mipmap behaviour for the allocation
usage Int: bit field specifying how the Allocation is utilized

createTyped

Added in API level 11
open static fun createTyped(
    rs: RenderScript!,
    type: Type!,
    usage: Int
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation with the size specified by the type and no mipmaps generated by default

Parameters
rs RenderScript!: Context to which the allocation will belong.
type Type!: renderscript type describing data layout
usage Int: bit field specifying how the allocation is utilized
Return
Allocation! allocation

createTyped

Added in API level 11
open static fun createTyped(
    rs: RenderScript!,
    type: Type!
): Allocation!

Deprecated: Deprecated in Java.

Creates an Allocation for use by scripts with a given and no mipmaps

Parameters
rs RenderScript!: Context to which the Allocation will belong.
type Type!: RenderScript Type describing data layout
Return
Allocation! allocation

destroy

Added in API level 11
open fun destroy(): Unit

Deprecated: Deprecated in Java.

For USAGE_IO_OUTPUT, destroy() implies setSurface(null).

generateMipmaps

Added in API level 11
open fun generateMipmaps(): Unit

Deprecated: Deprecated in Java.

Generate a mipmap chain. This is only valid if the Type of the Allocation includes mipmaps.

This function will generate a complete set of mipmaps from the top level LOD and place them into the script memory space.

If the Allocation is also using other memory spaces, a call to syncAll(Allocation.USAGE_SCRIPT) is required.

getByteBuffer

Added in API level 24
Deprecated in API level 31
open fun getByteBuffer(): ByteBuffer!

Deprecated: Deprecated in Java.

Gets or creates a ByteBuffer that contains the raw data of the current Allocation.

If the Allocation is created with USAGE_IO_INPUT, the returned ByteBuffer would contain the up-to-date data as READ ONLY. For a 2D or 3D Allocation, the raw data maybe padded so that each row of the Allocation has certain alignment. The size of each row including padding, called stride, can be queried using the getStride() method. Note: Operating on the ByteBuffer of a destroyed Allocation will triger errors.

Return
ByteBuffer! ByteBuffer The ByteBuffer associated with raw data pointer of the Allocation.

getBytesSize

Added in API level 16
Deprecated in API level 31
open fun getBytesSize(): Int

Deprecated: Deprecated in Java.

Get the size of the Allocation in bytes.

Return
Int size of the Allocation in bytes.

getElement

Added in API level 16
Deprecated in API level 31
open fun getElement(): Element!

Deprecated: Deprecated in Java.

Get the android.renderscript.Element of the of the Allocation.

Return
Element! Element

getStride

Added in API level 24
Deprecated in API level 31
open fun getStride(): Long

Deprecated: Deprecated in Java.

Gets the stride of the Allocation. For a 2D or 3D Allocation, the raw data maybe padded so that each row of the Allocation has certain alignment. The size of each row including such padding is called stride.

Return
Long the stride. For 1D Allocation, the stride will be the number of bytes of this Allocation. For 2D and 3D Allocations, the stride will be the stride in X dimension measuring in bytes.

getSurface

Added in API level 16
Deprecated in API level 31
open fun getSurface(): Surface!

Deprecated: Deprecated in Java.

Returns the handle to a raw buffer that is being managed by the screen compositor. This operation is only valid for Allocations with USAGE_IO_INPUT.

Return
Surface! Surface object associated with allocation

getTimeStamp

Added in API level 24
Deprecated in API level 31
open fun getTimeStamp(): Long

Deprecated: Deprecated in Java.

Get the timestamp for the most recent buffer held by this Allocation. The timestamp is guaranteed to be unique and monotonically increasing. Default value: -1. The timestamp will be updated after each ioReceive() call. It can be used to identify the images by comparing the unique timestamps when used with android.hardware.camera2 APIs. Example steps: 1. Save android.hardware.camera2.TotalCaptureResult when the capture is completed. 2. Get the timestamp after ioReceive() call. 3. Comparing totalCaptureResult.get(CaptureResult.SENSOR_TIMESTAMP) with alloc.getTimeStamp().

Return
Long long Timestamp associated with the buffer held by the Allocation.

getType

Added in API level 11
open fun getType(): Type!

Deprecated: Deprecated in Java.

Get the android.renderscript.Type of the Allocation.

Return
Type! Type

getUsage

Added in API level 16
Deprecated in API level 31
open fun getUsage(): Int

Deprecated: Deprecated in Java.

Get the usage flags of the Allocation.

Return
Int usage this Allocation's set of the USAGE_* flags OR'd together

ioReceive

Added in API level 16
Deprecated in API level 31
open fun ioReceive(): Unit

Deprecated: Deprecated in Java.

Receive the latest input into the Allocation. This operation is only valid if USAGE_IO_INPUT is set on the Allocation.

ioSend

Added in API level 16
Deprecated in API level 31
open fun ioSend(): Unit

Deprecated: Deprecated in Java.

Send a buffer to the output stream. The contents of the Allocation will be undefined after this operation. This operation is only valid if USAGE_IO_OUTPUT is set on the Allocation.

resize

Added in API level 11
Deprecated in API level 18
open fun resize(dimX: Int): Unit

Deprecated: RenderScript objects should be immutable once created. The replacement is to create a new allocation and copy the contents. This function will throw an exception if API 21 or higher is used.

Resize a 1D allocation. The contents of the allocation are preserved. If new elements are allocated objects are created with null contents and the new region is otherwise undefined.

If the new region is smaller the references of any objects outside the new region will be released.

A new type will be created with the new dimension.

Parameters
dimX Int: The new size of the allocation.

setAutoPadding

Added in API level 23
Deprecated in API level 31
open fun setAutoPadding(useAutoPadding: Boolean): Unit

Deprecated: Deprecated in Java.

Specifies the mapping between the Allocation's cells and an array's elements when data is copied from the Allocation to the array, or vice-versa. Only applies to an Allocation whose Element is a vector of length 3 (such as Element#U8_3 or Element#RGB_888). Enabling this feature may make copying data from the Allocation to an array or vice-versa less efficient.

Vec3 Element cells are stored in an Allocation as Vec4 Element cells with the same android.renderscript.Element.DataType, with the fourth vector component treated as padding. When this feature is enabled, only the data components, i.e. the first 3 vector components of each cell, will be mapped between the array and the Allocation. When disabled, explicit mapping of the padding components is required, as described in the following example.

For example, when copying an integer array to an Allocation of two android.renderscript.Element#I32_3 cells using copyFrom(int[]):

When disabled: The array must have at least 8 integers, with the first 4 integers copied to the first cell of the Allocation, and the next 4 integers copied to the second cell. The 4th and 8th integers are mapped as the padding components.

When enabled: The array just needs to have at least 6 integers, with the first 3 integers copied to the the first cell as data components, and the next 3 copied to the second cell. There is no mapping for the padding components.

Similarly, when copying a byte array to an Allocation of two android.renderscript.Element#I32_3 cells, using copyFromUnchecked(int[]):

When disabled: The array must have at least 32 bytes, with the first 16 bytes copied to the first cell of the Allocation, and the next 16 bytes copied to the second cell. The 13th-16th and 29th-32nd bytes are mapped as padding components.

When enabled: The array just needs to have at least 24 bytes, with the first 12 bytes copied to the first cell of the Allocation, and the next 12 bytes copied to the second cell. There is no mapping for the padding components.

Similar to copying data to an Allocation from an array, when copying data from an Allocation to an array, the padding components for Vec3 Element cells will not be copied/mapped to the array if AutoPadding is enabled.

Default: Disabled.

Parameters
useAutoPadding Boolean: True: enable AutoPadding; False: disable AutoPadding

setFromFieldPacker

Added in API level 11
open fun setFromFieldPacker(
    xoff: Int,
    fp: FieldPacker!
): Unit

Deprecated: Deprecated in Java.

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

Parameters
xoff Int:
fp FieldPacker!:

setFromFieldPacker

Added in API level 11
open fun setFromFieldPacker(
    xoff: Int,
    component_number: Int,
    fp: FieldPacker!
): Unit

Deprecated: Deprecated in Java.

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

Parameters
xoff Int:
component_number Int:
fp FieldPacker!:

setFromFieldPacker

Added in API level 23
Deprecated in API level 31
open fun setFromFieldPacker(
    xoff: Int,
    yoff: Int,
    zoff: Int,
    component_number: Int,
    fp: FieldPacker!
): Unit

Deprecated: Deprecated in Java.

This is only intended to be used by auto-generated code reflected from the RenderScript script files and should not be used by developers.

Parameters
xoff Int:
yoff Int:
zoff Int:
component_number Int:
fp FieldPacker!:

setOnBufferAvailableListener

Added in API level 19
Deprecated in API level 31
open fun setOnBufferAvailableListener(callback: Allocation.OnBufferAvailableListener!): Unit

Deprecated: Deprecated in Java.

Set a notification handler for USAGE_IO_INPUT.

Parameters
callback Allocation.OnBufferAvailableListener!: instance of the OnBufferAvailableListener class to be called when buffer arrive.

setSurface

Added in API level 16
Deprecated in API level 31
open fun setSurface(sur: Surface!): Unit

Deprecated: Deprecated in Java.

Associate a android.view.Surface with this Allocation. This operation is only valid for Allocations with USAGE_IO_OUTPUT.

Parameters
sur Surface!: Surface to associate with allocation

syncAll

Added in API level 11
open fun syncAll(srcLocation: Int): Unit

Deprecated: Deprecated in Java.

Propagate changes from one usage of the Allocation to the other usages of the Allocation.

Protected methods

finalize

Added in API level 11
protected open fun finalize(): Unit

Deprecated: Deprecated in Java.

Exceptions
java.lang.Throwable the Exception raised by this method