Lines Matching defs:Allocation

32  * and from RenderScript kernels.  An Allocation provides the backing store for
35 * <p>An Allocation also contains a set of usage flags that denote how the
36 * Allocation could be used. For example, an Allocation may have usage flags
39 * different usages using {@link android.renderscript.Allocation#syncAll} in
40 * order to ensure that different users of the Allocation have a consistent view
41 * of memory. For example, in the case where an Allocation is used as the output
43 * {@link #syncAll syncAll(Allocation.USAGE_SCRIPT)} prior to launching the
46 * <p>An Allocation can be populated with the {@link #copyFrom} routines. For
57 public class Allocation extends BaseObj {
64 Allocation mAdaptedAllocation;
83 static HashMap<Long, Allocation> mAllocationMap =
84 new HashMap<Long, Allocation>();
154 * The usage of the Allocation. These signal to RenderScript where to place
155 * the Allocation in memory.
160 * The Allocation will be bound to and accessed by scripts.
165 * The Allocation will be used as a texture source by one or more graphics
172 * The Allocation will be used as a graphics mesh.
181 * The Allocation will be used as the source of shader constants by one or
190 * The Allocation will be used as a target for offscreen rendering
198 * The Allocation will be used as a {@link android.view.Surface}
199 * consumer. This usage will cause the Allocation to be created
206 * The Allocation will be used as a {@link android.view.Surface}
209 * Allocation.
215 * The Allocation's backing store will be inherited from another object
218 * copy. {@link #syncAll} may also be used to synchronize the Allocation
240 * the Allocation will contain a full mipmap chain. On upload, the full
246 * The Type of the Allocation will be the same as MIPMAP_NONE. It will
269 * android.renderscript.Type} of the Allocation.
279 * Get the usage flags of the Allocation.
281 * @return usage this Allocation's set of the USAGE_* flags OR'd together
290 * Get the Mipmap control flag of the Allocation.
292 * @return the Mipmap control flag of the Allocation
300 * Specifies the mapping between the Allocation's cells and an array's elements
301 * when data is copied from the Allocation to the array, or vice-versa.
303 * Only applies to an Allocation whose Element is a vector of length 3 (such as
305 * copying data from the Allocation to an array or vice-versa less efficient.
307 * <p> Vec3 Element cells are stored in an Allocation as Vec4 Element cells with
311 * and the Allocation. When disabled, explicit mapping of the padding components
314 * <p> For example, when copying an integer array to an Allocation of two {@link
318 * to the first cell of the Allocation, and the next 4 integers copied to
326 * <p> Similarly, when copying a byte array to an Allocation of two {@link
330 * to the first cell of the Allocation, and the next 16 bytes copied to
336 * to the first cell of the Allocation, and the next 12 bytes copied to
339 * <p> Similar to copying data to an Allocation from an array, when copying data from an
340 * Allocation to an array, the padding components for Vec3 Element cells will not be
353 * Get the size of the Allocation in bytes.
355 * @return size of the Allocation in bytes.
382 Allocation(long id, RenderScript rs, Type t, int usage) {
424 Allocation(long id, RenderScript rs, Type t, boolean owningType, int usage, MipmapControl mips) {
517 * Get the {@link android.renderscript.Type} of the Allocation.
527 * Propagate changes from one usage of the Allocation to the
528 * other usages of the Allocation.
560 * Send a buffer to the output stream. The contents of the Allocation will
562 * #USAGE_IO_OUTPUT} is set on the Allocation.
581 * Receive the latest input into the Allocation. This operation
582 * is only valid if {@link #USAGE_IO_INPUT} is set on the Allocation.
600 * Copy an array of RS objects to the Allocation.
640 throw new RSIllegalArgumentException("Allocation kind is " +
650 throw new RSIllegalArgumentException("Allocation kind is " +
660 throw new RSIllegalArgumentException("Allocation kind is " +
670 throw new RSIllegalArgumentException("Allocation kind is " +
705 * Copy into this Allocation from an array. This method does not guarantee
706 * that the Allocation is compatible with the input buffer; it copies memory
709 * <p> If the Allocation does not have Vec3 Elements, then the size of the
710 * array in bytes must be at least the size of the Allocation {@link
713 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
715 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
718 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
720 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
736 * Copy into this Allocation from an array. This method does not guarantee
737 * that the Allocation is compatible with the input buffer; it copies memory
740 * <p> If the Allocation does not have Vec3 Elements, then the size of the
741 * array in bytes must be at least the size of the Allocation {@link
744 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
746 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
749 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
751 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
761 * Copy into this Allocation from an array. This method does not guarantee
762 * that the Allocation is compatible with the input buffer; it copies memory
765 * <p> If the Allocation does not have Vec3 Elements, then the size of the
766 * array in bytes must be at least the size of the Allocation {@link
769 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
771 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
774 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
776 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
786 * Copy into this Allocation from an array. This method does not guarantee
787 * that the Allocation is compatible with the input buffer; it copies memory
790 * <p> If the Allocation does not have Vec3 Elements, then the size of the
791 * array in bytes must be at least the size of the Allocation {@link
794 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
796 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
799 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
801 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
811 * Copy into this Allocation from an array. This method does not guarantee
812 * that the Allocation is compatible with the input buffer; it copies memory
815 * <p> If the Allocation does not have Vec3 Elements, then the size of the
816 * array in bytes must be at least the size of the Allocation {@link
819 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
821 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
824 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
826 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
837 * Copy into this Allocation from an array. This variant is type checked
838 * and will generate exceptions if the Allocation's {@link
842 * <p> If the Allocation does not have Vec3 Elements, then the size of the
843 * array in bytes must be at least the size of the Allocation {@link
846 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
848 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
851 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
853 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
869 * Copy into this Allocation from an array. This variant is type checked
870 * and will generate exceptions if the Allocation's {@link
874 * <p> If the Allocation does not have Vec3 Elements, then the size of the
875 * array in bytes must be at least the size of the Allocation {@link
878 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
880 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
883 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
885 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
896 * Copy into this Allocation from an array. This variant is type checked
897 * and will generate exceptions if the Allocation's {@link
901 * <p> If the Allocation does not have Vec3 Elements, then the size of the
902 * array in bytes must be at least the size of the Allocation {@link
905 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
907 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
910 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
912 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
923 * Copy into this Allocation from an array. This variant is type checked
924 * and will generate exceptions if the Allocation's {@link
928 * <p> If the Allocation does not have Vec3 Elements, then the size of the
929 * array in bytes must be at least the size of the Allocation {@link
932 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
934 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
937 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
939 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
950 * Copy into this Allocation from an array. This variant is type checked
951 * and will generate exceptions if the Allocation's {@link
955 * <p> If the Allocation does not have Vec3 Elements, then the size of the
956 * array in bytes must be at least the size of the Allocation {@link
959 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
961 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
964 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
966 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
977 * Copy into an Allocation from a {@link android.graphics.Bitmap}. The
982 * android.graphics.Bitmap} used to create the Allocation with {@link
983 * #createFromBitmap} and {@link #USAGE_SHARED} is set on the Allocation,
984 * this will synchronize the Allocation with the latest data from the {@link
1009 * Copy an Allocation from an Allocation. The types of both allocations
1014 public void copyFrom(Allocation a) {
1124 * Generate a mipmap chain. This is only valid if the Type of the Allocation
1130 * <p>If the Allocation is also using other memory spaces, a call to {@link
1131 * #syncAll syncAll(Allocation.USAGE_SCRIPT)} is required.</p>
1157 * Copy an array into a 1D region of this Allocation. This method does not
1158 * guarantee that the Allocation is compatible with the input buffer.
1163 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1166 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1170 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1185 * Copy an array into a 1D region of this Allocation. This method does not
1186 * guarantee that the Allocation is compatible with the input buffer.
1191 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1194 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1198 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1211 * Copy an array into a 1D region of this Allocation. This method does not
1212 * guarantee that the Allocation is compatible with the input buffer.
1217 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1220 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1224 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1237 * Copy an array into a 1D region of this Allocation. This method does not
1238 * guarantee that the Allocation is compatible with the input buffer.
1243 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1246 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1250 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1263 * Copy an array into a 1D region of this Allocation. This method does not
1264 * guarantee that the Allocation is compatible with the input buffer.
1269 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1272 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1276 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1289 * Copy an array into a 1D region of this Allocation. This variant is type checked
1290 * and will generate exceptions if the Allocation's {@link
1297 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1300 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1304 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1319 * Copy an array into a 1D region of this Allocation. This variant is type checked
1320 * and will generate exceptions if the Allocation's {@link
1327 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1330 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1334 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1348 * Copy an array into a 1D region of this Allocation. This variant is type checked
1349 * and will generate exceptions if the Allocation's {@link
1356 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1359 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1363 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1377 * Copy an array into a 1D region of this Allocation. This variant is type checked
1378 * and will generate exceptions if the Allocation's {@link
1385 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1388 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1392 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1406 * Copy an array into a 1D region of this Allocation. This variant is type checked
1407 * and will generate exceptions if the Allocation's {@link
1414 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1417 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1421 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1435 * Copy part of an Allocation into this Allocation.
1443 public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
1499 * Copy from an array into a rectangular region in this Allocation. The
1501 * and will generate exceptions if the Allocation's {@link
1507 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1510 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1514 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1518 * @param xoff X offset of the region to update in this Allocation
1519 * @param yoff Y offset of the region to update in this Allocation
1522 * @param array Data to be placed into the Allocation
1536 * Copy from an array into a rectangular region in this Allocation. The
1538 * and will generate exceptions if the Allocation's {@link
1545 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1548 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1552 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1556 * @param xoff X offset of the region to update in this Allocation
1557 * @param yoff Y offset of the region to update in this Allocation
1560 * @param data to be placed into the Allocation
1569 * Copy from an array into a rectangular region in this Allocation. The
1571 * and will generate exceptions if the Allocation's {@link
1578 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1581 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1585 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1589 * @param xoff X offset of the region to update in this Allocation
1590 * @param yoff Y offset of the region to update in this Allocation
1593 * @param data to be placed into the Allocation
1602 * Copy from an array into a rectangular region in this Allocation. The
1604 * and will generate exceptions if the Allocation's {@link
1611 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1614 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1618 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1622 * @param xoff X offset of the region to update in this Allocation
1623 * @param yoff Y offset of the region to update in this Allocation
1626 * @param data to be placed into the Allocation
1635 * Copy from an array into a rectangular region in this Allocation. The
1637 * and will generate exceptions if the Allocation's {@link
1644 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1647 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1651 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1655 * @param xoff X offset of the region to update in this Allocation
1656 * @param yoff Y offset of the region to update in this Allocation
1659 * @param data to be placed into the Allocation
1668 * Copy a rectangular region from an Allocation into a rectangular region in
1669 * this Allocation.
1671 * @param xoff X offset of the region in this Allocation
1672 * @param yoff Y offset of the region in this Allocation
1675 * @param data source Allocation.
1676 * @param dataXoff X offset in source Allocation
1677 * @param dataYoff Y offset in source Allocation
1680 Allocation data, int dataXoff, int dataYoff) {
1695 * Copy a {@link android.graphics.Bitmap} into an Allocation. The height
1699 * @param xoff X offset of the region to update in this Allocation
1700 * @param yoff Y offset of the region to update in this Allocation
1776 * Copy from an array into a 3D region in this Allocation. The
1778 * and will generate exceptions if the Allocation's {@link
1784 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1787 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1791 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1795 * @param xoff X offset of the region to update in this Allocation
1796 * @param yoff Y offset of the region to update in this Allocation
1797 * @param zoff Z offset of the region to update in this Allocation
1818 * @param xoff X offset of the region to update in this Allocation
1819 * @param yoff Y offset of the region to update in this Allocation
1820 * @param zoff Z offset of the region to update in this Allocation
1825 * @param dataXoff X offset of the region in the source Allocation
1826 * @param dataYoff Y offset of the region in the source Allocation
1827 * @param dataZoff Z offset of the region in the source Allocation
1830 Allocation data, int dataXoff, int dataYoff, int dataZoff) {
1840 * Copy from the Allocation into a {@link android.graphics.Bitmap}. The
1841 * bitmap must match the dimensions of the Allocation.
1843 * @param b The bitmap to be set from the Allocation.
1883 * Copy from the Allocation into an array. The method is type checked
1884 * and will generate exceptions if the Allocation's {@link
1887 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1888 * array in bytes must be at least the size of the Allocation {@link
1891 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1893 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1896 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1898 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1901 * @param array The array to be set from the Allocation.
1909 * Copy from the Allocation into a byte array. This variant is type checked
1910 * and will generate exceptions if the Allocation's {@link
1914 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1915 * array in bytes must be at least the size of the Allocation {@link
1918 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1920 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1923 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1925 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1928 * @param d The array to be set from the Allocation.
1936 * Copy from the Allocation into a short array. This variant is type checked
1937 * and will generate exceptions if the Allocation's {@link
1941 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1942 * array in bytes must be at least the size of the Allocation {@link
1945 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1947 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1950 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1952 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1955 * @param d The array to be set from the Allocation.
1963 * Copy from the Allocation into a int array. This variant is type checked
1964 * and will generate exceptions if the Allocation's {@link
1968 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1969 * array in bytes must be at least the size of the Allocation {@link
1972 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1974 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1977 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
1979 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
1982 * @param d The array to be set from the Allocation.
1990 * Copy from the Allocation into a float array. This variant is type checked
1991 * and will generate exceptions if the Allocation's {@link
1995 * <p> If the Allocation does not have Vec3 Elements, then the size of the
1996 * array in bytes must be at least the size of the Allocation {@link
1999 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2001 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
2004 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2006 * of the Allocation {@link #getBytesSize getBytesSize()}. The padding bytes for
2009 * @param d The array to be set from the Allocation.
2110 * Copy a 1D region of this Allocation into an array. This method does not
2111 * guarantee that the Allocation is compatible with the input buffer.
2116 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2119 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2123 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2138 * Copy a 1D region of this Allocation into an array. This method does not
2139 * guarantee that the Allocation is compatible with the input buffer.
2144 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2147 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2151 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2164 * Copy a 1D region of this Allocation into an array. This method does not
2165 * guarantee that the Allocation is compatible with the input buffer.
2170 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2173 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2177 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2190 * Copy a 1D region of this Allocation into an array. This method does not
2191 * guarantee that the Allocation is compatible with the input buffer.
2196 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2199 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2203 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2216 * Copy a 1D region of this Allocation into an array. This method does not
2217 * guarantee that the Allocation is compatible with the input buffer.
2222 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2225 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2229 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2242 * Copy a 1D region of this Allocation into an array. This method is type checked
2243 * and will generate exceptions if the Allocation's {@link
2250 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2253 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2257 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2272 * Copy a 1D region of this Allocation into an array. This variant is type checked
2273 * and will generate exceptions if the Allocation's {@link
2280 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2283 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2287 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2301 * Copy a 1D region of this Allocation into an array. This variant is type checked
2302 * and will generate exceptions if the Allocation's {@link
2309 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2312 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2316 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2330 * Copy a 1D region of this Allocation into an array. This variant is type checked
2331 * and will generate exceptions if the Allocation's {@link
2338 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2341 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2345 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2359 * Copy a 1D region of this Allocation into an array. This variant is type checked
2360 * and will generate exceptions if the Allocation's {@link
2367 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2370 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2374 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2417 * Copy from a rectangular region in this Allocation into an array. This
2418 * method is type checked and will generate exceptions if the Allocation's
2425 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2428 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2432 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2436 * @param xoff X offset of the region to copy in this Allocation
2437 * @param yoff Y offset of the region to copy in this Allocation
2449 * Copy from a rectangular region in this Allocation into an array. This
2450 * variant is type checked and will generate exceptions if the Allocation's
2457 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2460 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2464 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2468 * @param xoff X offset of the region to copy in this Allocation
2469 * @param yoff Y offset of the region to copy in this Allocation
2481 * Copy from a rectangular region in this Allocation into an array. This
2482 * variant is type checked and will generate exceptions if the Allocation's
2489 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2492 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2496 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2500 * @param xoff X offset of the region to copy in this Allocation
2501 * @param yoff Y offset of the region to copy in this Allocation
2513 * Copy from a rectangular region in this Allocation into an array. This
2514 * variant is type checked and will generate exceptions if the Allocation's
2521 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2524 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2528 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2532 * @param xoff X offset of the region to copy in this Allocation
2533 * @param yoff Y offset of the region to copy in this Allocation
2545 * Copy from a rectangular region in this Allocation into an array. This
2546 * variant is type checked and will generate exceptions if the Allocation's
2553 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2556 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2560 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2564 * @param xoff X offset of the region to copy in this Allocation
2565 * @param yoff Y offset of the region to copy in this Allocation
2578 * Copy from a 3D region in this Allocation into an array. This method does
2579 * not guarantee that the Allocation is compatible with the input buffer.
2614 * Copy from a 3D region in this Allocation into an array. This
2615 * method is type checked and will generate exceptions if the Allocation's
2622 * <p> If the Allocation does not have Vec3 Elements, then the size of the
2625 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2629 * <p> If the Allocation has Vec3 Elements and {@link #setAutoPadding AutoPadding}
2633 * @param xoff X offset of the region to copy in this Allocation
2634 * @param yoff Y offset of the region to copy in this Allocation
2635 * @param zoff Z offset of the region to copy in this Allocation
2655 * Creates a new Allocation with the given {@link
2661 * @param usage bit field specifying how the Allocation is
2664 static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips, int usage) {
2674 throw new RSRuntimeException("Allocation creation failed.");
2676 return new Allocation(id, rs, type, false, usage, mips);
2683 * Creates an Allocation with the size specified by the type and no mipmaps
2693 static public Allocation createTyped(RenderScript rs, Type type, int usage) {
2698 * Creates an Allocation for use by scripts with a given {@link
2701 * @param rs Context to which the Allocation will belong.
2706 static public Allocation createTyped(RenderScript rs, Type type) {
2711 * Creates an Allocation with a specified number of given elements
2713 * @param rs Context to which the Allocation will belong.
2714 * @param e Element to use in the Allocation
2715 * @param count the number of Elements in the Allocation
2716 * @param usage bit field specifying how the Allocation is
2721 static public Allocation createSized(RenderScript rs, Element e,
2732 throw new RSRuntimeException("Allocation creation failed.");
2734 return new Allocation(id, rs, t, true, usage, MipmapControl.MIPMAP_NONE);
2741 * Creates an Allocation with a specified number of given elements
2743 * @param rs Context to which the Allocation will belong.
2744 * @param e Element to use in the Allocation
2745 * @param count the number of Elements in the Allocation
2749 static public Allocation createSized(RenderScript rs, Element e, int count) {
2781 * Creates an Allocation from a {@link android.graphics.Bitmap}.
2790 * @return Allocation containing bitmap data
2793 static public Allocation createFromBitmap(RenderScript rs, Bitmap b,
2823 Allocation alloc = new Allocation(id, rs, t, true, usage, mips);
2833 return new Allocation(id, rs, t, true, usage, mips);
2840 * Gets or creates a ByteBuffer that contains the raw data of the current Allocation.
2841 * <p> If the Allocation is created with USAGE_IO_INPUT, the returned ByteBuffer
2843 * For a 2D or 3D Allocation, the raw data maybe padded so that each row of
2844 * the Allocation has certain alignment. The size of each row including padding,
2847 * Note: Operating on the ByteBuffer of a destroyed Allocation will triger errors.
2849 * @return ByteBuffer The ByteBuffer associated with raw data pointer of the Allocation.
2874 * Creates a new Allocation Array with the given {@link
2877 * the created Allocation will be sharing the same BufferQueue.
2881 * @param usage bit field specifying how the Allocation is
2884 * @return Allocation[]
2886 public static Allocation[] createAllocations(RenderScript rs, Type t, int usage, int numAlloc) {
2894 Allocation[] mAllocationArray = new Allocation[numAlloc];
2915 * Creates a new Allocation with the given {@link
2916 * android.renderscript.Allocation}. The same data layout of
2917 * the input Allocation will be applied.
2919 * Allocation will be sharing the same BufferQueue.
2922 * @param alloc RenderScript Allocation describing data layout.
2923 * @return Allocation sharing the same data structure.
2925 static Allocation createFromAllocation(RenderScript rs, Allocation alloc) {
2930 throw new RSInvalidStateException("Bad input Allocation");
2938 throw new RSRuntimeException("Allocation creation failed.");
2940 Allocation outAlloc = new Allocation(id, rs, type, false, usage, mips);
2956 throw new RSInvalidStateException("Allocation is not USAGE_IO_INPUT.");
2962 * Share the BufferQueue with another {@link #USAGE_IO_INPUT} Allocation.
2964 * @param alloc Allocation to associate with allocation
2966 void shareBufferQueue(Allocation alloc) {
2969 throw new RSInvalidStateException("Allocation is not USAGE_IO_INPUT.");
2976 * Gets the stride of the Allocation.
2977 * For a 2D or 3D Allocation, the raw data maybe padded so that each row of
2978 * the Allocation has certain alignment. The size of each row including such
2981 * @return the stride. For 1D Allocation, the stride will be the number of
2982 * bytes of this Allocation. For 2D and 3D Allocations, the stride
2993 * Get the timestamp for the most recent buffer held by this Allocation.
3006 * @return long Timestamp associated with the buffer held by the Allocation.
3022 throw new RSInvalidStateException("Allocation is not a surface texture.");
3033 * Associate a {@link android.view.Surface} with this Allocation. This
3041 throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
3048 * Creates an Allocation from a {@link android.graphics.Bitmap}.
3050 * <p>With target API version 18 or greater, this Allocation will be created
3053 * Allocation will be created with {@link #USAGE_GRAPHICS_TEXTURE}.</p>
3058 * @return Allocation containing bitmap data
3061 static public Allocation createFromBitmap(RenderScript rs, Bitmap b) {
3071 * Creates a cubemap Allocation from a {@link android.graphics.Bitmap}
3085 static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
3116 return new Allocation(id, rs, t, true, usage, mips);
3120 * Creates a non-mipmapped cubemap Allocation for use as a graphics texture
3132 static public Allocation createCubemapFromBitmap(RenderScript rs,
3139 * Creates a cubemap Allocation from 6 {@link android.graphics.Bitmap}
3156 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
3186 Allocation cubemap = Allocation.createTyped(rs, t, mips, usage);
3206 * Creates a non-mipmapped cubemap Allocation for use as a sampler input
3222 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
3235 * Creates an Allocation from the Bitmap referenced
3246 * @return Allocation containing resource data
3249 static public Allocation createFromBitmapResource(RenderScript rs,
3260 Allocation alloc = createFromBitmap(rs, b, mips, usage);
3266 * Creates a non-mipmapped Allocation to use as a graphics texture from the
3278 * @return Allocation containing resource data
3281 static public Allocation createFromBitmapResource(RenderScript rs,
3295 * Creates an Allocation containing string data encoded in UTF-8 format.
3303 static public Allocation createFromString(RenderScript rs,
3310 Allocation alloc = Allocation.createSized(rs, Element.U8(rs), allocArray.length, usage);
3326 public void onBufferAvailable(Allocation a);
3344 Allocation a = mAllocationMap.get(new Long(id));