FileDocCategorySizeDatePackage
RenderScript.javaAPI DocAndroid 5.1 API52423Thu Mar 12 22:22:42 GMT 2015android.renderscript

RenderScript

public class RenderScript extends Object
This class provides access to a RenderScript context, which controls RenderScript initialization, resource management, and teardown. An instance of the RenderScript class must be created before any other RS objects can be created.

Developer Guides

For more information about creating an application that uses RenderScript, read the RenderScript developer guide.

Fields Summary
static final long
TRACE_TAG
static final String
LOG_TAG
static final boolean
DEBUG
static final boolean
LOG_ENABLED
private android.content.Context
mApplicationContext
static boolean
sInitialized
static Object
sRuntime
static Method
registerNativeAllocation
static Method
registerNativeFree
public static final int
CREATE_FLAG_NONE
public static final int
CREATE_FLAG_LOW_LATENCY
public static final int
CREATE_FLAG_LOW_POWER
static int
sPointerSize
static File
mCacheDir
static final long
sMinorID
ContextType
mContextType
ReentrantReadWriteLock
mRWLock
long
mDev
long
mContext
MessageThread
mMessageThread
Element
mElement_U8
Element
mElement_I8
Element
mElement_U16
Element
mElement_I16
Element
mElement_U32
Element
mElement_I32
Element
mElement_U64
Element
mElement_I64
Element
mElement_F32
Element
mElement_F64
Element
mElement_BOOLEAN
Element
mElement_ELEMENT
Element
mElement_TYPE
Element
mElement_ALLOCATION
Element
mElement_SAMPLER
Element
mElement_SCRIPT
Element
mElement_MESH
Element
mElement_PROGRAM_FRAGMENT
Element
mElement_PROGRAM_VERTEX
Element
mElement_PROGRAM_RASTER
Element
mElement_PROGRAM_STORE
Element
mElement_FONT
Element
mElement_A_8
Element
mElement_RGB_565
Element
mElement_RGB_888
Element
mElement_RGBA_5551
Element
mElement_RGBA_4444
Element
mElement_RGBA_8888
Element
mElement_FLOAT_2
Element
mElement_FLOAT_3
Element
mElement_FLOAT_4
Element
mElement_DOUBLE_2
Element
mElement_DOUBLE_3
Element
mElement_DOUBLE_4
Element
mElement_UCHAR_2
Element
mElement_UCHAR_3
Element
mElement_UCHAR_4
Element
mElement_CHAR_2
Element
mElement_CHAR_3
Element
mElement_CHAR_4
Element
mElement_USHORT_2
Element
mElement_USHORT_3
Element
mElement_USHORT_4
Element
mElement_SHORT_2
Element
mElement_SHORT_3
Element
mElement_SHORT_4
Element
mElement_UINT_2
Element
mElement_UINT_3
Element
mElement_UINT_4
Element
mElement_INT_2
Element
mElement_INT_3
Element
mElement_INT_4
Element
mElement_ULONG_2
Element
mElement_ULONG_3
Element
mElement_ULONG_4
Element
mElement_LONG_2
Element
mElement_LONG_3
Element
mElement_LONG_4
Element
mElement_YUV
Element
mElement_MATRIX_4X4
Element
mElement_MATRIX_3X3
Element
mElement_MATRIX_2X2
Sampler
mSampler_CLAMP_NEAREST
Sampler
mSampler_CLAMP_LINEAR
Sampler
mSampler_CLAMP_LINEAR_MIP_LINEAR
Sampler
mSampler_WRAP_NEAREST
Sampler
mSampler_WRAP_LINEAR
Sampler
mSampler_WRAP_LINEAR_MIP_LINEAR
Sampler
mSampler_MIRRORED_REPEAT_NEAREST
Sampler
mSampler_MIRRORED_REPEAT_LINEAR
Sampler
mSampler_MIRRORED_REPEAT_LINEAR_MIP_LINEAR
ProgramStore
mProgramStore_BLEND_NONE_DEPTH_TEST
ProgramStore
mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH
ProgramStore
mProgramStore_BLEND_ALPHA_DEPTH_TEST
ProgramStore
mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH
ProgramRaster
mProgramRaster_CULL_BACK
ProgramRaster
mProgramRaster_CULL_FRONT
ProgramRaster
mProgramRaster_CULL_NONE
RSMessageHandler
mMessageCallback
If an application is expecting messages, it should set this field to an instance of {@link RSMessageHandler}. This instance will receive all the user messages sent from {@code sendToClient} by scripts from this context.
RSErrorHandler
mErrorCallback
Application Error handler. All runtime errors will be dispatched to the instance of RSAsyncError set here. If this field is null a {@link RSRuntimeException} will instead be thrown with details about the error. This will cause program termaination.
Constructors Summary
RenderScript(android.content.Context ctx)

        mContextType = ContextType.NORMAL;
        if (ctx != null) {
            mApplicationContext = ctx.getApplicationContext();
        }
        mRWLock = new ReentrantReadWriteLock();
        try {
            registerNativeAllocation.invoke(sRuntime, 4 * 1024 * 1024); // 4MB for GC sake
        } catch (Exception e) {
            Log.e(RenderScript.LOG_TAG, "Couldn't invoke registerNativeAllocation:" + e);
            throw new RSRuntimeException("Couldn't invoke registerNativeAllocation:" + e);
        }

    
Methods Summary
static native void_nInit()

public voidcontextDump()
Print the currently available debugging information about the state of the RS context to the log.

        validate();
        nContextDump(0);
    
public static android.renderscript.RenderScriptcreate(android.content.Context ctx, int sdkVersion)

hide

        return create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE);
    
public static android.renderscript.RenderScriptcreate(android.content.Context ctx, int sdkVersion, android.renderscript.RenderScript$ContextType ct, int flags)
Create a RenderScript context.

hide
param
ctx The context.
return
RenderScript

        if (!sInitialized) {
            Log.e(LOG_TAG, "RenderScript.create() called when disabled; someone is likely to crash");
            return null;
        }

        if ((flags & ~(CREATE_FLAG_LOW_LATENCY | CREATE_FLAG_LOW_POWER)) != 0) {
            throw new RSIllegalArgumentException("Invalid flags passed.");
        }

        RenderScript rs = new RenderScript(ctx);

        rs.mDev = rs.nDeviceCreate();
        rs.mContext = rs.nContextCreate(rs.mDev, flags, sdkVersion, ct.mID);
        rs.mContextType = ct;
        if (rs.mContext == 0) {
            throw new RSDriverException("Failed to create RS context.");
        }
        rs.mMessageThread = new MessageThread(rs);
        rs.mMessageThread.start();
        return rs;
    
public static android.renderscript.RenderScriptcreate(android.content.Context ctx)
Create a RenderScript context.

param
ctx The context.
return
RenderScript

        return create(ctx, ContextType.NORMAL);
    
public static android.renderscript.RenderScriptcreate(android.content.Context ctx, android.renderscript.RenderScript$ContextType ct)
Create a RenderScript context.

param
ctx The context.
param
ct The type of context to be created.
return
RenderScript

        int v = ctx.getApplicationInfo().targetSdkVersion;
        return create(ctx, v, ct, CREATE_FLAG_NONE);
    
public static android.renderscript.RenderScriptcreate(android.content.Context ctx, android.renderscript.RenderScript$ContextType ct, int flags)
Create a RenderScript context.

param
ctx The context.
param
ct The type of context to be created.
param
flags The OR of the CREATE_FLAG_* options desired
return
RenderScript

        int v = ctx.getApplicationInfo().targetSdkVersion;
        return create(ctx, v, ct, flags);
    
public voiddestroy()
Destroys this RenderScript context. Once this function is called, using this context or any objects belonging to this context is illegal.

        validate();
        nContextFinish();

        nContextDeinitToClient(mContext);
        mMessageThread.mRun = false;
        try {
            mMessageThread.join();
        } catch(InterruptedException e) {
        }

        nContextDestroy();

        nDeviceDestroy(mDev);
        mDev = 0;
    
public voidfinish()
Wait for any pending asynchronous opeations (such as copies to a RS allocation or RS script executions) to complete.

        nContextFinish();
    
public final android.content.ContextgetApplicationContext()
Gets the application context associated with the RenderScript context.

return
The application context.

        return mApplicationContext;
    
public android.renderscript.RenderScript$RSErrorHandlergetErrorHandler()

        return mErrorCallback;
    
public android.renderscript.RenderScript$RSMessageHandlergetMessageHandler()

        return mMessageCallback;
    
public static longgetMinorID()
Returns an identifier that can be used to identify a particular minor version of RS.

hide


                         
        
        return sMinorID;
    
booleanisAlive()

        return mContext != 0;
    
synchronized voidnAllocationCopyFromBitmap(long alloc, android.graphics.Bitmap bmp)

        validate();
        rsnAllocationCopyFromBitmap(mContext, alloc, bmp);
    
synchronized voidnAllocationCopyToBitmap(long alloc, android.graphics.Bitmap bmp)

        validate();
        rsnAllocationCopyToBitmap(mContext, alloc, bmp);
    
synchronized longnAllocationCreateBitmapBackedAllocation(long type, int mip, android.graphics.Bitmap bmp, int usage)

        validate();
        return rsnAllocationCreateBitmapBackedAllocation(mContext, type, mip, bmp, usage);
    
synchronized longnAllocationCreateBitmapRef(long type, android.graphics.Bitmap bmp)

        validate();
        return rsnAllocationCreateBitmapRef(mContext, type, bmp);
    
synchronized longnAllocationCreateFromAssetStream(int mips, int assetStream, int usage)

        validate();
        return rsnAllocationCreateFromAssetStream(mContext, mips, assetStream, usage);
    
synchronized longnAllocationCreateFromBitmap(long type, int mip, android.graphics.Bitmap bmp, int usage)

        validate();
        return rsnAllocationCreateFromBitmap(mContext, type, mip, bmp, usage);
    
synchronized longnAllocationCreateTyped(long type, int mip, int usage, long pointer)

        validate();
        return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer);
    
synchronized longnAllocationCubeCreateFromBitmap(long type, int mip, android.graphics.Bitmap bmp, int usage)

        validate();
        return rsnAllocationCubeCreateFromBitmap(mContext, type, mip, bmp, usage);
    
synchronized voidnAllocationData1D(long id, int off, int mip, int count, java.lang.Object d, int sizeBytes, Element.DataType dt)

        validate();
        rsnAllocationData1D(mContext, id, off, mip, count, d, sizeBytes, dt.mID);
    
synchronized voidnAllocationData2D(long id, int xoff, int yoff, int mip, int face, int w, int h, java.lang.Object d, int sizeBytes, Element.DataType dt)

        validate();
        rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes, dt.mID);
    
synchronized voidnAllocationData2D(long id, int xoff, int yoff, int mip, int face, android.graphics.Bitmap b)

        validate();
        rsnAllocationData2D(mContext, id, xoff, yoff, mip, face, b);
    
synchronized voidnAllocationData2D(long dstAlloc, int dstXoff, int dstYoff, int dstMip, int dstFace, int width, int height, long srcAlloc, int srcXoff, int srcYoff, int srcMip, int srcFace)

        validate();
        rsnAllocationData2D(mContext,
                            dstAlloc, dstXoff, dstYoff,
                            dstMip, dstFace,
                            width, height,
                            srcAlloc, srcXoff, srcYoff,
                            srcMip, srcFace);
    
synchronized voidnAllocationData3D(long dstAlloc, int dstXoff, int dstYoff, int dstZoff, int dstMip, int width, int height, int depth, long srcAlloc, int srcXoff, int srcYoff, int srcZoff, int srcMip)

        validate();
        rsnAllocationData3D(mContext,
                            dstAlloc, dstXoff, dstYoff, dstZoff,
                            dstMip, width, height, depth,
                            srcAlloc, srcXoff, srcYoff, srcZoff, srcMip);
    
synchronized voidnAllocationData3D(long id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, java.lang.Object d, int sizeBytes, Element.DataType dt)

        validate();
        rsnAllocationData3D(mContext, id, xoff, yoff, zoff, mip, w, h, depth, d, sizeBytes, dt.mID);
    
synchronized voidnAllocationElementData1D(long id, int xoff, int mip, int compIdx, byte[] d, int sizeBytes)

        validate();
        rsnAllocationElementData1D(mContext, id, xoff, mip, compIdx, d, sizeBytes);
    
synchronized voidnAllocationGenerateMipmaps(long alloc)

        validate();
        rsnAllocationGenerateMipmaps(mContext, alloc);
    
synchronized android.view.SurfacenAllocationGetSurface(long alloc)

        validate();
        return rsnAllocationGetSurface(mContext, alloc);
    
synchronized longnAllocationGetType(long id)

        validate();
        return rsnAllocationGetType(mContext, id);
    
synchronized voidnAllocationIoReceive(long alloc)

        validate();
        rsnAllocationIoReceive(mContext, alloc);
    
synchronized voidnAllocationIoSend(long alloc)

        validate();
        rsnAllocationIoSend(mContext, alloc);
    
synchronized voidnAllocationRead(long id, java.lang.Object d, Element.DataType dt)

        validate();
        rsnAllocationRead(mContext, id, d, dt.mID);
    
synchronized voidnAllocationRead1D(long id, int off, int mip, int count, java.lang.Object d, int sizeBytes, Element.DataType dt)

        validate();
        rsnAllocationRead1D(mContext, id, off, mip, count, d, sizeBytes, dt.mID);
    
synchronized voidnAllocationRead2D(long id, int xoff, int yoff, int mip, int face, int w, int h, java.lang.Object d, int sizeBytes, Element.DataType dt)

        validate();
        rsnAllocationRead2D(mContext, id, xoff, yoff, mip, face, w, h, d, sizeBytes, dt.mID);
    
synchronized voidnAllocationResize1D(long id, int dimX)

        validate();
        rsnAllocationResize1D(mContext, id, dimX);
    
synchronized voidnAllocationSetSurface(long alloc, android.view.Surface sur)

        validate();
        rsnAllocationSetSurface(mContext, alloc, sur);
    
synchronized voidnAllocationSyncAll(long alloc, int src)

        validate();
        rsnAllocationSyncAll(mContext, alloc, src);
    
synchronized voidnAssignName(long obj, byte[] name)

        validate();
        rsnAssignName(mContext, obj, name);
    
synchronized voidnContextBindProgramFragment(long pf)

        validate();
        rsnContextBindProgramFragment(mContext, pf);
    
synchronized voidnContextBindProgramRaster(long pr)

        validate();
        rsnContextBindProgramRaster(mContext, pr);
    
synchronized voidnContextBindProgramStore(long pfs)

        validate();
        rsnContextBindProgramStore(mContext, pfs);
    
synchronized voidnContextBindProgramVertex(long pv)

        validate();
        rsnContextBindProgramVertex(mContext, pv);
    
synchronized voidnContextBindRootScript(long script)

        validate();
        rsnContextBindRootScript(mContext, script);
    
synchronized voidnContextBindSampler(int sampler, int slot)

        validate();
        rsnContextBindSampler(mContext, sampler, slot);
    
synchronized longnContextCreate(long dev, int ver, int sdkVer, int contextType)

        return rsnContextCreate(dev, ver, sdkVer, contextType);
    
synchronized longnContextCreateGL(long dev, int ver, int sdkVer, int colorMin, int colorPref, int alphaMin, int alphaPref, int depthMin, int depthPref, int stencilMin, int stencilPref, int samplesMin, int samplesPref, float samplesQ, int dpi)

        return rsnContextCreateGL(dev, ver, sdkVer, colorMin, colorPref,
                                  alphaMin, alphaPref, depthMin, depthPref,
                                  stencilMin, stencilPref,
                                  samplesMin, samplesPref, samplesQ, dpi);
    
native voidnContextDeinitToClient(long con)

synchronized voidnContextDestroy()

        validate();

        // take teardown lock
        // teardown lock can only be taken when no objects are being destroyed
        ReentrantReadWriteLock.WriteLock wlock = mRWLock.writeLock();
        wlock.lock();

        long curCon = mContext;
        // context is considered dead as of this point
        mContext = 0;

        wlock.unlock();
        rsnContextDestroy(curCon);
    
synchronized voidnContextDump(int bits)

        validate();
        rsnContextDump(mContext, bits);
    
synchronized voidnContextFinish()

        validate();
        rsnContextFinish(mContext);
    
native java.lang.StringnContextGetErrorMessage(long con)

native intnContextGetUserMessage(long con, int[] data)

native voidnContextInitToClient(long con)

synchronized voidnContextPause()

        validate();
        rsnContextPause(mContext);
    
native intnContextPeekMessage(long con, int[] subID)

synchronized voidnContextResume()

        validate();
        rsnContextResume(mContext);
    
synchronized voidnContextSendMessage(int id, int[] data)

        validate();
        rsnContextSendMessage(mContext, id, data);
    
synchronized voidnContextSetPriority(int p)

        validate();
        rsnContextSetPriority(mContext, p);
    
synchronized voidnContextSetSurface(int w, int h, android.view.Surface sur)

        validate();
        rsnContextSetSurface(mContext, w, h, sur);
    
synchronized voidnContextSetSurfaceTexture(int w, int h, android.graphics.SurfaceTexture sur)

        validate();
        rsnContextSetSurfaceTexture(mContext, w, h, sur);
    
native longnDeviceCreate()

native voidnDeviceDestroy(long dev)

native voidnDeviceSetConfig(long dev, int param, int value)

synchronized longnElementCreate(long type, int kind, boolean norm, int vecSize)

        validate();
        return rsnElementCreate(mContext, type, kind, norm, vecSize);
    
synchronized longnElementCreate2(long[] elements, java.lang.String[] names, int[] arraySizes)

        validate();
        return rsnElementCreate2(mContext, elements, names, arraySizes);
    
synchronized voidnElementGetNativeData(long id, int[] elementData)

        validate();
        rsnElementGetNativeData(mContext, id, elementData);
    
synchronized voidnElementGetSubElements(long id, long[] IDs, java.lang.String[] names, int[] arraySizes)

        validate();
        rsnElementGetSubElements(mContext, id, IDs, names, arraySizes);
    
synchronized longnFileA3DCreateFromAsset(android.content.res.AssetManager mgr, java.lang.String path)

        validate();
        return rsnFileA3DCreateFromAsset(mContext, mgr, path);
    
synchronized longnFileA3DCreateFromAssetStream(long assetStream)

        validate();
        return rsnFileA3DCreateFromAssetStream(mContext, assetStream);
    
synchronized longnFileA3DCreateFromFile(java.lang.String path)

        validate();
        return rsnFileA3DCreateFromFile(mContext, path);
    
synchronized longnFileA3DGetEntryByIndex(long fileA3D, int index)

        validate();
        return rsnFileA3DGetEntryByIndex(mContext, fileA3D, index);
    
synchronized voidnFileA3DGetIndexEntries(long fileA3D, int numEntries, int[] IDs, java.lang.String[] names)

        validate();
        rsnFileA3DGetIndexEntries(mContext, fileA3D, numEntries, IDs, names);
    
synchronized intnFileA3DGetNumIndexEntries(long fileA3D)

        validate();
        return rsnFileA3DGetNumIndexEntries(mContext, fileA3D);
    
synchronized longnFontCreateFromAsset(android.content.res.AssetManager mgr, java.lang.String path, float size, int dpi)

        validate();
        return rsnFontCreateFromAsset(mContext, mgr, path, size, dpi);
    
synchronized longnFontCreateFromAssetStream(java.lang.String name, float size, int dpi, long assetStream)

        validate();
        return rsnFontCreateFromAssetStream(mContext, name, size, dpi, assetStream);
    
synchronized longnFontCreateFromFile(java.lang.String fileName, float size, int dpi)

        validate();
        return rsnFontCreateFromFile(mContext, fileName, size, dpi);
    
synchronized java.lang.StringnGetName(long obj)

        validate();
        return rsnGetName(mContext, obj);
    
synchronized longnMeshCreate(long[] vtx, long[] idx, int[] prim)

        validate();
        return rsnMeshCreate(mContext, vtx, idx, prim);
    
synchronized intnMeshGetIndexCount(long id)

        validate();
        return rsnMeshGetIndexCount(mContext, id);
    
synchronized voidnMeshGetIndices(long id, long[] idxIds, int[] primitives, int vtxIdCount)

        validate();
        rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount);
    
synchronized intnMeshGetVertexBufferCount(long id)

        validate();
        return rsnMeshGetVertexBufferCount(mContext, id);
    
synchronized voidnMeshGetVertices(long id, long[] vtxIds, int vtxIdCount)

        validate();
        rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount);
    
voidnObjDestroy(long id)

        // There is a race condition here.  The calling code may be run
        // by the gc while teardown is occuring.  This protects againts
        // deleting dead objects.
        if (mContext != 0) {
            rsnObjDestroy(mContext, id);
        }
    
synchronized longnPathCreate(int prim, boolean isStatic, long vtx, long loop, float q)

        validate();
        return rsnPathCreate(mContext, prim, isStatic, vtx, loop, q);
    
synchronized voidnProgramBindConstants(long pv, int slot, long mID)

        validate();
        rsnProgramBindConstants(mContext, pv, slot, mID);
    
synchronized voidnProgramBindSampler(long vpf, int slot, long s)

        validate();
        rsnProgramBindSampler(mContext, vpf, slot, s);
    
synchronized voidnProgramBindTexture(long vpf, int slot, long a)

        validate();
        rsnProgramBindTexture(mContext, vpf, slot, a);
    
synchronized longnProgramFragmentCreate(java.lang.String shader, java.lang.String[] texNames, long[] params)

        validate();
        return rsnProgramFragmentCreate(mContext, shader, texNames, params);
    
synchronized longnProgramRasterCreate(boolean pointSprite, int cullMode)

        validate();
        return rsnProgramRasterCreate(mContext, pointSprite, cullMode);
    
synchronized longnProgramStoreCreate(boolean r, boolean g, boolean b, boolean a, boolean depthMask, boolean dither, int srcMode, int dstMode, int depthFunc)

        validate();
        return rsnProgramStoreCreate(mContext, r, g, b, a, depthMask, dither, srcMode,
                                     dstMode, depthFunc);
    
synchronized longnProgramVertexCreate(java.lang.String shader, java.lang.String[] texNames, long[] params)

        validate();
        return rsnProgramVertexCreate(mContext, shader, texNames, params);
    
synchronized longnSamplerCreate(int magFilter, int minFilter, int wrapS, int wrapT, int wrapR, float aniso)

        validate();
        return rsnSamplerCreate(mContext, magFilter, minFilter, wrapS, wrapT, wrapR, aniso);
    
synchronized voidnScriptBindAllocation(long script, long alloc, int slot)

        validate();
        rsnScriptBindAllocation(mContext, script, alloc, slot);
    
synchronized longnScriptCCreate(java.lang.String resName, java.lang.String cacheDir, byte[] script, int length)

        validate();
        return rsnScriptCCreate(mContext, resName, cacheDir, script, length);
    
synchronized longnScriptFieldIDCreate(long sid, int slot)

        validate();
        return rsnScriptFieldIDCreate(mContext, sid, slot);
    
synchronized voidnScriptForEach(long id, int slot, long ain, long aout, byte[] params)

        validate();
        if (params == null) {
            rsnScriptForEach(mContext, id, slot, ain, aout);
        } else {
            rsnScriptForEach(mContext, id, slot, ain, aout, params);
        }
    
synchronized voidnScriptForEachClipped(long id, int slot, long ain, long aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend)

        validate();
        if (params == null) {
            rsnScriptForEachClipped(mContext, id, slot, ain, aout, xstart, xend, ystart, yend, zstart, zend);
        } else {
            rsnScriptForEachClipped(mContext, id, slot, ain, aout, params, xstart, xend, ystart, yend, zstart, zend);
        }
    
synchronized voidnScriptForEachMultiClipped(long id, int slot, long[] ains, long aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend)

        validate();
        if (params == null) {
            rsnScriptForEachMultiClipped(mContext, id, slot, ains, aout, xstart, xend, ystart, yend, zstart, zend);
        } else {
            rsnScriptForEachMultiClipped(mContext, id, slot, ains, aout, params, xstart, xend, ystart, yend, zstart, zend);
        }
    
synchronized doublenScriptGetVarD(long id, int slot)

        validate();
        return rsnScriptGetVarD(mContext, id, slot);
    
synchronized floatnScriptGetVarF(long id, int slot)

        validate();
        return rsnScriptGetVarF(mContext, id, slot);
    
synchronized intnScriptGetVarI(long id, int slot)

        validate();
        return rsnScriptGetVarI(mContext, id, slot);
    
synchronized longnScriptGetVarJ(long id, int slot)

        validate();
        return rsnScriptGetVarJ(mContext, id, slot);
    
synchronized voidnScriptGetVarV(long id, int slot, byte[] val)

        validate();
        rsnScriptGetVarV(mContext, id, slot, val);
    
synchronized longnScriptGroupCreate(long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types)

        validate();
        return rsnScriptGroupCreate(mContext, kernels, src, dstk, dstf, types);
    
synchronized voidnScriptGroupExecute(long group)

        validate();
        rsnScriptGroupExecute(mContext, group);
    
synchronized voidnScriptGroupSetInput(long group, long kernel, long alloc)

        validate();
        rsnScriptGroupSetInput(mContext, group, kernel, alloc);
    
synchronized voidnScriptGroupSetOutput(long group, long kernel, long alloc)

        validate();
        rsnScriptGroupSetOutput(mContext, group, kernel, alloc);
    
synchronized longnScriptIntrinsicCreate(int id, long eid)

        validate();
        return rsnScriptIntrinsicCreate(mContext, id, eid);
    
synchronized voidnScriptInvoke(long id, int slot)

        validate();
        rsnScriptInvoke(mContext, id, slot);
    
synchronized voidnScriptInvokeV(long id, int slot, byte[] params)

        validate();
        rsnScriptInvokeV(mContext, id, slot, params);
    
synchronized longnScriptKernelIDCreate(long sid, int slot, int sig)

        validate();
        return rsnScriptKernelIDCreate(mContext, sid, slot, sig);
    
synchronized voidnScriptSetTimeZone(long script, byte[] timeZone)

        validate();
        rsnScriptSetTimeZone(mContext, script, timeZone);
    
synchronized voidnScriptSetVarD(long id, int slot, double val)

        validate();
        rsnScriptSetVarD(mContext, id, slot, val);
    
synchronized voidnScriptSetVarF(long id, int slot, float val)

        validate();
        rsnScriptSetVarF(mContext, id, slot, val);
    
synchronized voidnScriptSetVarI(long id, int slot, int val)

        validate();
        rsnScriptSetVarI(mContext, id, slot, val);
    
synchronized voidnScriptSetVarJ(long id, int slot, long val)

        validate();
        rsnScriptSetVarJ(mContext, id, slot, val);
    
synchronized voidnScriptSetVarObj(long id, int slot, long val)

        validate();
        rsnScriptSetVarObj(mContext, id, slot, val);
    
synchronized voidnScriptSetVarV(long id, int slot, byte[] val)

        validate();
        rsnScriptSetVarV(mContext, id, slot, val);
    
synchronized voidnScriptSetVarVE(long id, int slot, byte[] val, long e, int[] dims)

        validate();
        rsnScriptSetVarVE(mContext, id, slot, val, e, dims);
    
synchronized longnTypeCreate(long eid, int x, int y, int z, boolean mips, boolean faces, int yuv)

        validate();
        return rsnTypeCreate(mContext, eid, x, y, z, mips, faces, yuv);
    
synchronized voidnTypeGetNativeData(long id, long[] typeData)

        validate();
        rsnTypeGetNativeData(mContext, id, typeData);
    
native voidrsnAllocationCopyFromBitmap(long con, long alloc, android.graphics.Bitmap bmp)

native voidrsnAllocationCopyToBitmap(long con, long alloc, android.graphics.Bitmap bmp)

native longrsnAllocationCreateBitmapBackedAllocation(long con, long type, int mip, android.graphics.Bitmap bmp, int usage)

native longrsnAllocationCreateBitmapRef(long con, long type, android.graphics.Bitmap bmp)

native longrsnAllocationCreateFromAssetStream(long con, int mips, int assetStream, int usage)

native longrsnAllocationCreateFromBitmap(long con, long type, int mip, android.graphics.Bitmap bmp, int usage)

native longrsnAllocationCreateTyped(long con, long type, int mip, int usage, long pointer)

native longrsnAllocationCubeCreateFromBitmap(long con, long type, int mip, android.graphics.Bitmap bmp, int usage)

native voidrsnAllocationData1D(long con, long id, int off, int mip, int count, java.lang.Object d, int sizeBytes, int dt)

native voidrsnAllocationData2D(long con, long id, int xoff, int yoff, int mip, int face, android.graphics.Bitmap b)

native voidrsnAllocationData2D(long con, long dstAlloc, int dstXoff, int dstYoff, int dstMip, int dstFace, int width, int height, long srcAlloc, int srcXoff, int srcYoff, int srcMip, int srcFace)

native voidrsnAllocationData2D(long con, long id, int xoff, int yoff, int mip, int face, int w, int h, java.lang.Object d, int sizeBytes, int dt)

native voidrsnAllocationData3D(long con, long dstAlloc, int dstXoff, int dstYoff, int dstZoff, int dstMip, int width, int height, int depth, long srcAlloc, int srcXoff, int srcYoff, int srcZoff, int srcMip)

native voidrsnAllocationData3D(long con, long id, int xoff, int yoff, int zoff, int mip, int w, int h, int depth, java.lang.Object d, int sizeBytes, int dt)

native voidrsnAllocationElementData1D(long con, long id, int xoff, int mip, int compIdx, byte[] d, int sizeBytes)

native voidrsnAllocationGenerateMipmaps(long con, long alloc)

native android.view.SurfacersnAllocationGetSurface(long con, long alloc)

native longrsnAllocationGetType(long con, long id)

native voidrsnAllocationIoReceive(long con, long alloc)

native voidrsnAllocationIoSend(long con, long alloc)

native voidrsnAllocationRead(long con, long id, java.lang.Object d, int dt)

native voidrsnAllocationRead1D(long con, long id, int off, int mip, int count, java.lang.Object d, int sizeBytes, int dt)

native voidrsnAllocationRead2D(long con, long id, int xoff, int yoff, int mip, int face, int w, int h, java.lang.Object d, int sizeBytes, int dt)

native voidrsnAllocationResize1D(long con, long id, int dimX)

native voidrsnAllocationSetSurface(long con, long alloc, android.view.Surface sur)

native voidrsnAllocationSyncAll(long con, long alloc, int src)

native voidrsnAssignName(long con, long obj, byte[] name)

native voidrsnContextBindProgramFragment(long con, long pf)

native voidrsnContextBindProgramRaster(long con, long pr)

native voidrsnContextBindProgramStore(long con, long pfs)

native voidrsnContextBindProgramVertex(long con, long pv)

native voidrsnContextBindRootScript(long con, long script)

native voidrsnContextBindSampler(long con, int sampler, int slot)

native longrsnContextCreate(long dev, int ver, int sdkVer, int contextType)

native longrsnContextCreateGL(long dev, int ver, int sdkVer, int colorMin, int colorPref, int alphaMin, int alphaPref, int depthMin, int depthPref, int stencilMin, int stencilPref, int samplesMin, int samplesPref, float samplesQ, int dpi)

native voidrsnContextDestroy(long con)

native voidrsnContextDump(long con, int bits)

native voidrsnContextFinish(long con)

native voidrsnContextPause(long con)

native voidrsnContextResume(long con)

native voidrsnContextSendMessage(long con, int id, int[] data)

native voidrsnContextSetPriority(long con, int p)

native voidrsnContextSetSurface(long con, int w, int h, android.view.Surface sur)

native voidrsnContextSetSurfaceTexture(long con, int w, int h, android.graphics.SurfaceTexture sur)

native longrsnElementCreate(long con, long type, int kind, boolean norm, int vecSize)

native longrsnElementCreate2(long con, long[] elements, java.lang.String[] names, int[] arraySizes)

native voidrsnElementGetNativeData(long con, long id, int[] elementData)

native voidrsnElementGetSubElements(long con, long id, long[] IDs, java.lang.String[] names, int[] arraySizes)

native longrsnFileA3DCreateFromAsset(long con, android.content.res.AssetManager mgr, java.lang.String path)

native longrsnFileA3DCreateFromAssetStream(long con, long assetStream)

native longrsnFileA3DCreateFromFile(long con, java.lang.String path)

native longrsnFileA3DGetEntryByIndex(long con, long fileA3D, int index)

native voidrsnFileA3DGetIndexEntries(long con, long fileA3D, int numEntries, int[] IDs, java.lang.String[] names)

native intrsnFileA3DGetNumIndexEntries(long con, long fileA3D)

native longrsnFontCreateFromAsset(long con, android.content.res.AssetManager mgr, java.lang.String path, float size, int dpi)

native longrsnFontCreateFromAssetStream(long con, java.lang.String name, float size, int dpi, long assetStream)

native longrsnFontCreateFromFile(long con, java.lang.String fileName, float size, int dpi)

native java.lang.StringrsnGetName(long con, long obj)

native longrsnMeshCreate(long con, long[] vtx, long[] idx, int[] prim)

native intrsnMeshGetIndexCount(long con, long id)

native voidrsnMeshGetIndices(long con, long id, long[] idxIds, int[] primitives, int vtxIdCount)

native intrsnMeshGetVertexBufferCount(long con, long id)

native voidrsnMeshGetVertices(long con, long id, long[] vtxIds, int vtxIdCount)

native voidrsnObjDestroy(long con, long id)

native longrsnPathCreate(long con, int prim, boolean isStatic, long vtx, long loop, float q)

native voidrsnProgramBindConstants(long con, long pv, int slot, long mID)

native voidrsnProgramBindSampler(long con, long vpf, int slot, long s)

native voidrsnProgramBindTexture(long con, long vpf, int slot, long a)

native longrsnProgramFragmentCreate(long con, java.lang.String shader, java.lang.String[] texNames, long[] params)

native longrsnProgramRasterCreate(long con, boolean pointSprite, int cullMode)

native longrsnProgramStoreCreate(long con, boolean r, boolean g, boolean b, boolean a, boolean depthMask, boolean dither, int srcMode, int dstMode, int depthFunc)

native longrsnProgramVertexCreate(long con, java.lang.String shader, java.lang.String[] texNames, long[] params)

native longrsnSamplerCreate(long con, int magFilter, int minFilter, int wrapS, int wrapT, int wrapR, float aniso)

native voidrsnScriptBindAllocation(long con, long script, long alloc, int slot)

native longrsnScriptCCreate(long con, java.lang.String resName, java.lang.String cacheDir, byte[] script, int length)

native longrsnScriptFieldIDCreate(long con, long sid, int slot)

native voidrsnScriptForEach(long con, long id, int slot, long ain, long aout, byte[] params)

native voidrsnScriptForEach(long con, long id, int slot, long ain, long aout)

native voidrsnScriptForEachClipped(long con, long id, int slot, long ain, long aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend)

native voidrsnScriptForEachClipped(long con, long id, int slot, long ain, long aout, int xstart, int xend, int ystart, int yend, int zstart, int zend)

native voidrsnScriptForEachMultiClipped(long con, long id, int slot, long[] ains, long aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend)
Multi-input code.

native voidrsnScriptForEachMultiClipped(long con, long id, int slot, long[] ains, long aout, int xstart, int xend, int ystart, int yend, int zstart, int zend)

native doublersnScriptGetVarD(long con, long id, int slot)

native floatrsnScriptGetVarF(long con, long id, int slot)

native intrsnScriptGetVarI(long con, long id, int slot)

native longrsnScriptGetVarJ(long con, long id, int slot)

native voidrsnScriptGetVarV(long con, long id, int slot, byte[] val)

native longrsnScriptGroupCreate(long con, long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types)

native voidrsnScriptGroupExecute(long con, long group)

native voidrsnScriptGroupSetInput(long con, long group, long kernel, long alloc)

native voidrsnScriptGroupSetOutput(long con, long group, long kernel, long alloc)

native longrsnScriptIntrinsicCreate(long con, int id, long eid)

native voidrsnScriptInvoke(long con, long id, int slot)

native voidrsnScriptInvokeV(long con, long id, int slot, byte[] params)

native longrsnScriptKernelIDCreate(long con, long sid, int slot, int sig)

native voidrsnScriptSetTimeZone(long con, long script, byte[] timeZone)

native voidrsnScriptSetVarD(long con, long id, int slot, double val)

native voidrsnScriptSetVarF(long con, long id, int slot, float val)

native voidrsnScriptSetVarI(long con, long id, int slot, int val)

native voidrsnScriptSetVarJ(long con, long id, int slot, long val)

native voidrsnScriptSetVarObj(long con, long id, int slot, long val)

native voidrsnScriptSetVarV(long con, long id, int slot, byte[] val)

native voidrsnScriptSetVarVE(long con, long id, int slot, byte[] val, long e, int[] dims)

static native intrsnSystemGetPointerSize()

native longrsnTypeCreate(long con, long eid, int x, int y, int z, boolean mips, boolean faces, int yuv)

native voidrsnTypeGetNativeData(long con, long id, long[] typeData)

longsafeID(BaseObj o)

        if(o != null) {
            return o.getID(this);
        }
        return 0;
    
public voidsendMessage(int id, int[] data)
Place a message into the message queue to be sent back to the message handler once all previous commands have been executed.

param
id
param
data

        nContextSendMessage(id, data);
    
public voidsetErrorHandler(android.renderscript.RenderScript$RSErrorHandler msg)


        
        mErrorCallback = msg;
    
public voidsetMessageHandler(android.renderscript.RenderScript$RSMessageHandler msg)


        
        mMessageCallback = msg;
    
public voidsetPriority(android.renderscript.RenderScript$Priority p)
Change the priority of the worker threads for this context.

param
p New priority to be set.

        validate();
        nContextSetPriority(p.mID);
    
public static voidsetupDiskCache(java.io.File cacheDir)
Sets the directory to use as a persistent storage for the renderscript object file cache.

hide
param
cacheDir A directory the current process can write to

        if (!sInitialized) {
            Log.e(LOG_TAG, "RenderScript.setupDiskCache() called when disabled");
            return;
        }

        // Defer creation of cache path to nScriptCCreate().
        mCacheDir = cacheDir;
    
voidvalidate()

        if (mContext == 0) {
            throw new RSInvalidStateException("Calling RS with no Context active.");
        }
    
voidvalidateObject(BaseObj o)

        if (o != null) {
            if (o.mRS != this) {
                throw new RSIllegalArgumentException("Attempting to use an object across contexts.");
            }
        }