FileDocCategorySizeDatePackage
ScriptIntrinsic3DLUT.javaAPI DocAndroid 5.1 API3278Thu Mar 12 22:22:42 GMT 2015android.renderscript

ScriptIntrinsic3DLUT

public final 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.

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

        super(id, rs);
        mElement = e;
    
Methods Summary
public static android.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

        long 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(ain, aout, null);
    
public voidforEach(Allocation ain, Allocation aout, Script.LaunchOptions opt)
Invoke the kernel and apply the lookup to each cell of ain and copy to aout.

param
ain Input allocation
param
aout Output allocation
param
opt Launch options for kernel

        forEach(0, ain, aout, null, opt);
    
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.renderscript.Allocation} to be used as the lookup table. The lookup table must use the same {@link android.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);