Methods Summary |
---|
public static android.support.v8.renderscript.Element | ALLOCATION(RenderScript rs)
if(rs.mElement_ALLOCATION == null) {
rs.mElement_ALLOCATION = createUser(rs, DataType.RS_ALLOCATION);
}
return rs.mElement_ALLOCATION;
|
public static android.support.v8.renderscript.Element | A_8(RenderScript rs)
if(rs.mElement_A_8 == null) {
rs.mElement_A_8 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_A);
}
return rs.mElement_A_8;
|
public static android.support.v8.renderscript.Element | BOOLEAN(RenderScript rs)Utility function for returning an Element containing a single Boolean.
if(rs.mElement_BOOLEAN == null) {
rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN);
}
return rs.mElement_BOOLEAN;
|
public static android.support.v8.renderscript.Element | ELEMENT(RenderScript rs)
if(rs.mElement_ELEMENT == null) {
rs.mElement_ELEMENT = createUser(rs, DataType.RS_ELEMENT);
}
return rs.mElement_ELEMENT;
|
public static android.support.v8.renderscript.Element | F32(RenderScript rs)
if(rs.mElement_F32 == null) {
rs.mElement_F32 = createUser(rs, DataType.FLOAT_32);
}
return rs.mElement_F32;
|
public static android.support.v8.renderscript.Element | F32_2(RenderScript rs)
if(rs.mElement_FLOAT_2 == null) {
rs.mElement_FLOAT_2 = createVector(rs, DataType.FLOAT_32, 2);
}
return rs.mElement_FLOAT_2;
|
public static android.support.v8.renderscript.Element | F32_3(RenderScript rs)
if(rs.mElement_FLOAT_3 == null) {
rs.mElement_FLOAT_3 = createVector(rs, DataType.FLOAT_32, 3);
}
return rs.mElement_FLOAT_3;
|
public static android.support.v8.renderscript.Element | F32_4(RenderScript rs)
if(rs.mElement_FLOAT_4 == null) {
rs.mElement_FLOAT_4 = createVector(rs, DataType.FLOAT_32, 4);
}
return rs.mElement_FLOAT_4;
|
public static android.support.v8.renderscript.Element | F64(RenderScript rs)
if(rs.mElement_F64 == null) {
rs.mElement_F64 = createUser(rs, DataType.FLOAT_64);
}
return rs.mElement_F64;
|
public static android.support.v8.renderscript.Element | F64_2(RenderScript rs)
if(rs.mElement_DOUBLE_2 == null) {
rs.mElement_DOUBLE_2 = createVector(rs, DataType.FLOAT_64, 2);
}
return rs.mElement_DOUBLE_2;
|
public static android.support.v8.renderscript.Element | F64_3(RenderScript rs)
if(rs.mElement_DOUBLE_3 == null) {
rs.mElement_DOUBLE_3 = createVector(rs, DataType.FLOAT_64, 3);
}
return rs.mElement_DOUBLE_3;
|
public static android.support.v8.renderscript.Element | F64_4(RenderScript rs)
if(rs.mElement_DOUBLE_4 == null) {
rs.mElement_DOUBLE_4 = createVector(rs, DataType.FLOAT_64, 4);
}
return rs.mElement_DOUBLE_4;
|
public static android.support.v8.renderscript.Element | I16(RenderScript rs)
if(rs.mElement_I16 == null) {
rs.mElement_I16 = createUser(rs, DataType.SIGNED_16);
}
return rs.mElement_I16;
|
public static android.support.v8.renderscript.Element | I16_2(RenderScript rs)
if(rs.mElement_SHORT_2 == null) {
rs.mElement_SHORT_2 = createVector(rs, DataType.SIGNED_16, 2);
}
return rs.mElement_SHORT_2;
|
public static android.support.v8.renderscript.Element | I16_3(RenderScript rs)
if(rs.mElement_SHORT_3 == null) {
rs.mElement_SHORT_3 = createVector(rs, DataType.SIGNED_16, 3);
}
return rs.mElement_SHORT_3;
|
public static android.support.v8.renderscript.Element | I16_4(RenderScript rs)
if(rs.mElement_SHORT_4 == null) {
rs.mElement_SHORT_4 = createVector(rs, DataType.SIGNED_16, 4);
}
return rs.mElement_SHORT_4;
|
public static android.support.v8.renderscript.Element | I32(RenderScript rs)
if(rs.mElement_I32 == null) {
rs.mElement_I32 = createUser(rs, DataType.SIGNED_32);
}
return rs.mElement_I32;
|
public static android.support.v8.renderscript.Element | I32_2(RenderScript rs)
if(rs.mElement_INT_2 == null) {
rs.mElement_INT_2 = createVector(rs, DataType.SIGNED_32, 2);
}
return rs.mElement_INT_2;
|
public static android.support.v8.renderscript.Element | I32_3(RenderScript rs)
if(rs.mElement_INT_3 == null) {
rs.mElement_INT_3 = createVector(rs, DataType.SIGNED_32, 3);
}
return rs.mElement_INT_3;
|
public static android.support.v8.renderscript.Element | I32_4(RenderScript rs)
if(rs.mElement_INT_4 == null) {
rs.mElement_INT_4 = createVector(rs, DataType.SIGNED_32, 4);
}
return rs.mElement_INT_4;
|
public static android.support.v8.renderscript.Element | I64(RenderScript rs)
if(rs.mElement_I64 == null) {
rs.mElement_I64 = createUser(rs, DataType.SIGNED_64);
}
return rs.mElement_I64;
|
public static android.support.v8.renderscript.Element | I64_2(RenderScript rs)
if(rs.mElement_LONG_2 == null) {
rs.mElement_LONG_2 = createVector(rs, DataType.SIGNED_64, 2);
}
return rs.mElement_LONG_2;
|
public static android.support.v8.renderscript.Element | I64_3(RenderScript rs)
if(rs.mElement_LONG_3 == null) {
rs.mElement_LONG_3 = createVector(rs, DataType.SIGNED_64, 3);
}
return rs.mElement_LONG_3;
|
public static android.support.v8.renderscript.Element | I64_4(RenderScript rs)
if(rs.mElement_LONG_4 == null) {
rs.mElement_LONG_4 = createVector(rs, DataType.SIGNED_64, 4);
}
return rs.mElement_LONG_4;
|
public static android.support.v8.renderscript.Element | I8(RenderScript rs)Utility function for returning an Element containing a single SIGNED_8.
if(rs.mElement_I8 == null) {
rs.mElement_I8 = createUser(rs, DataType.SIGNED_8);
}
return rs.mElement_I8;
|
public static android.support.v8.renderscript.Element | I8_2(RenderScript rs)
if(rs.mElement_CHAR_2 == null) {
rs.mElement_CHAR_2 = createVector(rs, DataType.SIGNED_8, 2);
}
return rs.mElement_CHAR_2;
|
public static android.support.v8.renderscript.Element | I8_3(RenderScript rs)
if(rs.mElement_CHAR_3 == null) {
rs.mElement_CHAR_3 = createVector(rs, DataType.SIGNED_8, 3);
}
return rs.mElement_CHAR_3;
|
public static android.support.v8.renderscript.Element | I8_4(RenderScript rs)
if(rs.mElement_CHAR_4 == null) {
rs.mElement_CHAR_4 = createVector(rs, DataType.SIGNED_8, 4);
}
return rs.mElement_CHAR_4;
|
public static android.support.v8.renderscript.Element | MATRIX_2X2(RenderScript rs)
if(rs.mElement_MATRIX_2X2 == null) {
rs.mElement_MATRIX_2X2 = createUser(rs, DataType.MATRIX_2X2);
}
return rs.mElement_MATRIX_2X2;
|
public static android.support.v8.renderscript.Element | MATRIX_3X3(RenderScript rs)
if(rs.mElement_MATRIX_3X3 == null) {
rs.mElement_MATRIX_3X3 = createUser(rs, DataType.MATRIX_3X3);
}
return rs.mElement_MATRIX_3X3;
|
public static android.support.v8.renderscript.Element | MATRIX_4X4(RenderScript rs)
if(rs.mElement_MATRIX_4X4 == null) {
rs.mElement_MATRIX_4X4 = createUser(rs, DataType.MATRIX_4X4);
}
return rs.mElement_MATRIX_4X4;
|
public static android.support.v8.renderscript.Element | RGBA_4444(RenderScript rs)
if(rs.mElement_RGBA_4444 == null) {
rs.mElement_RGBA_4444 = createPixel(rs, DataType.UNSIGNED_4_4_4_4, DataKind.PIXEL_RGBA);
}
return rs.mElement_RGBA_4444;
|
public static android.support.v8.renderscript.Element | RGBA_5551(RenderScript rs)
if(rs.mElement_RGBA_5551 == null) {
rs.mElement_RGBA_5551 = createPixel(rs, DataType.UNSIGNED_5_5_5_1, DataKind.PIXEL_RGBA);
}
return rs.mElement_RGBA_5551;
|
public static android.support.v8.renderscript.Element | RGBA_8888(RenderScript rs)
if(rs.mElement_RGBA_8888 == null) {
rs.mElement_RGBA_8888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGBA);
}
return rs.mElement_RGBA_8888;
|
public static android.support.v8.renderscript.Element | RGB_565(RenderScript rs)
if(rs.mElement_RGB_565 == null) {
rs.mElement_RGB_565 = createPixel(rs, DataType.UNSIGNED_5_6_5, DataKind.PIXEL_RGB);
}
return rs.mElement_RGB_565;
|
public static android.support.v8.renderscript.Element | RGB_888(RenderScript rs)
if(rs.mElement_RGB_888 == null) {
rs.mElement_RGB_888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGB);
}
return rs.mElement_RGB_888;
|
public static android.support.v8.renderscript.Element | SAMPLER(RenderScript rs)
if(rs.mElement_SAMPLER == null) {
rs.mElement_SAMPLER = createUser(rs, DataType.RS_SAMPLER);
}
return rs.mElement_SAMPLER;
|
public static android.support.v8.renderscript.Element | SCRIPT(RenderScript rs)
if(rs.mElement_SCRIPT == null) {
rs.mElement_SCRIPT = createUser(rs, DataType.RS_SCRIPT);
}
return rs.mElement_SCRIPT;
|
public static android.support.v8.renderscript.Element | TYPE(RenderScript rs)
if(rs.mElement_TYPE == null) {
rs.mElement_TYPE = createUser(rs, DataType.RS_TYPE);
}
return rs.mElement_TYPE;
|
public static android.support.v8.renderscript.Element | U16(RenderScript rs)
if(rs.mElement_U16 == null) {
rs.mElement_U16 = createUser(rs, DataType.UNSIGNED_16);
}
return rs.mElement_U16;
|
public static android.support.v8.renderscript.Element | U16_2(RenderScript rs)
if(rs.mElement_USHORT_2 == null) {
rs.mElement_USHORT_2 = createVector(rs, DataType.UNSIGNED_16, 2);
}
return rs.mElement_USHORT_2;
|
public static android.support.v8.renderscript.Element | U16_3(RenderScript rs)
if(rs.mElement_USHORT_3 == null) {
rs.mElement_USHORT_3 = createVector(rs, DataType.UNSIGNED_16, 3);
}
return rs.mElement_USHORT_3;
|
public static android.support.v8.renderscript.Element | U16_4(RenderScript rs)
if(rs.mElement_USHORT_4 == null) {
rs.mElement_USHORT_4 = createVector(rs, DataType.UNSIGNED_16, 4);
}
return rs.mElement_USHORT_4;
|
public static android.support.v8.renderscript.Element | U32(RenderScript rs)
if(rs.mElement_U32 == null) {
rs.mElement_U32 = createUser(rs, DataType.UNSIGNED_32);
}
return rs.mElement_U32;
|
public static android.support.v8.renderscript.Element | U32_2(RenderScript rs)
if(rs.mElement_UINT_2 == null) {
rs.mElement_UINT_2 = createVector(rs, DataType.UNSIGNED_32, 2);
}
return rs.mElement_UINT_2;
|
public static android.support.v8.renderscript.Element | U32_3(RenderScript rs)
if(rs.mElement_UINT_3 == null) {
rs.mElement_UINT_3 = createVector(rs, DataType.UNSIGNED_32, 3);
}
return rs.mElement_UINT_3;
|
public static android.support.v8.renderscript.Element | U32_4(RenderScript rs)
if(rs.mElement_UINT_4 == null) {
rs.mElement_UINT_4 = createVector(rs, DataType.UNSIGNED_32, 4);
}
return rs.mElement_UINT_4;
|
public static android.support.v8.renderscript.Element | U64(RenderScript rs)
if(rs.mElement_U64 == null) {
rs.mElement_U64 = createUser(rs, DataType.UNSIGNED_64);
}
return rs.mElement_U64;
|
public static android.support.v8.renderscript.Element | U64_2(RenderScript rs)
if(rs.mElement_ULONG_2 == null) {
rs.mElement_ULONG_2 = createVector(rs, DataType.UNSIGNED_64, 2);
}
return rs.mElement_ULONG_2;
|
public static android.support.v8.renderscript.Element | U64_3(RenderScript rs)
if(rs.mElement_ULONG_3 == null) {
rs.mElement_ULONG_3 = createVector(rs, DataType.UNSIGNED_64, 3);
}
return rs.mElement_ULONG_3;
|
public static android.support.v8.renderscript.Element | U64_4(RenderScript rs)
if(rs.mElement_ULONG_4 == null) {
rs.mElement_ULONG_4 = createVector(rs, DataType.UNSIGNED_64, 4);
}
return rs.mElement_ULONG_4;
|
public static android.support.v8.renderscript.Element | U8(RenderScript rs)Utility function for returning an Element containing a single UNSIGNED_8.
if(rs.mElement_U8 == null) {
rs.mElement_U8 = createUser(rs, DataType.UNSIGNED_8);
}
return rs.mElement_U8;
|
public static android.support.v8.renderscript.Element | U8_2(RenderScript rs)
if(rs.mElement_UCHAR_2 == null) {
rs.mElement_UCHAR_2 = createVector(rs, DataType.UNSIGNED_8, 2);
}
return rs.mElement_UCHAR_2;
|
public static android.support.v8.renderscript.Element | U8_3(RenderScript rs)
if(rs.mElement_UCHAR_3 == null) {
rs.mElement_UCHAR_3 = createVector(rs, DataType.UNSIGNED_8, 3);
}
return rs.mElement_UCHAR_3;
|
public static android.support.v8.renderscript.Element | U8_4(RenderScript rs)
if(rs.mElement_UCHAR_4 == null) {
rs.mElement_UCHAR_4 = createVector(rs, DataType.UNSIGNED_8, 4);
}
return rs.mElement_UCHAR_4;
|
public static android.support.v8.renderscript.Element | createPixel(RenderScript rs, android.support.v8.renderscript.Element$DataType dt, android.support.v8.renderscript.Element$DataKind dk)Create a new pixel Element type. A matching DataType and DataKind must
be provided. The DataType and DataKind must contain the same number of
components. Vector size will be set to 1.
if (rs.isNative) {
RenderScriptThunker rst = (RenderScriptThunker)rs;
return ElementThunker.createPixel(rst, dt, dk);
}
if (!(dk == DataKind.PIXEL_L ||
dk == DataKind.PIXEL_A ||
dk == DataKind.PIXEL_LA ||
dk == DataKind.PIXEL_RGB ||
dk == DataKind.PIXEL_RGBA ||
dk == DataKind.PIXEL_DEPTH ||
dk == DataKind.PIXEL_YUV)) {
throw new RSIllegalArgumentException("Unsupported DataKind");
}
if (!(dt == DataType.UNSIGNED_8 ||
dt == DataType.UNSIGNED_16 ||
dt == DataType.UNSIGNED_5_6_5 ||
dt == DataType.UNSIGNED_4_4_4_4 ||
dt == DataType.UNSIGNED_5_5_5_1)) {
throw new RSIllegalArgumentException("Unsupported DataType");
}
if (dt == DataType.UNSIGNED_5_6_5 && dk != DataKind.PIXEL_RGB) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
if (dt == DataType.UNSIGNED_5_5_5_1 && dk != DataKind.PIXEL_RGBA) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
if (dt == DataType.UNSIGNED_4_4_4_4 && dk != DataKind.PIXEL_RGBA) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
if (dt == DataType.UNSIGNED_16 &&
dk != DataKind.PIXEL_DEPTH) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
int size = 1;
switch (dk) {
case PIXEL_LA:
size = 2;
break;
case PIXEL_RGB:
size = 3;
break;
case PIXEL_RGBA:
size = 4;
break;
}
boolean norm = true;
int id = rs.nElementCreate(dt.mID, dk.mID, norm, size);
return new Element(id, rs, dt, dk, norm, size);
|
static android.support.v8.renderscript.Element | createUser(RenderScript rs, android.support.v8.renderscript.Element$DataType dt)Create a custom Element of the specified DataType. The DataKind will be
set to USER and the vector size to 1 indicating non-vector.
if (rs.isNative) {
RenderScriptThunker rst = (RenderScriptThunker)rs;
return ElementThunker.create(rst, dt);
}
DataKind dk = DataKind.USER;
boolean norm = false;
int vecSize = 1;
int id = rs.nElementCreate(dt.mID, dk.mID, norm, vecSize);
return new Element(id, rs, dt, dk, norm, vecSize);
|
public static android.support.v8.renderscript.Element | createVector(RenderScript rs, android.support.v8.renderscript.Element$DataType dt, int size)Create a custom vector element of the specified DataType and vector size.
DataKind will be set to USER. Only primitive types (FLOAT_32, FLOAT_64,
SIGNED_8, SIGNED_16, SIGNED_32, SIGNED_64, UNSIGNED_8, UNSIGNED_16,
UNSIGNED_32, UNSIGNED_64, BOOLEAN) are supported.
if (rs.isNative) {
RenderScriptThunker rst = (RenderScriptThunker)rs;
return ElementThunker.createVector(rst, dt, size);
}
if (size < 2 || size > 4) {
throw new RSIllegalArgumentException("Vector size out of range 2-4.");
}
switch (dt) {
// Support only primitive integer/float/boolean types as vectors.
case FLOAT_32:
case FLOAT_64:
case SIGNED_8:
case SIGNED_16:
case SIGNED_32:
case SIGNED_64:
case UNSIGNED_8:
case UNSIGNED_16:
case UNSIGNED_32:
case UNSIGNED_64:
case BOOLEAN: {
DataKind dk = DataKind.USER;
boolean norm = false;
int id = rs.nElementCreate(dt.mID, dk.mID, norm, size);
return new Element(id, rs, dt, dk, norm, size);
}
default: {
throw new RSIllegalArgumentException("Cannot create vector of " +
"non-primitive type.");
}
}
|
public int | getBytesSize()
return mSize;
|
public android.support.v8.renderscript.Element$DataKind | getDataKind()
return mKind;
|
public android.support.v8.renderscript.Element$DataType | getDataType()
return mType;
|
public android.support.v8.renderscript.Element | getSubElement(int index)For complex elements, this function will return the
sub-element at index
if (mVisibleElementMap == null) {
throw new RSIllegalArgumentException("Element contains no sub-elements");
}
if (index < 0 || index >= mVisibleElementMap.length) {
throw new RSIllegalArgumentException("Illegal sub-element index");
}
return mElements[mVisibleElementMap[index]];
|
public int | getSubElementArraySize(int index)For complex elements, some sub-elements could be statically
sized arrays. This function will return the array size for
sub-element at index
if (mVisibleElementMap == null) {
throw new RSIllegalArgumentException("Element contains no sub-elements");
}
if (index < 0 || index >= mVisibleElementMap.length) {
throw new RSIllegalArgumentException("Illegal sub-element index");
}
return mArraySizes[mVisibleElementMap[index]];
|
public int | getSubElementCount()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. This function returns zero for simple
elements or the number of sub-elements otherwise.
if (mVisibleElementMap == null) {
return 0;
}
return mVisibleElementMap.length;
|
public java.lang.String | getSubElementName(int index)For complex elements, this function will return the
sub-element name at index
if (mVisibleElementMap == null) {
throw new RSIllegalArgumentException("Element contains no sub-elements");
}
if (index < 0 || index >= mVisibleElementMap.length) {
throw new RSIllegalArgumentException("Illegal sub-element index");
}
return mElementNames[mVisibleElementMap[index]];
|
public int | getSubElementOffsetBytes(int index)This function specifies the location of a sub-element within
the element
if (mVisibleElementMap == null) {
throw new RSIllegalArgumentException("Element contains no sub-elements");
}
if (index < 0 || index >= mVisibleElementMap.length) {
throw new RSIllegalArgumentException("Illegal sub-element index");
}
return mOffsetInBytes[mVisibleElementMap[index]];
|
public int | getVectorSize()Returns the number of vector components. 2 for float2, 4 for
float4, etc.
return mVectorSize;
|
public boolean | isCompatible(android.support.v8.renderscript.Element e)Check if the current Element is compatible with another Element.
Primitive Elements are compatible if they share the same underlying
size and type (i.e. U8 is compatible with A_8). User-defined Elements
must be equal in order to be compatible. This requires strict name
equivalence for all sub-Elements (in addition to structural equivalence).
// Try strict BaseObj equality to start with.
if (this.equals(e)) {
return true;
}
// Ignore mKind because it is allowed to be different (user vs. pixel).
// We also ignore mNormalized because it can be different. The mType
// field must not be NONE since we require name equivalence for
// all user-created Elements.
return ((mSize == e.mSize) &&
(mType != DataType.NONE) &&
(mType == e.mType) &&
(mVectorSize == e.mVectorSize));
|
public boolean | isComplex()Return if a element is too complex for use as a data source for a Mesh or
a Program.
if (mElements == null) {
return false;
}
for (int ct=0; ct < mElements.length; ct++) {
if (mElements[ct].mElements != null) {
return true;
}
}
return false;
|
private void | updateVisibleSubElements()
if (mElements == null) {
return;
}
int noPaddingFieldCount = 0;
int fieldCount = mElementNames.length;
// Find out how many elements are not padding
for (int ct = 0; ct < fieldCount; ct ++) {
if (mElementNames[ct].charAt(0) != '#") {
noPaddingFieldCount ++;
}
}
mVisibleElementMap = new int[noPaddingFieldCount];
// Make a map that points us at non-padding elements
for (int ct = 0, ctNoPadding = 0; ct < fieldCount; ct ++) {
if (mElementNames[ct].charAt(0) != '#") {
mVisibleElementMap[ctNoPadding ++] = ct;
}
}
|