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

Blur25G

public class Blur25G extends TestBase

Fields Summary
private final int
MAX_RADIUS
private float
mRadius
private android.renderscript.ScriptIntrinsicBlur
mIntrinsic
private android.renderscript.ScriptIntrinsicColorMatrix
mCM
private android.renderscript.Allocation
mScratchPixelsAllocation1
private android.renderscript.Allocation
mScratchPixelsAllocation2
Constructors Summary
public Blur25G()



      
    
Methods Summary
public voidcreateTest(android.content.res.Resources res)

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

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

        mCM = ScriptIntrinsicColorMatrix.create(mRS);
        mCM.forEach(mInPixelsAllocation, mScratchPixelsAllocation1);

        mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8(mRS));
        mIntrinsic.setRadius(MAX_RADIUS);
        mIntrinsic.setInput(mScratchPixelsAllocation1);
    
public voidexitBenchmark()

        mIntrinsic.setRadius(mRadius);
    
public voidonBar1Changed(int progress)

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

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

        mIntrinsic.forEach(mScratchPixelsAllocation2);
    
public voidsetupBenchmark()

        mIntrinsic.setRadius(MAX_RADIUS);
    
public voidupdateBitmap(android.graphics.Bitmap b)

        Matrix4f m = new Matrix4f();
        m.set(0, 0, 1.f);
        m.set(0, 1, 1.f);
        m.set(0, 2, 1.f);

        m.set(1, 1, 0.f);
        m.set(2, 2, 0.f);
        m.set(3, 3, 0.f);
        mCM.setColorMatrix(m);
        mCM.setAdd(0.f, 0.f, 0.f, 1.f);

        mCM.forEach(mScratchPixelsAllocation2, mOutPixelsAllocation);
        mOutPixelsAllocation.copyTo(b);