FileDocCategorySizeDatePackage
ProgramStore.javaAPI DocAndroid 5.1 API13912Thu Mar 12 22:22:42 GMT 2015android.renderscript

ProgramStore

public class ProgramStore extends BaseObj
hide

ProgramStore contains a set of parameters that control how the graphics hardware handles writes to the framebuffer. It could be used to:

  • enable/disable depth testing
  • specify wheather depth writes are performed
  • setup various blending modes for use in effects like transparency
  • define write masks for color components written into the framebuffer

Fields Summary
DepthFunc
mDepthFunc
boolean
mDepthMask
boolean
mColorMaskR
boolean
mColorMaskG
boolean
mColorMaskB
boolean
mColorMaskA
BlendSrcFunc
mBlendSrc
BlendDstFunc
mBlendDst
boolean
mDither
Constructors Summary
ProgramStore(long id, RenderScript rs)

        super(id, rs);
    
Methods Summary
public static android.renderscript.ProgramStoreBLEND_ALPHA_DEPTH_NONE(RenderScript rs)
Returns a pre-defined program store object with the following characteristics: - incoming pixels always pass the depth test and their value is not stored in the depth buffer - incoming pixel's value is combined with the stored color (Dest) using the following formula Final.RGB = Source.RGB * Source.A + Dest.RGB * (1 - Source.A)

param
rs Context to which the program will belong.

        if(rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH == null) {
            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
            builder.setDitherEnabled(false);
            builder.setDepthMaskEnabled(false);
            rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH = builder.create();
        }
        return rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH;
    
public static android.renderscript.ProgramStoreBLEND_ALPHA_DEPTH_TEST(RenderScript rs)
Returns a pre-defined program store object with the following characteristics: - incoming pixels are drawn if their depth value is less than the stored value in the depth buffer. If the pixel is drawn, its value is also stored in the depth buffer - if the incoming (Source) pixel passes depth test, its value is combined with the stored color (Dest) using the following formula Final.RGB = Source.RGB * Source.A + Dest.RGB * (1 - Source.A)

param
rs Context to which the program will belong.

        if(rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST == null) {
            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
            builder.setDitherEnabled(false);
            builder.setDepthMaskEnabled(true);
            rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST = builder.create();
        }
        return rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST;
    
public static android.renderscript.ProgramStoreBLEND_NONE_DEPTH_NONE(RenderScript rs)
Returns a pre-defined program store object with the following characteristics: - incoming pixels always pass the depth test and their value is not stored in the depth buffer - incoming pixels override the value stored in the color buffer

param
rs Context to which the program will belong.

        if(rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH == null) {
            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
            builder.setDitherEnabled(false);
            builder.setDepthMaskEnabled(false);
            rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH = builder.create();
        }
        return rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH;
    
public static android.renderscript.ProgramStoreBLEND_NONE_DEPTH_TEST(RenderScript rs)
Returns a pre-defined program store object with the following characteristics: - incoming pixels are drawn if their depth value is less than the stored value in the depth buffer. If the pixel is drawn, its value is also stored in the depth buffer - incoming pixels override the value stored in the color buffer if it passes the depth test

param
rs Context to which the program will belong.

        if(rs.mProgramStore_BLEND_NONE_DEPTH_TEST == null) {
            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
            builder.setDitherEnabled(false);
            builder.setDepthMaskEnabled(true);
            rs.mProgramStore_BLEND_NONE_DEPTH_TEST = builder.create();
        }
        return rs.mProgramStore_BLEND_NONE_DEPTH_TEST;
    
public android.renderscript.ProgramStore$BlendDstFuncgetBlendDstFunc()
Specifies how the destination blending factor is computed

return
destination blend function

        return mBlendDst;
    
public android.renderscript.ProgramStore$BlendSrcFuncgetBlendSrcFunc()
Specifies how the source blending factor is computed

return
source blend function

        return mBlendSrc;
    
public android.renderscript.ProgramStore$DepthFuncgetDepthFunc()
Returns the function used to test writing into the depth buffer

return
depth function

        return mDepthFunc;
    
public booleanisColorMaskAlphaEnabled()
Queries whether alpha channel is written

return
alpha channel mask

        return mColorMaskA;
    
public booleanisColorMaskBlueEnabled()
Queries whether blue channel is written

return
blue color channel mask

        return mColorMaskB;
    
public booleanisColorMaskGreenEnabled()
Queries whether green channel is written

return
green color channel mask

        return mColorMaskG;
    
public booleanisColorMaskRedEnabled()
Queries whether red channel is written

return
red color channel mask

        return mColorMaskR;
    
public booleanisDepthMaskEnabled()
Queries whether writes are enabled into the depth buffer

return
depth mask

        return mDepthMask;
    
public booleanisDitherEnabled()
Specifies whether colors are dithered before writing into the framebuffer

return
whether dither is enabled

        return mDither;