diff options
Diffstat (limited to 'rs')
-rw-r--r-- | rs/java/android/renderscript/Allocation.java | 977 |
1 files changed, 862 insertions, 115 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index c0ea1324602b..05ad1615dc81 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -297,13 +297,50 @@ public class Allocation extends BaseObj { } /** - * Enable/Disable AutoPadding for Vec3 Elements. - * - * <p> Vec3 Elements, such as {@link Element#U8_3} are treated as Vec4 Elements - * with the fourth vector element used as padding. Enabling the AutoPadding feature - * will automatically add/remove the padding when you copy to/from an Allocation - * with a Vec3 Element. - * <p> By default: Disabled. + * 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 + * {@link Element#U8_3} or {@link Element#RGB_888}). Enabling this feature may make + * copying data from the Allocation to an array or vice-versa less efficient. + * + * <p> Vec3 Element cells are stored in an Allocation as Vec4 Element cells with + * the same {@link android.renderscript.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. + * + * <p> For example, when copying an integer array to an Allocation of two {@link + * Element#I32_3} cells using {@link #copyFrom(int[])}: + * <p> 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. + * + * <p> 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. + * + * <p> Similarly, when copying a byte array to an Allocation of two {@link + * Element#I32_3} cells, using {@link #copyFromUnchecked(int[])}: + * <p> 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. + * + * <p> 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. + * + * <p> 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. + * + * <p> Default: Disabled. * * @param useAutoPadding True: enable AutoPadding; False: disable AutoPadding * @@ -663,12 +700,27 @@ public class Allocation extends BaseObj { } } + /** * 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. * - * @param array The source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param array The source array */ public void copyFromUnchecked(Object array) { try { @@ -685,7 +737,21 @@ public class Allocation extends BaseObj { * that the Allocation is compatible with the input buffer; it copies memory * without reinterpretation. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFromUnchecked(int[] d) { copyFromUnchecked(d, Element.DataType.SIGNED_32, d.length); @@ -696,7 +762,21 @@ public class Allocation extends BaseObj { * that the Allocation is compatible with the input buffer; it copies memory * without reinterpretation. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFromUnchecked(short[] d) { copyFromUnchecked(d, Element.DataType.SIGNED_16, d.length); @@ -707,7 +787,21 @@ public class Allocation extends BaseObj { * that the Allocation is compatible with the input buffer; it copies memory * without reinterpretation. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFromUnchecked(byte[] d) { copyFromUnchecked(d, Element.DataType.SIGNED_8, d.length); @@ -718,7 +812,21 @@ public class Allocation extends BaseObj { * that the Allocation is compatible with the input buffer; it copies memory * without reinterpretation. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFromUnchecked(float[] d) { copyFromUnchecked(d, Element.DataType.FLOAT_32, d.length); @@ -731,7 +839,21 @@ public class Allocation extends BaseObj { * android.renderscript.Element} does not match the array's * primitive type. * - * @param array The source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param array The source array */ public void copyFrom(Object array) { try { @@ -746,9 +868,24 @@ public class Allocation extends BaseObj { /** * Copy into this Allocation from an array. This variant is type checked * and will generate exceptions if the Allocation's {@link - * android.renderscript.Element} is not a 32 bit integer type. + * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit + * integers {@link android.renderscript.Element.DataType}. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFrom(int[] d) { validateIsInt32(); @@ -758,9 +895,24 @@ public class Allocation extends BaseObj { /** * Copy into this Allocation from an array. This variant is type checked * and will generate exceptions if the Allocation's {@link - * android.renderscript.Element} is not a 16 bit integer type. + * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * - * @param d the source data array + * @param d the source array */ public void copyFrom(short[] d) { validateIsInt16OrFloat16(); @@ -770,9 +922,24 @@ public class Allocation extends BaseObj { /** * Copy into this Allocation from an array. This variant is type checked * and will generate exceptions if the Allocation's {@link - * android.renderscript.Element} is not an 8 bit integer type. + * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit + * integers {@link android.renderscript.Element.DataType}. * - * @param d the source data array + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFrom(byte[] d) { validateIsInt8(); @@ -782,9 +949,24 @@ public class Allocation extends BaseObj { /** * Copy into this Allocation from an array. This variant is type checked * and will generate exceptions if the Allocation's {@link - * android.renderscript.Element} is not a 32 bit float type. + * android.renderscript.Element} is neither a 32 bit float nor a vector of + * 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. * - * @param d the source data array + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. + * + * @param d the source array */ public void copyFrom(float[] d) { validateIsFloat32(); @@ -970,13 +1152,28 @@ public class Allocation extends BaseObj { } } + /** - * Copy an array into part of this Allocation. This method does not + * Copy an array into a 1D region of this Allocation. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param array The source data array + * @param array The source array */ public void copy1DRangeFromUnchecked(int off, int count, Object array) { copy1DRangeFromUnchecked(off, count, array, @@ -985,62 +1182,132 @@ public class Allocation extends BaseObj { } /** - * Copy an array into part of this Allocation. This method does not + * Copy an array into a 1D region of this Allocation. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFromUnchecked(int off, int count, int[] d) { copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_32, d.length); } /** - * Copy an array into part of this Allocation. This method does not + * Copy an array into a 1D region of this Allocation. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFromUnchecked(int off, int count, short[] d) { copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_16, d.length); } /** - * Copy an array into part of this Allocation. This method does not + * Copy an array into a 1D region of this Allocation. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFromUnchecked(int off, int count, byte[] d) { copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_8, d.length); } /** - * Copy an array into part of this Allocation. This method does not + * Copy an array into a 1D region of this Allocation. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFromUnchecked(int off, int count, float[] d) { copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.FLOAT_32, d.length); } - /** - * Copy an array into part of this Allocation. This variant is type checked - * and will generate exceptions if the Allocation type does not - * match the component type of the array passed in. + * Copy an array into a 1D region of this Allocation. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} does not match the component type + * of the array passed in. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param array The source data array. + * @param array The source array. */ public void copy1DRangeFrom(int off, int count, Object array) { copy1DRangeFromUnchecked(off, count, array, @@ -1049,13 +1316,28 @@ public class Allocation extends BaseObj { } /** - * Copy an array into part of this Allocation. This variant is type checked - * and will generate exceptions if the Allocation type is not a 32 bit - * integer type. + * Copy an array into a 1D region of this Allocation. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not an 32 bit integer nor a vector of 32 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFrom(int off, int count, int[] d) { validateIsInt32(); @@ -1063,13 +1345,28 @@ public class Allocation extends BaseObj { } /** - * Copy an array into part of this Allocation. This variant is type checked - * and will generate exceptions if the Allocation type is not a 16 bit - * integer type. + * Copy an array into a 1D region of this Allocation. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not an 16 bit integer nor a vector of 16 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFrom(int off, int count, short[] d) { validateIsInt16OrFloat16(); @@ -1077,13 +1374,28 @@ public class Allocation extends BaseObj { } /** - * Copy an array into part of this Allocation. This variant is type checked - * and will generate exceptions if the Allocation type is not an 8 bit - * integer type. + * Copy an array into a 1D region of this Allocation. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeFrom(int off, int count, byte[] d) { validateIsInt8(); @@ -1091,13 +1403,28 @@ public class Allocation extends BaseObj { } /** - * Copy an array into part of this Allocation. This variant is type checked - * and will generate exceptions if the Allocation type is not a 32 bit float - * type. + * Copy an array into a 1D region of this Allocation. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 32 bit float nor a vector of + * 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array. + * @param d the source array. */ public void copy1DRangeFrom(int off, int count, float[] d) { validateIsFloat32(); @@ -1170,7 +1497,23 @@ public class Allocation extends BaseObj { /** * Copy from an array into a rectangular region in this Allocation. The - * array is assumed to be tightly packed. + * array is assumed to be tightly packed. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} does not match the input data type. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1191,7 +1534,24 @@ public class Allocation extends BaseObj { /** * Copy from an array into a rectangular region in this Allocation. The - * array is assumed to be tightly packed. + * array is assumed to be tightly packed. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not an 8 bit integer nor a vector of 8 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1207,7 +1567,24 @@ public class Allocation extends BaseObj { /** * Copy from an array into a rectangular region in this Allocation. The - * array is assumed to be tightly packed. + * array is assumed to be tightly packed. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1223,7 +1600,24 @@ public class Allocation extends BaseObj { /** * Copy from an array into a rectangular region in this Allocation. The - * array is assumed to be tightly packed. + * array is assumed to be tightly packed. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1239,7 +1633,24 @@ public class Allocation extends BaseObj { /** * Copy from an array into a rectangular region in this Allocation. The - * array is assumed to be tightly packed. + * array is assumed to be tightly packed. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 32 bit float nor a vector of + * 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1362,8 +1773,24 @@ public class Allocation extends BaseObj { } /** - * Copy a rectangular region from the array into the allocation. - * The array is assumed to be tightly packed. + * 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 {@link + * android.renderscript.Element} does not match the input data type. + * + * <p> The size of the region is: w * h * d * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to update in this Allocation * @param yoff Y offset of the region to update in this Allocation @@ -1453,10 +1880,23 @@ public class Allocation extends BaseObj { } /** - * Copy from the Allocation into an array. The array must be at - * least as large as the Allocation. The - * {@link android.renderscript.Element} must match the component - * type of the array passed in. + * Copy from the Allocation into an array. The method is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} does not match the input data type. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells will be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * * @param array The array to be set from the Allocation. */ @@ -1466,9 +1906,24 @@ public class Allocation extends BaseObj { } /** - * Copy from the Allocation into a byte array. The array must be at least - * as large as the Allocation. The allocation must be of an 8 bit integer - * {@link android.renderscript.Element} type. + * Copy from the Allocation into a byte array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither an 8 bit integer nor a vector of 8 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells will be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * * @param d The array to be set from the Allocation. */ @@ -1478,9 +1933,24 @@ public class Allocation extends BaseObj { } /** - * Copy from the Allocation into a short array. The array must be at least - * as large as the Allocation. The allocation must be of an 16 bit integer - * {@link android.renderscript.Element} type. + * Copy from the Allocation into a short array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not a 16 bit integer nor a vector of 16 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells will be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * * @param d The array to be set from the Allocation. */ @@ -1490,9 +1960,24 @@ public class Allocation extends BaseObj { } /** - * Copy from the Allocation into a int array. The array must be at least as - * large as the Allocation. The allocation must be of an 32 bit integer - * {@link android.renderscript.Element} type. + * Copy from the Allocation into a int array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is not a 32 bit integer nor a vector of 32 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells will be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * * @param d The array to be set from the Allocation. */ @@ -1502,9 +1987,24 @@ public class Allocation extends BaseObj { } /** - * Copy from the Allocation into a float array. The array must be at least - * as large as the Allocation. The allocation must be of an 32 bit float - * {@link android.renderscript.Element} type. + * Copy from the Allocation into a float array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 32 bit float nor a vector of + * 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> 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 {@link + * #getBytesSize getBytesSize()}. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is disabled, then the size of the array in bytes must be at least the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells will be part of the array. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding} + * is enabled, then the size of the array in bytes must be at least 3/4 the size + * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for + * the cells must not be part of the array. * * @param d The array to be set from the Allocation. */ @@ -1607,12 +2107,26 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not + * Copy a 1D region of this Allocation into an array. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param array The dest data array + * @param array The dest array */ public void copy1DRangeToUnchecked(int off, int count, Object array) { copy1DRangeToUnchecked(off, count, array, @@ -1621,62 +2135,132 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not + * Copy a 1D region of this Allocation into an array. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeToUnchecked(int off, int count, int[] d) { copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_32, d.length); } /** - * Copy part of this Allocation into an array. This method does not + * Copy a 1D region of this Allocation into an array. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeToUnchecked(int off, int count, short[] d) { copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_16, d.length); } /** - * Copy part of this Allocation into an array. This method does not + * Copy a 1D region of this Allocation into an array. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeToUnchecked(int off, int count, byte[] d) { copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.SIGNED_8, d.length); } /** - * Copy part of this Allocation into an array. This method does not + * Copy a 1D region of this Allocation into an array. This method does not * guarantee that the Allocation is compatible with the input buffer. * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeToUnchecked(int off, int count, float[] d) { copy1DRangeToUnchecked(off, count, (Object)d, Element.DataType.FLOAT_32, d.length); } - /** - * Copy part of this Allocation into an array. This method does not - * and will generate exceptions if the Allocation type does not - * match the component type of the array passed in. + * Copy a 1D region of this Allocation into an array. This method is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} does not match the component type + * of the array passed in. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param array The source data array. + * @param array The source array. */ public void copy1DRangeTo(int off, int count, Object array) { copy1DRangeToUnchecked(off, count, array, @@ -1685,13 +2269,28 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not - * and will generate exceptions if the Allocation type is not a 32 bit - * integer type. + * Copy a 1D region of this Allocation into an array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 32 bit integer nor a vector of 32 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeTo(int off, int count, int[] d) { validateIsInt32(); @@ -1699,13 +2298,28 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not - * and will generate exceptions if the Allocation type is not a 16 bit - * integer type. + * Copy a 1D region of this Allocation into an array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 16 bit integer nor a vector of 16 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeTo(int off, int count, short[] d) { validateIsInt16OrFloat16(); @@ -1713,13 +2327,28 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not - * and will generate exceptions if the Allocation type is not an 8 bit - * integer type. + * Copy a 1D region of this Allocation into an array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither an 8 bit integer nor a vector of 8 bit + * integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source array */ public void copy1DRangeTo(int off, int count, byte[] d) { validateIsInt8(); @@ -1727,13 +2356,28 @@ public class Allocation extends BaseObj { } /** - * Copy part of this Allocation into an array. This method does not - * and will generate exceptions if the Allocation type is not a 32 bit float - * type. + * Copy a 1D region of this Allocation into an array. This variant is type checked + * and will generate exceptions if the Allocation's {@link + * android.renderscript.Element} is neither a 32 bit float nor a vector of + * 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: count * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array. + * @param d the source array. */ public void copy1DRangeTo(int off, int count, float[] d) { validateIsFloat32(); @@ -1770,7 +2414,24 @@ public class Allocation extends BaseObj { } /** - * Copy from a rectangular region in this Allocation into an 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 + * {@link android.renderscript.Element} does not match the component type + * of the array passed in. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -1785,7 +2446,24 @@ public class Allocation extends BaseObj { } /** - * Copy from a rectangular region in this Allocation into an array. + * Copy from a rectangular region in this Allocation into an array. This + * variant is type checked and will generate exceptions if the Allocation's + * {@link android.renderscript.Element} is neither an 8 bit integer nor a vector + * of 8 bit integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -1800,7 +2478,24 @@ public class Allocation extends BaseObj { } /** - * Copy from a rectangular region in this Allocation into an array. + * Copy from a rectangular region in this Allocation into an array. This + * variant is type checked and will generate exceptions if the Allocation's + * {@link android.renderscript.Element} is neither a 16 bit integer nor a vector + * of 16 bit integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -1815,7 +2510,24 @@ public class Allocation extends BaseObj { } /** - * Copy from a rectangular region in this Allocation into an array. + * Copy from a rectangular region in this Allocation into an array. This + * variant is type checked and will generate exceptions if the Allocation's + * {@link android.renderscript.Element} is neither a 32 bit integer nor a vector + * of 32 bit integers {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -1830,7 +2542,24 @@ public class Allocation extends BaseObj { } /** - * Copy from a rectangular region in this Allocation into an array. + * Copy from a rectangular region in this Allocation into an array. This + * variant is type checked and will generate exceptions if the Allocation's + * {@link android.renderscript.Element} is neither a 32 bit float nor a vector + * of 32 bit floats {@link android.renderscript.Element.DataType}. + * + * <p> The size of the region is: w * h * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -1846,7 +2575,8 @@ public class Allocation extends BaseObj { /** - * Copy from a rectangular region in this Allocation into an array. + * Copy from a 3D region in this Allocation into an array. This method does + * not guarantee that the Allocation is compatible with the input buffer. * The array is assumed to be tightly packed. * * The data type of the array is not required to be the same as @@ -1881,7 +2611,24 @@ public class Allocation extends BaseObj { } /* - * Copy from a rectangular region in this Allocation into an array. + * Copy from a 3D region in this Allocation into an array. This + * method is type checked and will generate exceptions if the Allocation's + * {@link android.renderscript.Element} does not match the component type + * of the array passed in. + * + * <p> The size of the region is: w * h * d * {@link #getElement}.{@link + * Element#getBytesSize}. + * + * <p> 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. + * + * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding 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. * * @param xoff X offset of the region to copy in this Allocation * @param yoff Y offset of the region to copy in this Allocation @@ -2091,7 +2838,7 @@ public class Allocation extends BaseObj { /** * 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 + * <p> 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, @@ -2167,7 +2914,7 @@ public class Allocation extends BaseObj { * Creates a new Allocation with the given {@link * android.renderscript.Allocation}. The same data layout of * the input Allocation will be applied. - * If the input allocation is of usage: USAGE_IO_INPUT, the created + * <p> If the input allocation is of usage: USAGE_IO_INPUT, the created * Allocation will be sharing the same BufferQueue. * * @param rs Context to which the allocation will belong. |