FileDocCategorySizeDatePackage
Blur25.javaAPI DocAndroid 5.1 API3726Thu Mar 12 22:22:54 GMT 2015com.android.rs.image

Blur25

public class Blur25 extends TestBase

Fields Summary
private boolean
mUseIntrinsic
private android.renderscript.ScriptIntrinsicBlur
mIntrinsic
private int
MAX_RADIUS
private ScriptC_threshold
mScript
private float
mRadius
private float
mSaturation
private android.renderscript.Allocation
mScratchPixelsAllocation1
private android.renderscript.Allocation
mScratchPixelsAllocation2
Constructors Summary
public Blur25(boolean useIntrinsic)



       
        mUseIntrinsic = useIntrinsic;
    
Methods Summary
public voidcreateTest(android.content.res.Resources res)

        int width = mInPixelsAllocation.getType().getX();
        int height = mInPixelsAllocation.getType().getY();

        if (mUseIntrinsic) {
            mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS));
            mIntrinsic.setRadius(MAX_RADIUS);
            mIntrinsic.setInput(mInPixelsAllocation);
        } else {

            Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS));
            tb.setX(width);
            tb.setY(height);
            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
            mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());

            mScript = new ScriptC_threshold(mRS);
            mScript.set_width(width);
            mScript.set_height(height);
            mScript.invoke_setRadius(MAX_RADIUS);

            mScript.set_InPixel(mInPixelsAllocation);
            mScript.set_ScratchPixel1(mScratchPixelsAllocation1);
            mScript.set_ScratchPixel2(mScratchPixelsAllocation2);
        }
    
public voidexitBenchmark()

        if (mUseIntrinsic) {
            mIntrinsic.setRadius(mRadius);
        } else {
            mScript.invoke_setRadius((int)mRadius);
        }
    
public voidonBar1Changed(int progress)

        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
        if (mRadius <= 0.10f) {
            mRadius = 0.10f;
        }
        if (mUseIntrinsic) {
            mIntrinsic.setRadius(mRadius);
        } else {
            mScript.invoke_setRadius((int)mRadius);
        }
    
public booleanonBar1Setup(android.widget.SeekBar b, android.widget.TextView t)

        t.setText("Radius");
        b.setProgress(100);
        return true;
    
public voidrunTest()

        if (mUseIntrinsic) {
            mIntrinsic.forEach(mOutPixelsAllocation);
        } else {
            mScript.forEach_copyIn(mInPixelsAllocation, mScratchPixelsAllocation1);
            mScript.forEach_horz(mScratchPixelsAllocation2);
            mScript.forEach_vert(mOutPixelsAllocation);
        }
    
public voidsetupBenchmark()

        if (mUseIntrinsic) {
            mIntrinsic.setRadius(MAX_RADIUS);
        } else {
            mScript.invoke_setRadius(MAX_RADIUS);
        }