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

Histogram

public class Histogram extends TestBase

Fields Summary
private ScriptC_histogram
mScript
private ScriptIntrinsicHistogram
mHist
private Allocation
mSum
private Allocation
mSums
Constructors Summary
Methods Summary
public voidcreateTest(android.content.res.Resources res)

        mScript = new ScriptC_histogram(mRS);
        mHist = ScriptIntrinsicHistogram.create(mRS, Element.U8_4(mRS));

        int w = mInPixelsAllocation.getType().getX();
        int h = mInPixelsAllocation.getType().getY();
        int step = 8;
        int steps = (h + step - 1) / step;

        mScript.set_gWidth(w);
        mScript.set_gHeight(h);
        mScript.set_gStep(step);
        mScript.set_gSteps(steps);

        Type.Builder tb = new Type.Builder(mRS, Element.I32(mRS));
        tb.setX(256).setY(steps);
        Type t = tb.create();
        mSums = Allocation.createTyped(mRS, t);
        mSum = Allocation.createSized(mRS, Element.I32(mRS), 256);

        mScript.set_gSums(mSums);
        mScript.set_gSum(mSum);
        mScript.set_gSrc(mInPixelsAllocation);
        mScript.set_gDest(mOutPixelsAllocation);

        mScript.forEach_clear(mOutPixelsAllocation);
    
public voidrunTest()

        Script.LaunchOptions lo = new Script.LaunchOptions();
        lo.setX(0, 1);
        //mScript.forEach_pass1(mSums, lo);
        //mScript.forEach_pass2(mSum);

        mHist.setOutput(mSum);
        mHist.forEach_Dot(mInPixelsAllocation);

        mScript.invoke_rescale();

        lo.setX(0, 1024);
        mScript.forEach_draw(mOutPixelsAllocation, lo);