FileDocCategorySizeDatePackage
Script.javaAPI DocAndroid 5.1 API14607Thu Mar 12 22:22:42 GMT 2015android.renderscript

Script

public class Script extends BaseObj
The parent class for all executable scripts. This should not be used by applications.

Fields Summary
private final android.util.SparseArray
mKIDs
private final android.util.SparseArray
mFIDs
Constructors Summary
Script(long id, RenderScript rs)

        super(id, rs);
    
Methods Summary
public voidbindAllocation(Allocation va, int slot)
Only intended for use by generated reflected code.

        mRS.validate();
        mRS.validateObject(va);
        if (va != null) {
            if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) {
                final Type t = va.mType;
                if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) || (t.getZ() != 0)) {
                    throw new RSIllegalArgumentException(
                        "API 20+ only allows simple 1D allocations to be used with bind.");
                }
            }
            mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot);
        } else {
            mRS.nScriptBindAllocation(getID(mRS), 0, slot);
        }
    
protected android.renderscript.Script$FieldIDcreateFieldID(int slot, Element e)
Only to be used by generated reflected classes.

                 
          
        FieldID f = mFIDs.get(slot);
        if (f != null) {
            return f;
        }

        long id = mRS.nScriptFieldIDCreate(getID(mRS), slot);
        if (id == 0) {
            throw new RSDriverException("Failed to create FieldID");
        }

        f = new FieldID(id, mRS, this, slot);
        mFIDs.put(slot, f);
        return f;
    
protected android.renderscript.Script$KernelIDcreateKernelID(int slot, int sig, Element ein, Element eout)
Only to be used by generated reflected classes.

                 
              
        KernelID k = mKIDs.get(slot);
        if (k != null) {
            return k;
        }

        long id = mRS.nScriptKernelIDCreate(getID(mRS), slot, sig);
        if (id == 0) {
            throw new RSDriverException("Failed to create KernelID");
        }

        k = new KernelID(id, mRS, this, slot, sig);
        mKIDs.put(slot, k);
        return k;
    
protected voidforEach(int slot, Allocation ain, Allocation aout, FieldPacker v)
Only intended for use by generated reflected code.

        mRS.validate();
        mRS.validateObject(ain);
        mRS.validateObject(aout);
        if (ain == null && aout == null) {
            throw new RSIllegalArgumentException(
                "At least one of ain or aout is required to be non-null.");
        }
        long in_id = 0;
        if (ain != null) {
            in_id = ain.getID(mRS);
        }
        long out_id = 0;
        if (aout != null) {
            out_id = aout.getID(mRS);
        }
        byte[] params = null;
        if (v != null) {
            params = v.getData();
        }
        mRS.nScriptForEach(getID(mRS), slot, in_id, out_id, params);
    
protected voidforEach(int slot, Allocation ain, Allocation aout, FieldPacker v, android.renderscript.Script$LaunchOptions sc)
Only intended for use by generated reflected code.

        mRS.validate();
        mRS.validateObject(ain);
        mRS.validateObject(aout);
        if (ain == null && aout == null) {
            throw new RSIllegalArgumentException(
                "At least one of ain or aout is required to be non-null.");
        }

        if (sc == null) {
            forEach(slot, ain, aout, v);
            return;
        }
        long in_id = 0;
        if (ain != null) {
            in_id = ain.getID(mRS);
        }
        long out_id = 0;
        if (aout != null) {
            out_id = aout.getID(mRS);
        }
        byte[] params = null;
        if (v != null) {
            params = v.getData();
        }
        mRS.nScriptForEachClipped(getID(mRS), slot, in_id, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
    
protected voidforEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v)
Only intended for use by generated reflected code.

hide

        forEach(slot, ains, aout, v, new LaunchOptions());
    
protected voidforEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v, android.renderscript.Script$LaunchOptions sc)
Only intended for use by generated reflected code.

hide

        mRS.validate();

        for (Allocation ain : ains) {
          mRS.validateObject(ain);
        }

        mRS.validateObject(aout);
        if (ains == null && aout == null) {
            throw new RSIllegalArgumentException(
                "At least one of ain or aout is required to be non-null.");
        }

        if (sc == null) {
            forEach(slot, ains, aout, v);
            return;
        }

        long[] in_ids = new long[ains.length];
        for (int index = 0; index < ains.length; ++index) {
            in_ids[index] = ains[index].getID(mRS);
        }

        long out_id = 0;
        if (aout != null) {
            out_id = aout.getID(mRS);
        }
        byte[] params = null;
        if (v != null) {
            params = v.getData();
        }
        mRS.nScriptForEachMultiClipped(getID(mRS), slot, in_ids, out_id, params, sc.xstart, sc.xend, sc.ystart, sc.yend, sc.zstart, sc.zend);
    
public booleangetVarB(int index)

        return mRS.nScriptGetVarI(getID(mRS), index) > 0 ? true : false;
    
public doublegetVarD(int index)

        return mRS.nScriptGetVarD(getID(mRS), index);
    
public floatgetVarF(int index)

        return mRS.nScriptGetVarF(getID(mRS), index);
    
public intgetVarI(int index)

        return mRS.nScriptGetVarI(getID(mRS), index);
    
public longgetVarJ(int index)

        return mRS.nScriptGetVarJ(getID(mRS), index);
    
public voidgetVarV(int index, FieldPacker v)
Only intended for use by generated reflected code.

        mRS.nScriptGetVarV(getID(mRS), index, v.getData());
    
protected voidinvoke(int slot)
Only intended for use by generated reflected code.

        mRS.nScriptInvoke(getID(mRS), slot);
    
protected voidinvoke(int slot, FieldPacker v)
Only intended for use by generated reflected code.

        if (v != null) {
            mRS.nScriptInvokeV(getID(mRS), slot, v.getData());
        } else {
            mRS.nScriptInvoke(getID(mRS), slot);
        }
    
public voidsetTimeZone(java.lang.String timeZone)

        mRS.validate();
        try {
            mRS.nScriptSetTimeZone(getID(mRS), timeZone.getBytes("UTF-8"));
        } catch (java.io.UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    
public voidsetVar(int index, float v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarF(getID(mRS), index, v);
    
public voidsetVar(int index, double v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarD(getID(mRS), index, v);
    
public voidsetVar(int index, int v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarI(getID(mRS), index, v);
    
public voidsetVar(int index, long v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarJ(getID(mRS), index, v);
    
public voidsetVar(int index, boolean v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarI(getID(mRS), index, v ? 1 : 0);
    
public voidsetVar(int index, BaseObj o)
Only intended for use by generated reflected code.

        mRS.validate();
        mRS.validateObject(o);
        mRS.nScriptSetVarObj(getID(mRS), index, (o == null) ? 0 : o.getID(mRS));
    
public voidsetVar(int index, FieldPacker v)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarV(getID(mRS), index, v.getData());
    
public voidsetVar(int index, FieldPacker v, Element e, int[] dims)
Only intended for use by generated reflected code.

        mRS.nScriptSetVarVE(getID(mRS), index, v.getData(), e.getID(mRS), dims);