Most visited

Recently visited

Allocation

public class Allocation
extends BaseObj

java.lang.Object
   ↳ android.support.v8.renderscript.BaseObj
     ↳ android.support.v8.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 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 Sampler. A developer must synchronize across these different usages using syncAll(int) 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(Bitmap) routines. For more complex Element types, the copyFromUnchecked(byte[]) methods can be used to copy from byte arrays or similar constructs.

Developer Guides

For more information about creating an application that uses RenderScript, read the RenderScript developer guide.

Summary

Nested classes

enum Allocation.MipmapControl

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

Constants

int USAGE_GRAPHICS_TEXTURE

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

int USAGE_IO_INPUT

The Allocation will be used as a SurfaceTexture consumer.

int USAGE_IO_OUTPUT

The Allocation will be used as a SurfaceTexture producer.

int USAGE_SCRIPT

The Allocation will be bound to and accessed by scripts.

int USAGE_SHARED

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

Public methods

void copy1DRangeFrom(int off, int count, float[] d)

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

void copy1DRangeFrom(int off, int count, short[] d)

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

void copy1DRangeFrom(int off, int count, Object array)

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

void copy1DRangeFrom(int off, int count, int[] d)

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

void copy1DRangeFrom(int off, int count, Allocation data, int dataOff)

Copy part of an Allocation into this Allocation.

void copy1DRangeFrom(int off, int count, byte[] d)

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

void copy1DRangeFromUnchecked(int off, int count, byte[] d)

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

void copy1DRangeFromUnchecked(int off, int count, short[] d)

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

void copy1DRangeFromUnchecked(int off, int count, Object array)

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

void copy1DRangeFromUnchecked(int off, int count, int[] d)

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

void copy1DRangeFromUnchecked(int off, int count, float[] d)

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

void copy1DRangeTo(int off, int count, short[] d)

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

void copy1DRangeTo(int off, int count, Object array)

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

void copy1DRangeTo(int off, int count, int[] d)

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

void copy1DRangeTo(int off, int count, float[] d)

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

void copy1DRangeTo(int off, int count, byte[] d)

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

void copy1DRangeToUnchecked(int off, int count, byte[] d)

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

void copy1DRangeToUnchecked(int off, int count, short[] d)

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

void copy1DRangeToUnchecked(int off, int count, Object array)

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

void copy1DRangeToUnchecked(int off, int count, int[] d)

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

void copy1DRangeToUnchecked(int off, int count, float[] d)

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

void copy2DRangeFrom(int xoff, int yoff, Bitmap data)

Copy a Bitmap into an Allocation.

void copy2DRangeFrom(int xoff, int yoff, int w, int h, byte[] data)

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

void copy2DRangeFrom(int xoff, int yoff, int w, int h, Object array)

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

void copy2DRangeFrom(int xoff, int yoff, int w, int h, int[] data)

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

void copy2DRangeFrom(int xoff, int yoff, int w, int h, float[] data)

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

void copy2DRangeFrom(int xoff, int yoff, int w, int h, short[] data)

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

void copy2DRangeFrom(int xoff, int yoff, int w, int h, Allocation data, int dataXoff, int dataYoff)

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

void copy2DRangeTo(int xoff, int yoff, int w, int h, short[] data)

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

void copy2DRangeTo(int xoff, int yoff, int w, int h, byte[] data)

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

void copy2DRangeTo(int xoff, int yoff, int w, int h, Object array)

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

void copy2DRangeTo(int xoff, int yoff, int w, int h, float[] data)

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

void copy2DRangeTo(int xoff, int yoff, int w, int h, int[] data)

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

void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, Object array)

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

void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, Allocation data, int dataXoff, int dataYoff, int dataZoff)

Copy a rectangular region into the allocation from another allocation.

void copyFrom(Bitmap b)

Copy into an Allocation from a Bitmap.

void copyFrom(BaseObj[] d)

Copy an array of RS objects to the Allocation.

void copyFrom(Allocation a)

Copy an Allocation from an Allocation.

void copyFrom(short[] d)

Copy into this Allocation from an array.

void copyFrom(int[] d)

Copy into this Allocation from an array.

void copyFrom(byte[] d)

Copy into this Allocation from an array.

void copyFrom(float[] d)

Copy into this Allocation from an array.

void copyFrom(Object array)

Copy into this Allocation from an array.

void copyFromUnchecked(float[] d)

Copy into this Allocation from an array.

void copyFromUnchecked(Object array)

Copy into this Allocation from an array.

void copyFromUnchecked(short[] d)

Copy into this Allocation from an array.

void copyFromUnchecked(int[] d)

Copy into this Allocation from an array.

void copyFromUnchecked(byte[] d)

Copy into this Allocation from an array.

void copyTo(Bitmap b)

Copy from the Allocation into a Bitmap.

void copyTo(short[] d)

Copy from the Allocation into a short array.

void copyTo(byte[] d)

Copy from the Allocation into a byte array.

void copyTo(float[] d)

Copy from the Allocation into a float array.

void copyTo(int[] d)

Copy from the Allocation into a int array.

void copyTo(Object array)

Copy from the Allocation into an array.

static Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b, Allocation.MipmapControl mips, int usage)

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

static Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b)

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

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

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

static Allocation createCubemapFromCubeFaces(RenderScript rs, Bitmap xpos, Bitmap xneg, Bitmap ypos, Bitmap yneg, Bitmap zpos, Bitmap zneg, Allocation.MipmapControl mips, int usage)

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

static Allocation createFromBitmap(RenderScript rs, Bitmap b, Allocation.MipmapControl mips, int usage)

Creates an Allocation from a Bitmap.

static Allocation createFromBitmap(RenderScript rs, Bitmap b)

Creates an Allocation from a Bitmap.

static Allocation createFromBitmapResource(RenderScript rs, Resources res, int id)

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

static Allocation createFromBitmapResource(RenderScript rs, Resources res, int id, Allocation.MipmapControl mips, int usage)

Creates an Allocation from the Bitmap referenced by resource ID.

static Allocation createFromString(RenderScript rs, String str, int usage)

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

static Allocation createSized(RenderScript rs, Element e, int count, int usage)

Creates an Allocation with a specified number of given elements

static Allocation createSized(RenderScript rs, Element e, int count)

Creates an Allocation with a specified number of given elements

static Allocation createTyped(RenderScript rs, Type type)

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

static Allocation createTyped(RenderScript rs, Type type, int usage)

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

static Allocation createTyped(RenderScript rs, Type type, Allocation.MipmapControl mips, int usage)

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

void destroy()

Frees any native resources associated with this object.

void generateMipmaps()

Generate a mipmap chain.

ByteBuffer getByteBuffer()

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

int getBytesSize()

Get the size of the Allocation in bytes.

Element getElement()

Get the Element of the Type of the Allocation.

long getIncAllocID()

Getter & Setter for the dummy allocation for Inc Support Lib.

long getStride()

Gets the stride of the Allocation.

Type getType()

Get the Type of the Allocation.

int getUsage()

Get the usage flags of the Allocation.

void ioReceive()

Receive the latest input into the Allocation.

void ioSend()

Send a buffer to the output stream.

void ioSendOutput()

Delete once code is updated.

void setAutoPadding(boolean useAutoPadding)

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.

void setFromFieldPacker(int xoff, int component_number, FieldPacker fp)

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

void setFromFieldPacker(int xoff, FieldPacker fp)

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

void setIncAllocID(long id)
void setSurface(Surface sur)

Associate a Surface with this Allocation.

void syncAll(int srcLocation)

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

Protected methods

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

Inherited methods

From class android.support.v8.renderscript.BaseObj
From class java.lang.Object

Constants

USAGE_GRAPHICS_TEXTURE

int USAGE_GRAPHICS_TEXTURE

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

Constant Value: 2 (0x00000002)

USAGE_IO_INPUT

int USAGE_IO_INPUT

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

Constant Value: 32 (0x00000020)

USAGE_IO_OUTPUT

int USAGE_IO_OUTPUT

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

Constant Value: 64 (0x00000040)

USAGE_SCRIPT

int USAGE_SCRIPT

The Allocation will be bound to and accessed by scripts.

Constant Value: 1 (0x00000001)

USAGE_SHARED

int USAGE_SHARED

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

This is set by default for allocations created with createFromBitmap(RenderScript, Bitmap) in API version 18 and higher.

Constant Value: 128 (0x00000080)

Public methods

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                float[] d)

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

The size of the region is: count * getElement().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 float: the source array.

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                short[] d)

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

The size of the region is: count * getElement().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 short: the source array

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                Object array)

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

The size of the region is: count * getElement().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 Object: The source array.

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                int[] d)

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

The size of the region is: count * getElement().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 int: the source array

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                Allocation data, 
                int dataOff)

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.

copy1DRangeFrom

void copy1DRangeFrom (int off, 
                int count, 
                byte[] d)

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

The size of the region is: count * getElement().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 byte: the source array

copy1DRangeFromUnchecked

void copy1DRangeFromUnchecked (int off, 
                int count, 
                byte[] d)

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().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 byte: the source array

copy1DRangeFromUnchecked

void copy1DRangeFromUnchecked (int off, 
                int count, 
                short[] d)

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().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 short: the source array

copy1DRangeFromUnchecked

void copy1DRangeFromUnchecked (int off, 
                int count, 
                Object array)

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().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 Object: The source array

copy1DRangeFromUnchecked

void copy1DRangeFromUnchecked (int off, 
                int count, 
                int[] d)

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().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 int: the source array

copy1DRangeFromUnchecked

void copy1DRangeFromUnchecked (int off, 
                int count, 
                float[] d)

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().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 float: the source array

copy1DRangeTo

void copy1DRangeTo (int off, 
                int count, 
                short[] d)

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

The size of the region is: count * getElement().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 short: the source array

copy1DRangeTo

void copy1DRangeTo (int off, 
                int count, 
                Object array)

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

The size of the region is: count * getElement().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 Object: The source array.

copy1DRangeTo

void copy1DRangeTo (int off, 
                int count, 
                int[] d)

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

The size of the region is: count * getElement().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 int: the source array

copy1DRangeTo

void copy1DRangeTo (int off, 
                int count, 
                float[] d)

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

The size of the region is: count * getElement().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 float: the source array.

copy1DRangeTo

void copy1DRangeTo (int off, 
                int count, 
                byte[] d)

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

The size of the region is: count * getElement().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 byte: the source array

copy1DRangeToUnchecked

void copy1DRangeToUnchecked (int off, 
                int count, 
                byte[] d)

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().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 byte: the source array

copy1DRangeToUnchecked

void copy1DRangeToUnchecked (int off, 
                int count, 
                short[] d)

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().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 short: the source array

copy1DRangeToUnchecked

void copy1DRangeToUnchecked (int off, 
                int count, 
                Object array)

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().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 Object: The dest array

copy1DRangeToUnchecked

void copy1DRangeToUnchecked (int off, 
                int count, 
                int[] d)

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().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 int: the source array

copy1DRangeToUnchecked

void copy1DRangeToUnchecked (int off, 
                int count, 
                float[] d)

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().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 float: the source array

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                Bitmap data)

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

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

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                byte[] data)

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 Element is not an 8 bit integer nor a vector of 8 bit integers Element.DataType.

The size of the region is: w * h * getElement().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 byte: to be placed into the Allocation

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                Object array)

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 Element does not match the input data type.

The size of the region is: w * h * getElement().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 Object: Data to be placed into the Allocation

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                int[] data)

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 Element is not a 32 bit integer nor a vector of 32 bit integers Element.DataType.

The size of the region is: w * h * getElement().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 int: to be placed into the Allocation

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                float[] data)

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 Element is neither a 32 bit float nor a vector of 32 bit floats Element.DataType.

The size of the region is: w * h * getElement().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 float: to be placed into the Allocation

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                short[] data)

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 Element is not a 16 bit integer nor a vector of 16 bit integers Element.DataType.

The size of the region is: w * h * getElement().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 short: to be placed into the Allocation

copy2DRangeFrom

void copy2DRangeFrom (int xoff, 
                int yoff, 
                int w, 
                int h, 
                Allocation data, 
                int dataXoff, 
                int dataYoff)

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

copy2DRangeTo

void copy2DRangeTo (int xoff, 
                int yoff, 
                int w, 
                int h, 
                short[] data)

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

The size of the region is: w * h * getElement().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 short: Dest Array to be copied into

copy2DRangeTo

void copy2DRangeTo (int xoff, 
                int yoff, 
                int w, 
                int h, 
                byte[] data)

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

The size of the region is: w * h * getElement().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 byte: Dest Array to be copied into

copy2DRangeTo

void copy2DRangeTo (int xoff, 
                int yoff, 
                int w, 
                int h, 
                Object array)

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

The size of the region is: w * h * getElement().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 Object: Dest Array to be copied into

copy2DRangeTo

void copy2DRangeTo (int xoff, 
                int yoff, 
                int w, 
                int h, 
                float[] data)

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

The size of the region is: w * h * getElement().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 float: Dest Array to be copied into

copy2DRangeTo

void copy2DRangeTo (int xoff, 
                int yoff, 
                int w, 
                int h, 
                int[] data)

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

The size of the region is: w * h * getElement().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 int: Dest Array to be copied into

copy3DRangeFrom

void copy3DRangeFrom (int xoff, 
                int yoff, 
                int zoff, 
                int w, 
                int h, 
                int d, 
                Object array)

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 Element does not match the input data type.

The size of the region is: w * h * d * getElement().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 Object: to be placed into the allocation

copy3DRangeFrom

void copy3DRangeFrom (int xoff, 
                int yoff, 
                int zoff, 
                int w, 
                int h, 
                int d, 
                Allocation data, 
                int dataXoff, 
                int dataYoff, 
                int dataZoff)

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

copyFrom

void copyFrom (Bitmap b)

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

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

Parameters
b Bitmap: the source bitmap

copyFrom

void copyFrom (BaseObj[] d)

Copy an array of RS objects to the Allocation.

Parameters
d BaseObj: Source array.

copyFrom

void copyFrom (Allocation a)

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

Parameters
a Allocation: the source allocation

copyFrom

void copyFrom (short[] d)

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's Element is not a 16 bit integer nor a vector of 16 bit integers 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 short: the source array

copyFrom

void copyFrom (int[] d)

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's Element is not a 32 bit integer nor a vector of 32 bit integers 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 int: the source array

copyFrom

void copyFrom (byte[] d)

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's Element is not an 8 bit integer nor a vector of 8 bit integers 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 byte: the source array

copyFrom

void copyFrom (float[] d)

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's Element is neither a 32 bit float nor a vector of 32 bit floats 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 float: the source array

copyFrom

void copyFrom (Object array)

Copy into this Allocation from an array. This variant is type checked and will generate exceptions if the Allocation's Element 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 Object: The source array

copyFromUnchecked

void copyFromUnchecked (float[] d)

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 float: the source array

copyFromUnchecked

void copyFromUnchecked (Object array)

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 Object: The source array

copyFromUnchecked

void copyFromUnchecked (short[] d)

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 short: the source array

copyFromUnchecked

void copyFromUnchecked (int[] d)

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 int: the source array

copyFromUnchecked

void copyFromUnchecked (byte[] d)

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 byte: the source array

copyTo

void copyTo (Bitmap b)

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

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

copyTo

void copyTo (short[] d)

Copy from the Allocation into a short array. This variant is type checked and will generate exceptions if the Allocation's Element is not a 16 bit integer nor a vector of 16 bit integers 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 short: The array to be set from the Allocation.

copyTo

void copyTo (byte[] d)

Copy from the Allocation into a byte array. This variant is type checked and will generate exceptions if the Allocation's Element is neither an 8 bit integer nor a vector of 8 bit integers 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 byte: The array to be set from the Allocation.

copyTo

void copyTo (float[] d)

Copy from the Allocation into a float array. This variant is type checked and will generate exceptions if the Allocation's Element is neither a 32 bit float nor a vector of 32 bit floats 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 float: The array to be set from the Allocation.

copyTo

void copyTo (int[] d)

Copy from the Allocation into a int array. This variant is type checked and will generate exceptions if the Allocation's Element is not a 32 bit integer nor a vector of 32 bit integers 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 int: The array to be set from the Allocation.

copyTo

void copyTo (Object array)

Copy from the Allocation into an array. The method is type checked and will generate exceptions if the Allocation's Element 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 Object: The array to be set from the Allocation.

createCubemapFromBitmap

Allocation createCubemapFromBitmap (RenderScript rs, 
                Bitmap b, 
                Allocation.MipmapControl mips, 
                int usage)

Creates a cubemap Allocation from a 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
Returns
Allocation allocation containing cubemap data

createCubemapFromBitmap

Allocation createCubemapFromBitmap (RenderScript rs, 
                Bitmap b)

Creates a non-mipmapped cubemap Allocation for use as a graphics texture from a 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
Returns
Allocation allocation containing cubemap data

createCubemapFromCubeFaces

Allocation createCubemapFromCubeFaces (RenderScript rs, 
                Bitmap xpos, 
                Bitmap xneg, 
                Bitmap ypos, 
                Bitmap yneg, 
                Bitmap zpos, 
                Bitmap zneg)

Creates a non-mipmapped cubemap Allocation for use as a sampler input from 6 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
Returns
Allocation allocation containing cubemap data

createCubemapFromCubeFaces

Allocation createCubemapFromCubeFaces (RenderScript rs, 
                Bitmap xpos, 
                Bitmap xneg, 
                Bitmap ypos, 
                Bitmap yneg, 
                Bitmap zpos, 
                Bitmap zneg, 
                Allocation.MipmapControl mips, 
                int usage)

Creates a cubemap Allocation from 6 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
Returns
Allocation allocation containing cubemap data

createFromBitmap

Allocation createFromBitmap (RenderScript rs, 
                Bitmap b, 
                Allocation.MipmapControl mips, 
                int usage)

Creates an Allocation from a 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
Returns
Allocation Allocation containing bitmap data

createFromBitmap

Allocation createFromBitmap (RenderScript rs, 
                Bitmap b)

Creates an Allocation from a Bitmap.

This Allocation will be created with USAGE_SHARED, and USAGE_SCRIPT.

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

createFromBitmapResource

Allocation createFromBitmapResource (RenderScript rs, 
                Resources res, 
                int id)

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

This allocation will be created with USAGE_SCRIPT and 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
Returns
Allocation Allocation containing resource data

createFromBitmapResource

Allocation createFromBitmapResource (RenderScript rs, 
                Resources res, 
                int id, 
                Allocation.MipmapControl mips, 
                int usage)

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
Returns
Allocation Allocation containing resource data

createFromString

Allocation createFromString (RenderScript rs, 
                String str, 
                int usage)

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
Returns
Allocation

createSized

Allocation createSized (RenderScript rs, 
                Element e, 
                int count, 
                int usage)

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
Returns
Allocation allocation

createSized

Allocation createSized (RenderScript rs, 
                Element e, 
                int count)

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
Returns
Allocation allocation

createTyped

Allocation createTyped (RenderScript rs, 
                Type type)

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

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

createTyped

Allocation createTyped (RenderScript rs, 
                Type type, 
                int usage)

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
Returns
Allocation allocation

createTyped

Allocation createTyped (RenderScript rs, 
                Type type, 
                Allocation.MipmapControl mips, 
                int usage)

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

Parameters
rs RenderScript
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
Returns
Allocation

destroy

void destroy ()

Frees any native resources associated with this object. The primary use is to force immediate cleanup of resources when it is believed the GC will not respond quickly enough. For USAGE_IO_OUTPUT, destroy() implies setSurface(null).

generateMipmaps

void generateMipmaps ()

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

ByteBuffer getByteBuffer ()

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. The ByteBuffer will be Read-Only for devices before Lollopop (API 21).

Returns
ByteBuffer ByteBuffer The ByteBuffer associated with raw data pointer of the Allocation.

getBytesSize

int getBytesSize ()

Get the size of the Allocation in bytes.

Returns
int size of the Allocation in bytes.

getElement

Element getElement ()

Get the Element of the Type of the Allocation.

Returns
Element Element

getIncAllocID

long getIncAllocID ()

Getter & Setter for the dummy allocation for Inc Support Lib.

Returns
long

getStride

long getStride ()

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.

Returns
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.

getType

Type getType ()

Get the Type of the Allocation.

Returns
Type Type

getUsage

int getUsage ()

Get the usage flags of the Allocation.

Returns
int usage this Allocation's set of the USAGE_* flags OR'd together

ioReceive

void ioReceive ()

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

ioSend

void ioSend ()

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.

ioSendOutput

void ioSendOutput ()

Delete once code is updated.

setAutoPadding

void setAutoPadding (boolean useAutoPadding)

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 U8_3(RenderScript) or RGB_888(RenderScript)). 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 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 I32_3(RenderScript) 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 I32_3(RenderScript) 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

void setFromFieldPacker (int xoff, 
                int component_number, 
                FieldPacker fp)

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

setFromFieldPacker

void setFromFieldPacker (int xoff, 
                FieldPacker fp)

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

setIncAllocID

void setIncAllocID (long id)

Parameters
id long

setSurface

void setSurface (Surface sur)

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

Parameters
sur Surface: Surface to associate with allocation

syncAll

void syncAll (int srcLocation)

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

Parameters
srcLocation int

Protected methods

finalize

void finalize ()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Throws
Throwable

Hooray!