Language

Element Class

Definition

An Element represents one item within an android.renderscript.Allocation.

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

Remarks

An Element represents one item within an android.renderscript.Allocation. An Element is roughly equivalent to a C type in a RenderScript kernel. Elements may be basic or complex. Some basic elements are

<ul> <li>A single float value (equivalent to a float in a kernel)</li> <li>A four-element float vector (equivalent to a float4 in a kernel)</li> <li>An unsigned 32-bit integer (equivalent to an unsigned int in a kernel)</li> <li>A single signed 8-bit integer (equivalent to a char in a kernel)</li> </ul>

A complex element is roughly equivalent to a C struct and contains a number of basic or complex Elements. From Java code, a complex element contains a list of sub-elements and names that represents a particular data structure. Structs used in RS scripts are available to Java code by using the ScriptField_structname class that is reflected from a particular script.

Basic Elements are comprised of a android.renderscript.Element.DataType and a android.renderscript.Element.DataKind. The DataType encodes C type information of an Element, while the DataKind encodes how that Element should be interpreted by a android.renderscript.Sampler. Note that android.renderscript.Allocation objects with DataKind android.renderscript.Element.DataKind#USER cannot be used as input for a android.renderscript.Sampler. In general, android.renderscript.Allocation objects that are intended for use with a android.renderscript.Sampler should use bitmap-derived Elements such as android.renderscript.Element#RGBA_8888 or android.renderscript#Element.A_8.

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

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

Name Description
Element(IntPtr, JniHandleOwnership)

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

Properties

Name Description
BytesSize

Gets the size of one element, in bytes.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsComplex

Return if a element is too complex for use as a data source for a Mesh or a Program.

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState

Gets the state flags last assigned by the runtime.

(Inherited from JavaObject)
JniPeerMembers

Gets the JNI metadata used to access members of this Java binding.

Name

setName assigns a name to an object.

(Inherited from BaseObj)
PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
SubElementCount

Elements could be simple, such as an int or a float, or a structure with multiple sub elements, such as a collection of floats, float2, float4.

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.

VectorSize

Returns the number of vector components.

Methods

Name Description
A_8(RenderScript)

Gets an element for pixels with one 8-bit alpha channel.

ALLOCATION(RenderScript)

Gets an element for RenderScript allocation handles.

BOOLEAN(RenderScript)

Utility function for returning an Element containing a single Boolean.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Construct(JniObjectReference, JniObjectReferenceOptions)

Delegates construction of this peer to the runtime's value manager.

(Inherited from JavaObject)
CreatePixel(RenderScript, Element+DataType, Element+DataKind)

Create a new pixel Element type.

CreateVector(RenderScript, Element+DataType, Int32)

Create a custom vector element of the specified DataType and vector size.

Destroy()

Frees any native resources associated with this object.

(Inherited from BaseObj)
Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced()

Asks the value manager to dispose this peer unless its mapping retains this same managed instance.

(Inherited from JavaObject)
ELEMENT(RenderScript)

Gets an element for RenderScript element handles.

Equals(Object)

Tests whether another managed peer refers to the same Java object.

(Inherited from JavaObject)
Equals(Object)

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

(Inherited from Object)
F16_2(RenderScript)

Gets a vector element with two 16-bit floating-point components.

F16_3(RenderScript)

Gets a vector element with three 16-bit floating-point components.

F16_4(RenderScript)

Gets a vector element with four 16-bit floating-point components.

F16(RenderScript)

Gets an element for one 16-bit floating-point value.

F32_2(RenderScript)

Gets a vector element with two 32-bit floating-point components.

F32_3(RenderScript)

Gets a vector element with three 32-bit floating-point components.

F32_4(RenderScript)

Gets a vector element with four 32-bit floating-point components.

F32(RenderScript)

Gets an element for one 32-bit floating-point value.

F64_2(RenderScript)

Gets a vector element with two 64-bit floating-point components.

F64_3(RenderScript)

Gets a vector element with three 64-bit floating-point components.

F64_4(RenderScript)

Gets a vector element with four 64-bit floating-point components.

F64(RenderScript)

Gets an element for one 64-bit floating-point value.

FONT(RenderScript)

Gets an element for RenderScript font handles.

GetDataKind()

Gets the interpretation assigned to the element.

GetDataType()

Gets the element's underlying data type.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetSubElement(Int32)

For complex elements, this function will return the sub-element at index

GetSubElementArraySize(Int32)

For complex elements, some sub-elements could be statically sized arrays.

GetSubElementName(Int32)

For complex elements, this function will return the sub-element name at index

GetSubElementOffsetBytes(Int32)

This function specifies the location of a sub-element within the element

I16_2(RenderScript)

Gets a vector element with two signed 16-bit integer components.

I16_3(RenderScript)

Gets a vector element with three signed 16-bit integer components.

I16_4(RenderScript)

Gets a vector element with four signed 16-bit integer components.

I16(RenderScript)

Gets an element for one signed 16-bit integer.

I32_2(RenderScript)

Gets a vector element with two signed 32-bit integer components.

I32_3(RenderScript)

Gets a vector element with three signed 32-bit integer components.

I32_4(RenderScript)

Gets a vector element with four signed 32-bit integer components.

I32(RenderScript)

Gets an element for one signed 32-bit integer.

I64_2(RenderScript)

Gets a vector element with two signed 64-bit integer components.

I64_3(RenderScript)

Gets a vector element with three signed 64-bit integer components.

I64_4(RenderScript)

Gets a vector element with four signed 64-bit integer components.

I64(RenderScript)

Gets an element for one signed 64-bit integer.

I8_2(RenderScript)

Gets a vector element with two signed 8-bit integer components.

I8_3(RenderScript)

Gets a vector element with three signed 8-bit integer components.

I8_4(RenderScript)

Gets a vector element with four signed 8-bit integer components.

I8(RenderScript)

Utility function for returning an Element containing a single SIGNED_8.

IsCompatible(Element)

Check if the current Element is compatible with another Element.

JavaFinalize()
Obsolete.

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

(Inherited from Object)
MATRIX_2X2(RenderScript)

Gets an element for a 2-by-2 matrix of 32-bit floating-point values.

MATRIX_3X3(RenderScript)

Gets an element for a 3-by-3 matrix of 32-bit floating-point values.

MATRIX_4X4(RenderScript)

Gets an element for a 4-by-4 matrix of 32-bit floating-point values.

MATRIX4X4(RenderScript)
Obsolete.

This member is deprecated.

MESH(RenderScript)

Gets an element for RenderScript mesh handles.

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)
PROGRAM_FRAGMENT(RenderScript)

Gets an element for RenderScript fragment-program handles.

PROGRAM_RASTER(RenderScript)

Gets an element for RenderScript raster-program handles.

PROGRAM_STORE(RenderScript)

Gets an element for RenderScript store-program handles.

PROGRAM_VERTEX(RenderScript)

Gets an element for RenderScript vertex-program handles.

RGB_565(RenderScript)

Gets an RGB pixel element with 5 red, 6 green, and 5 blue bits.

RGB_888(RenderScript)

Gets an RGB pixel element with three 8-bit components.

RGBA_4444(RenderScript)

Gets an RGBA pixel element with four 4-bit components.

RGBA_5551(RenderScript)

Gets an RGBA pixel element with three 5-bit color components and one alpha bit.

RGBA_8888(RenderScript)

Gets an RGBA pixel element with four 8-bit components.

SAMPLER(RenderScript)

Gets an element for RenderScript sampler handles.

SCRIPT(RenderScript)

Gets an element for RenderScript script handles.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPeerReference(JniObjectReference, JniObjectReferenceOptions)

Stores a reference value in the control block without creating a JNI reference copy.

(Inherited from JavaObject)
ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
TYPE(RenderScript)

Gets an element for RenderScript type handles.

U16_2(RenderScript)

Gets a vector element with two unsigned 16-bit integer components.

U16_3(RenderScript)

Gets a vector element with three unsigned 16-bit integer components.

U16_4(RenderScript)

Gets a vector element with four unsigned 16-bit integer components.

U16(RenderScript)

Gets an element for one unsigned 16-bit integer.

U32_2(RenderScript)

Gets a vector element with two unsigned 32-bit integer components.

U32_3(RenderScript)

Gets a vector element with three unsigned 32-bit integer components.

U32_4(RenderScript)

Gets a vector element with four unsigned 32-bit integer components.

U32(RenderScript)

Gets an element for one unsigned 32-bit integer.

U64_2(RenderScript)

Gets a vector element with two unsigned 64-bit integer components.

U64_3(RenderScript)

Gets a vector element with three unsigned 64-bit integer components.

U64_4(RenderScript)

Gets a vector element with four unsigned 64-bit integer components.

U64(RenderScript)

Gets an element for one unsigned 64-bit integer.

U8_2(RenderScript)

Gets a vector element with two unsigned 8-bit integer components.

U8_3(RenderScript)

Gets a vector element with three unsigned 8-bit integer components.

U8_4(RenderScript)

Gets a vector element with four unsigned 8-bit integer components.

U8(RenderScript)

Utility function for returning an Element containing a single UNSIGNED_8.

UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(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)
YUV(RenderScript)

Gets an element for YUV pixel data.

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed()

Marks this peer as disposed and calls Dispose with disposing set to true.

(Inherited from JavaObject)
IJavaPeerable.Finalized()

Marks this peer as disposed and calls Dispose with disposing set to false.

(Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock

Gets the native control-block pointer used by this peer.

(Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32)

Stores the identity hash code supplied by the runtime.

(Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

Replaces the stored managed peer state flags.

(Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference)

Updates the peer reference and releases a disposed peer's control block when the reference is invalid.

(Inherited from JavaObject)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)

Reuses a compatible managed peer or obtains a wrapper of the requested type.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to