FileDocCategorySizeDatePackage
ScriptIntrinsic3DLUT.javaAPI DocAndroid 5.1 API3155Thu Mar 12 22:22:56 GMT 2015android.support.v8.renderscript

ScriptIntrinsic3DLUT

public class ScriptIntrinsic3DLUT extends ScriptIntrinsic
Intrinsic for converting RGB to RGBA by using a 3D lookup table. The incoming r,g,b values are use as normalized x,y,z coordinates into a 3D allocation. The 8 nearest values are sampled and linearly interpolated. The result is placed in the output.
hide

Fields Summary
private Allocation
mLUT
private Element
mElement
Constructors Summary
protected ScriptIntrinsic3DLUT(int id, RenderScript rs, Element e)

        super(id, rs);
        mElement = e;
    
Methods Summary
public static android.support.v8.renderscript.ScriptIntrinsic3DLUTcreate(RenderScript rs, Element e)
Supported elements types are {@link Element#U8_4} The defaults tables are identity.

param
rs The RenderScript context
param
e Element type for intputs and outputs
return
ScriptIntrinsic3DLUT

        if (rs.isNative) {
            RenderScriptThunker rst = (RenderScriptThunker) rs;
            return ScriptIntrinsic3DLUTThunker.create(rs, e);
        }
        int id = rs.nScriptIntrinsicCreate(8, e.getID(rs));

        if (!e.isCompatible(Element.U8_4(rs))) {
            throw new RSIllegalArgumentException("Element must be compatible with uchar4.");
        }

        return new ScriptIntrinsic3DLUT(id, rs, e);
    
public voidforEach(Allocation ain, Allocation aout)
Invoke the kernel and apply the lookup to each cell of ain and copy to aout.

param
ain Input allocation
param
aout Output allocation

        forEach(0, ain, aout, null);
    
public Script.KernelIDgetKernelID()
Get a KernelID for this intrinsic kernel.

return
Script.KernelID The KernelID object.

        return createKernelID(0, 3, null, null);
    
public voidsetLUT(Allocation lut)
Sets the {@link android.support.v8.renderscript.Allocation} to be used as the lookup table. The lookup table must use the same {@link android.support.v8.renderscript.Element} as the intrinsic.

        final Type t = lut.getType();

        if (t.getZ() == 0) {
            throw new RSIllegalArgumentException("LUT must be 3d.");
        }

        if (!t.getElement().isCompatible(mElement)) {
            throw new RSIllegalArgumentException("LUT element type must match.");
        }

        mLUT = lut;
        setVar(0, mLUT);