FileDocCategorySizeDatePackage
AllocationAdapter.javaAPI DocAndroid 5.1 API7370Thu Mar 12 22:22:42 GMT 2015android.renderscript

AllocationAdapter

public class AllocationAdapter extends Allocation
Only intended for use by generated reflected code.

Fields Summary
Constructors Summary
AllocationAdapter(long id, RenderScript rs, Allocation alloc)

        super(id, rs, alloc.mType, alloc.mUsage);
        mAdaptedAllocation = alloc;
    
Methods Summary
public static android.renderscript.AllocationAdaptercreate1D(RenderScript rs, Allocation a)

        rs.validate();
        AllocationAdapter aa = new AllocationAdapter(0, rs, a);
        aa.mConstrainedLOD = true;
        aa.mConstrainedFace = true;
        aa.mConstrainedY = true;
        aa.mConstrainedZ = true;
        aa.initLOD(0);
        return aa;
    
public static android.renderscript.AllocationAdaptercreate2D(RenderScript rs, Allocation a)

        rs.validate();
        AllocationAdapter aa = new AllocationAdapter(0, rs, a);
        aa.mConstrainedLOD = true;
        aa.mConstrainedFace = true;
        aa.mConstrainedY = false;
        aa.mConstrainedZ = true;
        aa.initLOD(0);
        return aa;
    
longgetID(RenderScript rs)

        throw new RSInvalidStateException(
            "This operation is not supported with adapters at this time.");
    
voidinitLOD(int lod)

        if (lod < 0) {
            throw new RSIllegalArgumentException("Attempting to set negative lod (" + lod + ").");
        }

        int tx = mAdaptedAllocation.mType.getX();
        int ty = mAdaptedAllocation.mType.getY();
        int tz = mAdaptedAllocation.mType.getZ();

        for (int ct=0; ct < lod; ct++) {
            if ((tx==1) && (ty == 1) && (tz == 1)) {
                throw new RSIllegalArgumentException("Attempting to set lod (" + lod + ") out of range.");
            }

            if (tx > 1) tx >>= 1;
            if (ty > 1) ty >>= 1;
            if (tz > 1) tz >>= 1;
        }

        mCurrentDimX = tx;
        mCurrentDimY = ty;
        mCurrentDimZ = tz;
        mCurrentCount = mCurrentDimX;
        if (mCurrentDimY > 1) {
            mCurrentCount *= mCurrentDimY;
        }
        if (mCurrentDimZ > 1) {
            mCurrentCount *= mCurrentDimZ;
        }
        mSelectedY = 0;
        mSelectedZ = 0;
    
public voidreadData(int[] d)

hide

        super.copyTo(d);
    
public voidreadData(float[] d)

hide

        super.copyTo(d);
    
public synchronized voidresize(int dimX)
Override the Allocation resize. Resizing adapters is not allowed and will throw a RSInvalidStateException.

param
dimX ignored.

        throw new RSInvalidStateException("Resize not allowed for Adapters.");
    
public voidsetFace(Type.CubemapFace cf)
Set the active Face. The base allocation must be of a type that includes faces.

param
cf The face to make active.

        if (!mAdaptedAllocation.getType().hasFaces()) {
            throw new RSInvalidStateException("Cannot set Face when the allocation type does not include faces.");
        }
        if (!mConstrainedFace) {
            throw new RSInvalidStateException("Cannot set LOD when the adapter includes mipmaps.");
        }
        if (cf == null) {
            throw new RSIllegalArgumentException("Cannot set null face.");
        }

        mSelectedFace = cf;
    
public voidsetLOD(int lod)
Set the active LOD. The LOD must be within the range for the type being adapted. The base allocation must have mipmaps. Because this changes the dimensions of the adapter the current Y and Z will be reset.

param
lod The LOD to make active.

        if (!mAdaptedAllocation.getType().hasMipmaps()) {
            throw new RSInvalidStateException("Cannot set LOD when the allocation type does not include mipmaps.");
        }
        if (!mConstrainedLOD) {
            throw new RSInvalidStateException("Cannot set LOD when the adapter includes mipmaps.");
        }

        initLOD(lod);
    
public voidsetY(int y)
Set the active Y. The y value must be within the range for the allocation being adapted. The base allocation must contain the Y dimension.

param
y The y to make active.

        if (mAdaptedAllocation.getType().getY() == 0) {
            throw new RSInvalidStateException("Cannot set Y when the allocation type does not include Y dim.");
        }
        if (mAdaptedAllocation.getType().getY() <= y) {
            throw new RSInvalidStateException("Cannot set Y greater than dimension of allocation.");
        }
        if (!mConstrainedY) {
            throw new RSInvalidStateException("Cannot set Y when the adapter includes Y.");
        }

        mSelectedY = y;
    
public voidsetZ(int z)
Set the active Z. The z value must be within the range for the allocation being adapted. The base allocation must contain the Z dimension.

param
z The z to make active.

        if (mAdaptedAllocation.getType().getZ() == 0) {
            throw new RSInvalidStateException("Cannot set Z when the allocation type does not include Z dim.");
        }
        if (mAdaptedAllocation.getType().getZ() <= z) {
            throw new RSInvalidStateException("Cannot set Z greater than dimension of allocation.");
        }
        if (!mConstrainedZ) {
            throw new RSInvalidStateException("Cannot set Z when the adapter includes Z.");
        }

        mSelectedZ = z;
    
public voidsubData(int xoff, FieldPacker fp)

hide

        super.setFromFieldPacker(xoff, fp);
    
public voidsubData1D(int off, int count, int[] d)

hide

        super.copy1DRangeFrom(off, count, d);
    
public voidsubData1D(int off, int count, short[] d)

hide

        super.copy1DRangeFrom(off, count, d);
    
public voidsubData1D(int off, int count, byte[] d)

hide

        super.copy1DRangeFrom(off, count, d);
    
public voidsubData1D(int off, int count, float[] d)

hide

        super.copy1DRangeFrom(off, count, d);
    
public voidsubData2D(int xoff, int yoff, int w, int h, float[] d)

hide

        super.copy2DRangeFrom(xoff, yoff, w, h, d);
    
public voidsubData2D(int xoff, int yoff, int w, int h, int[] d)

hide

        super.copy2DRangeFrom(xoff, yoff, w, h, d);
    
public voidsubElementData(int xoff, int component_number, FieldPacker fp)

hide

        super.setFromFieldPacker(xoff, component_number, fp);