Lines Matching defs:Allocation

30  * and from RenderScript kernels.  An Allocation provides the backing store for
33 * <p>An Allocation also contains a set of usage flags that denote how the
34 * Allocation could be used. For example, an Allocation may have usage flags
37 * different usages using {@link android.renderscript.Allocation#syncAll} in
38 * order to ensure that different users of the Allocation have a consistent view
39 * of memory. For example, in the case where an Allocation is used as the output
41 * {@link #syncAll syncAll(Allocation.USAGE_SCRIPT)} prior to launching the
44 * <p>An Allocation can be populated with the {@link #copyFrom} routines. For
54 public class Allocation extends BaseObj {
58 Allocation mAdaptedAllocation;
76 static HashMap<Long, Allocation> mAllocationMap =
77 new HashMap<Long, Allocation>();
140 * The usage of the Allocation. These signal to RenderScript where to place
141 * the Allocation in memory.
146 * The Allocation will be bound to and accessed by scripts.
151 * The Allocation will be used as a texture source by one or more graphics
158 * The Allocation will be used as a graphics mesh.
167 * The Allocation will be used as the source of shader constants by one or
176 * The Allocation will be used as a target for offscreen rendering
184 * The Allocation will be used as a {@link android.view.Surface}
185 * consumer. This usage will cause the Allocation to be created
192 * The Allocation will be used as a {@link android.view.Surface}
195 * Allocation.
201 * The Allocation's backing store will be inherited from another object
204 * copy. {@link #syncAll} may also be used to synchronize the Allocation
226 * the Allocation will contain a full mipmap chain. On upload, the full
232 * The Type of the Allocation will be the same as MIPMAP_NONE. It will
255 * android.renderscript.Type} of the Allocation.
265 * Get the usage flags of the Allocation.
267 * @return usage this Allocation's set of the USAGE_* flags OR'd together
275 * Get the size of the Allocation in bytes.
277 * @return size of the Allocation in bytes.
304 Allocation(long id, RenderScript rs, Type t, int usage) {
431 * Get the {@link android.renderscript.Type} of the Allocation.
441 * Propagate changes from one usage of the Allocation to the
442 * other usages of the Allocation.
471 * Send a buffer to the output stream. The contents of the Allocation will
473 * #USAGE_IO_OUTPUT} is set on the Allocation.
489 * Receive the latest input into the Allocation. This operation
490 * is only valid if {@link #USAGE_IO_INPUT} is set on the Allocation.
505 * Copy an array of RS objects to the Allocation.
542 throw new RSIllegalArgumentException("Allocation kind is " +
552 throw new RSIllegalArgumentException("Allocation kind is " +
562 throw new RSIllegalArgumentException("Allocation kind is " +
572 throw new RSIllegalArgumentException("Allocation kind is " +
603 * Copy into this Allocation from an array. This method does not guarantee
604 * that the Allocation is compatible with the input buffer; it copies memory
617 * Copy into this Allocation from an array. This method does not guarantee
618 * that the Allocation is compatible with the input buffer; it copies memory
628 * Copy into this Allocation from an array. This method does not guarantee
629 * that the Allocation is compatible with the input buffer; it copies memory
639 * Copy into this Allocation from an array. This method does not guarantee
640 * that the Allocation is compatible with the input buffer; it copies memory
650 * Copy into this Allocation from an array. This method does not guarantee
651 * that the Allocation is compatible with the input buffer; it copies memory
662 * Copy into this Allocation from an array. This variant is type checked
663 * and will generate exceptions if the Allocation's {@link
677 * Copy into this Allocation from an array. This variant is type checked
678 * and will generate exceptions if the Allocation's {@link
689 * Copy into this Allocation from an array. This variant is type checked
690 * and will generate exceptions if the Allocation's {@link
701 * Copy into this Allocation from an array. This variant is type checked
702 * and will generate exceptions if the Allocation's {@link
713 * Copy into this Allocation from an array. This variant is type checked
714 * and will generate exceptions if the Allocation's {@link
725 * Copy into an Allocation from a {@link android.graphics.Bitmap}. The
730 * android.graphics.Bitmap} used to create the Allocation with {@link
731 * #createFromBitmap} and {@link #USAGE_SHARED} is set on the Allocation,
732 * this will synchronize the Allocation with the latest data from the {@link
754 * Copy an Allocation from an Allocation. The types of both allocations
759 public void copyFrom(Allocation a) {
839 * Generate a mipmap chain. This is only valid if the Type of the Allocation
845 * <p>If the Allocation is also using other memory spaces, a call to {@link
846 * #syncAll syncAll(Allocation.USAGE_SCRIPT)} is required.</p>
862 * Copy an array into part of this Allocation. This method does not
863 * guarantee that the Allocation is compatible with the input buffer.
876 * Copy an array into part of this Allocation. This method does not
877 * guarantee that the Allocation is compatible with the input buffer.
888 * Copy an array into part of this Allocation. This method does not
889 * guarantee that the Allocation is compatible with the input buffer.
900 * Copy an array into part of this Allocation. This method does not
901 * guarantee that the Allocation is compatible with the input buffer.
912 * Copy an array into part of this Allocation. This method does not
913 * guarantee that the Allocation is compatible with the input buffer.
925 * Copy an array into part of this Allocation. This variant is type checked
926 * and will generate exceptions if the Allocation type does not
940 * Copy an array into part of this Allocation. This variant is type checked
941 * and will generate exceptions if the Allocation type is not a 32 bit
954 * Copy an array into part of this Allocation. This variant is type checked
955 * and will generate exceptions if the Allocation type is not a 16 bit
968 * Copy an array into part of this Allocation. This variant is type checked
969 * and will generate exceptions if the Allocation type is not an 8 bit
982 * Copy an array into part of this Allocation. This variant is type checked
983 * and will generate exceptions if the Allocation type is not a 32 bit float
996 * Copy part of an Allocation into this Allocation.
1004 public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
1040 * Copy from an array into a rectangular region in this Allocation. The
1043 * @param xoff X offset of the region to update in this Allocation
1044 * @param yoff Y offset of the region to update in this Allocation
1047 * @param array Data to be placed into the Allocation
1058 * Copy from an array into a rectangular region in this Allocation. The
1061 * @param xoff X offset of the region to update in this Allocation
1062 * @param yoff Y offset of the region to update in this Allocation
1065 * @param data to be placed into the Allocation
1074 * Copy from an array into a rectangular region in this Allocation. The
1077 * @param xoff X offset of the region to update in this Allocation
1078 * @param yoff Y offset of the region to update in this Allocation
1081 * @param data to be placed into the Allocation
1090 * Copy from an array into a rectangular region in this Allocation. The
1093 * @param xoff X offset of the region to update in this Allocation
1094 * @param yoff Y offset of the region to update in this Allocation
1097 * @param data to be placed into the Allocation
1106 * Copy from an array into a rectangular region in this Allocation. The
1109 * @param xoff X offset of the region to update in this Allocation
1110 * @param yoff Y offset of the region to update in this Allocation
1113 * @param data to be placed into the Allocation
1122 * Copy a rectangular region from an Allocation into a rectangular region in
1123 * this Allocation.
1125 * @param xoff X offset of the region in this Allocation
1126 * @param yoff Y offset of the region in this Allocation
1129 * @param data source Allocation.
1130 * @param dataXoff X offset in source Allocation
1131 * @param dataYoff Y offset in source Allocation
1134 Allocation data, int dataXoff, int dataYoff) {
1146 * Copy a {@link android.graphics.Bitmap} into an Allocation. The height
1150 * @param xoff X offset of the region to update in this Allocation
1151 * @param yoff Y offset of the region to update in this Allocation
1206 * @param xoff X offset of the region to update in this Allocation
1207 * @param yoff Y offset of the region to update in this Allocation
1208 * @param zoff Z offset of the region to update in this Allocation
1227 * @param xoff X offset of the region to update in this Allocation
1228 * @param yoff Y offset of the region to update in this Allocation
1229 * @param zoff Z offset of the region to update in this Allocation
1234 * @param dataXoff X offset of the region in the source Allocation
1235 * @param dataYoff Y offset of the region in the source Allocation
1236 * @param dataZoff Z offset of the region in the source Allocation
1239 Allocation data, int dataXoff, int dataYoff, int dataZoff) {
1249 * Copy from the Allocation into a {@link android.graphics.Bitmap}. The
1250 * bitmap must match the dimensions of the Allocation.
1252 * @param b The bitmap to be set from the Allocation.
1275 * Copy from the Allocation into an array. The array must be at
1276 * least as large as the Allocation. The
1280 * @param array The array to be set from the Allocation.
1288 * Copy from the Allocation into a byte array. The array must be at least
1289 * as large as the Allocation. The allocation must be of an 8 bit integer
1292 * @param d The array to be set from the Allocation.
1300 * Copy from the Allocation into a short array. The array must be at least
1301 * as large as the Allocation. The allocation must be of an 16 bit integer
1304 * @param d The array to be set from the Allocation.
1312 * Copy from the Allocation into a int array. The array must be at least as
1313 * large as the Allocation. The allocation must be of an 32 bit integer
1316 * @param d The array to be set from the Allocation.
1324 * Copy from the Allocation into a float array. The array must be at least
1325 * as large as the Allocation. The allocation must be of an 32 bit float
1328 * @param d The array to be set from the Allocation.
1376 * Creates a new Allocation with the given {@link
1382 * @param usage bit field specifying how the Allocation is
1385 static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips, int usage) {
1393 throw new RSRuntimeException("Allocation creation failed.");
1396 return new Allocation(id, rs, type, usage);
1400 * Creates an Allocation with the size specified by the type and no mipmaps
1410 static public Allocation createTyped(RenderScript rs, Type type, int usage) {
1415 * Creates an Allocation for use by scripts with a given {@link
1418 * @param rs Context to which the Allocation will belong.
1423 static public Allocation createTyped(RenderScript rs, Type type) {
1428 * Creates an Allocation with a specified number of given elements
1430 * @param rs Context to which the Allocation will belong.
1431 * @param e Element to use in the Allocation
1432 * @param count the number of Elements in the Allocation
1433 * @param usage bit field specifying how the Allocation is
1438 static public Allocation createSized(RenderScript rs, Element e,
1448 throw new RSRuntimeException("Allocation creation failed.");
1451 return new Allocation(id, rs, t, usage);
1455 * Creates an Allocation with a specified number of given elements
1457 * @param rs Context to which the Allocation will belong.
1458 * @param e Element to use in the Allocation
1459 * @param count the number of Elements in the Allocation
1463 static public Allocation createSized(RenderScript rs, Element e, int count) {
1495 * Creates an Allocation from a {@link android.graphics.Bitmap}.
1504 * @return Allocation containing bitmap data
1507 static public Allocation createFromBitmap(RenderScript rs, Bitmap b,
1536 Allocation alloc = new Allocation(id, rs, t, usage);
1547 return new Allocation(id, rs, t, usage);
1560 throw new RSInvalidStateException("Allocation is not a surface texture.");
1566 * Associate a {@link android.view.Surface} with this Allocation. This
1574 throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
1581 * Creates an Allocation from a {@link android.graphics.Bitmap}.
1583 * <p>With target API version 18 or greater, this Allocation will be created
1586 * Allocation will be created with {@link #USAGE_GRAPHICS_TEXTURE}.</p>
1591 * @return Allocation containing bitmap data
1594 static public Allocation createFromBitmap(RenderScript rs, Bitmap b) {
1604 * Creates a cubemap Allocation from a {@link android.graphics.Bitmap}
1618 static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
1649 return new Allocation(id, rs, t, usage);
1653 * Creates a non-mipmapped cubemap Allocation for use as a graphics texture
1665 static public Allocation createCubemapFromBitmap(RenderScript rs,
1672 * Creates a cubemap Allocation from 6 {@link android.graphics.Bitmap}
1689 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1719 Allocation cubemap = Allocation.createTyped(rs, t, mips, usage);
1739 * Creates a non-mipmapped cubemap Allocation for use as a sampler input
1755 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1768 * Creates an Allocation from the Bitmap referenced
1779 * @return Allocation containing resource data
1782 static public Allocation createFromBitmapResource(RenderScript rs,
1793 Allocation alloc = createFromBitmap(rs, b, mips, usage);
1799 * Creates a non-mipmapped Allocation to use as a graphics texture from the
1811 * @return Allocation containing resource data
1814 static public Allocation createFromBitmapResource(RenderScript rs,
1828 * Creates an Allocation containing string data encoded in UTF-8 format.
1836 static public Allocation createFromString(RenderScript rs,
1843 Allocation alloc = Allocation.createSized(rs, Element.U8(rs), allocArray.length, usage);
1859 public void onBufferAvailable(Allocation a);
1877 Allocation a = mAllocationMap.get(new Long(id));