AllocationAdapter


public class AllocationAdapter
extends Allocation

java.lang.Object
   ↳ android.renderscript.BaseObj
     ↳ android.renderscript.Allocation
       ↳ android.renderscript.AllocationAdapter


This class was deprecated in API level 31.
Renderscript has been deprecated in API level 31. Please refer to the migration guide for the proposed alternatives.

Only intended for use by generated reflected code.

Summary

Inherited constants

int USAGE_GRAPHICS_CONSTANTS

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

int USAGE_GRAPHICS_RENDER_TARGET

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

int USAGE_GRAPHICS_TEXTURE

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

int USAGE_GRAPHICS_VERTEX

The Allocation will be used as a graphics mesh.

int USAGE_IO_INPUT

The Allocation will be used as a Surface consumer.

int USAGE_IO_OUTPUT

The Allocation will be used as a Surface 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

static AllocationAdapter create1D(RenderScript rs, Allocation a)
static AllocationAdapter create2D(RenderScript rs, Allocation a)
static AllocationAdapter createTyped(RenderScript rs, Allocation a, Type t)

Create an arbitrary window into the base allocation.

void resize(int dimX)

This method is 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.

void setFace(Type.CubemapFace cf)

Set the active Face.

void setLOD(int lod)

Set the active LOD.

void setX(int x)

Set the active X.

void setY(int y)

Set the active Y.

void setZ(int z)

Set the active Z.

Inherited 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, Allocation data, int dataOff)

Copy part of an Allocation into 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, 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, 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 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 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, Allocation data, int dataXoff, int dataYoff, int dataZoff)

Copy a rectangular region into the allocation from another allocation.

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 copy3DRangeTo(int xoff, int yoff, int zoff, int w, int h, int d, Object array)
void copyFrom(Bitmap b)

Copy into an Allocation from a Bitmap.

void copyFrom(short[] d)

Copy into this Allocation from an array.

void copyFrom(int[] d)

Copy into this Allocation from an array.

void copyFrom(BaseObj[] d)

Copy an array of RS objects to the Allocation.

void copyFrom(byte[] d)

Copy into this Allocation from an array.

void copyFrom(float[] d)

Copy into this Allocation from an array.

void copyFrom(Allocation a)

Copy an Allocation from an Allocation.

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[] createAllocations(RenderScript rs, Type t, int usage, int numAlloc)

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

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)

Creates an Allocation from a Bitmap.

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

Creates an Allocation from a Bitmap.

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 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 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)

Creates an Allocation with a specified number of given elements

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

Creates an Allocation with a specified number of given elements

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.

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

void destroy()

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

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the 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 getStride()

Gets the stride of the Allocation.

Surface getSurface()

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

long getTimeStamp()

Get the timestamp for the most recent buffer held by this 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 resize(int dimX)

This method was deprecated in API level 18. 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.

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 and should not be used by developers.

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 setFromFieldPacker(int xoff, int yoff, int zoff, int component_number, 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 setOnBufferAvailableListener(Allocation.OnBufferAvailableListener callback)

Set a notification handler for USAGE_IO_INPUT.

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.

void destroy()

Frees any native resources associated with this object.

boolean equals(Object obj)

Compare the current BaseObj with another BaseObj for equality.

void finalize()

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

String getName()
int hashCode()

Calculates the hash code value for a BaseObj.

void setName(String name)

setName assigns a name to an object.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

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

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

create1D

Added in API level 14
Deprecated in API level 31
public static AllocationAdapter create1D (RenderScript rs, 
                Allocation a)

Parameters
rs RenderScript

a Allocation

create2D

Added in API level 11
public static AllocationAdapter create2D (RenderScript rs, 
                Allocation a)

Parameters
rs RenderScript

a Allocation

createTyped

Added in API level 23
Deprecated in API level 31
public static AllocationAdapter createTyped (RenderScript rs, 
                Allocation a, 
                Type t)

Create an arbitrary window into the base allocation. The type describes the shape of the window. Any dimensions present in the type must be equal or smaller to the dimensions in the source allocation. A dimension present in the allocation that is not present in the type will be constrained away with the selectors. If a dimension is present in both the type and allocation, one of two things will happen. If the type is smaller than the allocation, a window will be created, the selected value in the adapter for that dimension will act as the base address, and the type will describe the size of the view starting at that point. If the type and allocation dimension are of the same size, then setting the selector for the dimension will be an error.

Parameters
rs RenderScript

a Allocation

t Type

resize

Added in API level 11
public void resize (int dimX)

This method is 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.

Override the Allocation resize. Resizing adapters is not allowed and will throw a RSInvalidStateException.

Parameters
dimX int: ignored.

setFace

Added in API level 11
public void setFace (Type.CubemapFace cf)

Set the active Face. The base allocation must be of a type that includes faces.

Parameters
cf Type.CubemapFace: The face to make active.

setLOD

Added in API level 11
public void setLOD (int lod)

Set the active LOD. The LOD must be within the range for the type being adapted. The base allocation must have mipmaps. Because this changes the dimensions of the adapter the current Y and Z will be reset.

Parameters
lod int: The LOD to make active.

setX

Added in API level 23
Deprecated in API level 31
public void setX (int x)

Set the active X. The x value must be within the range for the allocation being adapted.

Parameters
x int: The x to make active.

setY

Added in API level 11
public void setY (int y)

Set the active Y. The y value must be within the range for the allocation being adapted. The base allocation must contain the Y dimension.

Parameters
y int: The y to make active.

setZ

Added in API level 11
public void setZ (int z)

Set the active Z. The z value must be within the range for the allocation being adapted. The base allocation must contain the Z dimension.

Parameters
z int: The z to make active.