Scriptpublic 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 |
Methods Summary |
---|
public void | bindAllocation(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$FieldID | createFieldID(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$KernelID | createKernelID(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 void | forEach(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 void | forEach(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 void | forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v)Only intended for use by generated reflected code.
forEach(slot, ains, aout, v, new LaunchOptions());
| protected void | forEach(int slot, Allocation[] ains, Allocation aout, FieldPacker v, android.renderscript.Script$LaunchOptions sc)Only intended for use by generated reflected code.
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 boolean | getVarB(int index)
return mRS.nScriptGetVarI(getID(mRS), index) > 0 ? true : false;
| public double | getVarD(int index)
return mRS.nScriptGetVarD(getID(mRS), index);
| public float | getVarF(int index)
return mRS.nScriptGetVarF(getID(mRS), index);
| public int | getVarI(int index)
return mRS.nScriptGetVarI(getID(mRS), index);
| public long | getVarJ(int index)
return mRS.nScriptGetVarJ(getID(mRS), index);
| public void | getVarV(int index, FieldPacker v)Only intended for use by generated reflected code.
mRS.nScriptGetVarV(getID(mRS), index, v.getData());
| protected void | invoke(int slot)Only intended for use by generated reflected code.
mRS.nScriptInvoke(getID(mRS), slot);
| protected void | invoke(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 void | setTimeZone(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 void | setVar(int index, float v)Only intended for use by generated reflected code.
mRS.nScriptSetVarF(getID(mRS), index, v);
| public void | setVar(int index, double v)Only intended for use by generated reflected code.
mRS.nScriptSetVarD(getID(mRS), index, v);
| public void | setVar(int index, int v)Only intended for use by generated reflected code.
mRS.nScriptSetVarI(getID(mRS), index, v);
| public void | setVar(int index, long v)Only intended for use by generated reflected code.
mRS.nScriptSetVarJ(getID(mRS), index, v);
| public void | setVar(int index, boolean v)Only intended for use by generated reflected code.
mRS.nScriptSetVarI(getID(mRS), index, v ? 1 : 0);
| public void | setVar(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 void | setVar(int index, FieldPacker v)Only intended for use by generated reflected code.
mRS.nScriptSetVarV(getID(mRS), index, v.getData());
| public void | setVar(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);
|
|