共用方式為


Allocation Class

Definition

This class provides the primary method through which data is passed to and from RenderScript kernels.

[Android.Runtime.Register("android/renderscript/Allocation", DoNotGenerateAcw=true)]
public class Allocation : Android.Renderscripts.BaseObj
[<Android.Runtime.Register("android/renderscript/Allocation", DoNotGenerateAcw=true)>]
type Allocation = class
    inherit BaseObj
Inheritance
Allocation
Derived
Attributes

Remarks

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

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

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

<div class="special reference"> <h3>Developer Guides</h3>

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

</div>

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

Java documentation for android.renderscript.Allocation.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Allocation(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

ByteBuffer

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

BytesSize

Get the size of the Allocation in bytes.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Element

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

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Name

setName assigns a name to an object.

(Inherited from BaseObj)
PeerReference (Inherited from Object)
Stride

Gets the stride of the Allocation.

Surface

Returns the handle to a raw buffer that is being managed by the screen compositor. -or- Associate a android.view.Surface with this Allocation.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

TimeStamp

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

Type

Get the android.renderscript.Type of the Allocation.

Usage

Get the usage flags of the Allocation.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Copy1DRangeFrom(Int32, Int32, Allocation, Int32)

Copy part of an Allocation into this Allocation.

Copy1DRangeFrom(Int32, Int32, Byte[])

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

Copy1DRangeFrom(Int32, Int32, Int16[])

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

Copy1DRangeFrom(Int32, Int32, Int32[])

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

Copy1DRangeFrom(Int32, Int32, Object)

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

Copy1DRangeFrom(Int32, Int32, Single[])

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

Copy1DRangeFromUnchecked(Int32, Int32, Byte[])

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

Copy1DRangeFromUnchecked(Int32, Int32, Int16[])

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

Copy1DRangeFromUnchecked(Int32, Int32, Int32[])

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

Copy1DRangeFromUnchecked(Int32, Int32, Object)

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

Copy1DRangeFromUnchecked(Int32, Int32, Single[])

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

Copy1DRangeTo(Int32, Int32, Byte[])

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

Copy1DRangeTo(Int32, Int32, Int16[])

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

Copy1DRangeTo(Int32, Int32, Int32[])

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

Copy1DRangeTo(Int32, Int32, Object)

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

Copy1DRangeTo(Int32, Int32, Single[])

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

Copy1DRangeToUnchecked(Int32, Int32, Byte[])

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

Copy1DRangeToUnchecked(Int32, Int32, Int16[])

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

Copy1DRangeToUnchecked(Int32, Int32, Int32[])

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

Copy1DRangeToUnchecked(Int32, Int32, Object)

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

Copy1DRangeToUnchecked(Int32, Int32, Single[])

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

Copy2DRangeFrom(Int32, Int32, Bitmap)

Copy a android.graphics.Bitmap into an Allocation.

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Allocation, Int32, Int32)

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

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Byte[])

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

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Int16[])

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

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Int32[])

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

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Object)

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

Copy2DRangeFrom(Int32, Int32, Int32, Int32, Single[])

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

Copy2DRangeTo(Int32, Int32, Int32, Int32, Byte[])

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

Copy2DRangeTo(Int32, Int32, Int32, Int32, Int16[])

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

Copy2DRangeTo(Int32, Int32, Int32, Int32, Int32[])

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

Copy2DRangeTo(Int32, Int32, Int32, Int32, Object)

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

Copy2DRangeTo(Int32, Int32, Int32, Int32, Single[])

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

Copy3DRangeFrom(Int32, Int32, Int32, Int32, Int32, Int32, Allocation, Int32, Int32, Int32)

Copy a rectangular region into the allocation from another allocation.

Copy3DRangeFrom(Int32, Int32, Int32, Int32, Int32, Int32, Object)

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

Copy3DRangeTo(Int32, Int32, Int32, Int32, Int32, Int32, Object)
CopyFrom(Allocation)

Copy an Allocation from an Allocation.

CopyFrom(BaseObj[])

Copy an array of RS objects to the Allocation.

CopyFrom(Bitmap)

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

CopyFrom(Byte[])

Copy into this Allocation from an array.

CopyFrom(Int16[])

Copy into this Allocation from an array.

CopyFrom(Int32[])

Copy into this Allocation from an array.

CopyFrom(Object)

Copy into this Allocation from an array.

CopyFrom(Single[])

Copy into this Allocation from an array.

CopyFromUnchecked(Byte[])

Copy into this Allocation from an array.

CopyFromUnchecked(Int16[])

Copy into this Allocation from an array.

CopyFromUnchecked(Int32[])

Copy into this Allocation from an array.

CopyFromUnchecked(Object)

Copy into this Allocation from an array.

CopyFromUnchecked(Single[])

Copy into this Allocation from an array.

CopyTo(Bitmap)

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

CopyTo(Byte[])

Copy from the Allocation into a byte array.

CopyTo(Int16[])

Copy from the Allocation into a short array.

CopyTo(Int32[])

Copy from the Allocation into a int array.

CopyTo(Object)

Copy from the Allocation into an array.

CopyTo(Single[])

Copy from the Allocation into a float array.

CreateAllocations(RenderScript, Type, Int32, Int32)

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

CreateCubemapFromBitmap(RenderScript, Bitmap, Allocation+MipmapControl, AllocationUsage)

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

CreateCubemapFromBitmap(RenderScript, Bitmap)

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

CreateCubemapFromCubeFaces(RenderScript, Bitmap, Bitmap, Bitmap, Bitmap, Bitmap, Bitmap, Allocation+MipmapControl, AllocationUsage)

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

CreateCubemapFromCubeFaces(RenderScript, Bitmap, Bitmap, Bitmap, Bitmap, Bitmap, Bitmap)

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

CreateFromBitmap(RenderScript, Bitmap, Allocation+MipmapControl, AllocationUsage)

Creates an Allocation from a android.graphics.Bitmap.

CreateFromBitmap(RenderScript, Bitmap)

Creates an Allocation from a android.graphics.Bitmap.

CreateFromBitmapResource(RenderScript, Resources, Int32, Allocation+MipmapControl, AllocationUsage)

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

CreateFromBitmapResource(RenderScript, Resources, Int32)

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

CreateFromString(RenderScript, String, AllocationUsage)

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

CreateSized(RenderScript, Element, Int32, AllocationUsage)

Creates an Allocation with a specified number of given elements

CreateSized(RenderScript, Element, Int32)

Creates an Allocation with a specified number of given elements

CreateTyped(RenderScript, Type, Allocation+MipmapControl, AllocationUsage)

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

CreateTyped(RenderScript, Type, AllocationUsage)

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

CreateTyped(RenderScript, Type)

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

Destroy()

Frees any native resources associated with this object.

(Inherited from BaseObj)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

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

(Inherited from Object)
GenerateMipmaps()

Generate a mipmap chain.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IoReceive()

Receive the latest input into the Allocation.

IoSend()

Send a buffer to the output stream.

JavaFinalize()

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

(Inherited from Object)
Notify()

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

(Inherited from Object)
NotifyAll()

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

(Inherited from Object)
Resize(Int32)
Obsolete.

Resize a 1D allocation.

SetAutoPadding(Boolean)

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

SetFromFieldPacker(Int32, FieldPacker)

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

SetFromFieldPacker(Int32, Int32, FieldPacker)

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

SetFromFieldPacker(Int32, Int32, Int32, Int32, FieldPacker)

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

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetOnBufferAvailableListener(Allocation+IOnBufferAvailableListener)

Set a notification handler for #USAGE_IO_INPUT.

SyncAll(Int32)

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

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

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

(Inherited from Object)
Wait(Int64, Int32)

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

(Inherited from Object)
Wait(Int64)

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

(Inherited from Object)

Events

BufferAvailable

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to