Code example for Allocation

Methods: copyTo

0
        if (mAllocationOut != null) {
            mAllocationOut.destroy();
        } 
 
        android.util.Log.v("cpa", "reset " + width + ", " + height);
        mHeight = height;
        mWidth = width;
        mScript.invoke_setSize(mWidth, mHeight);
 
        Type.Builder tb = new Type.Builder(mRS, Element.RGBA_8888(mRS));
        tb.setX(mWidth);
        tb.setY(mHeight);
        Type t = tb.create(); 
        mAllocationOut = Allocation.createTyped(mRS, t, Allocation.USAGE_SCRIPT |
                                                        Allocation.USAGE_IO_OUTPUT);
 
 
        tb = new Type.Builder(mRS, Element.createPixel(mRS, Element.DataType.UNSIGNED_8, Element.DataKind.PIXEL_YUV));
        tb.setX(mWidth);
        tb.setY(mHeight);
        tb.setYuvFormat(android.graphics.ImageFormat.NV21);