コード例 #1
0
  /** Applies blur to current off-screen bitmap */
  public void applyBlur() {
    // Copy current bitmap into allocation
    mAllocationBitmap.copyFrom(mBitmap);

    // Set script variables
    mScriptStackBlur.bind_dv(mAllocationDv);
    mScriptStackBlur.set_bitmap(mAllocationBitmap);
    mScriptStackBlur.set_bitmapTmp(mAllocationBitmapTmp);
    mScriptStackBlur.set_sizeStruct(mSizeStruct);
    mScriptStackBlur.set_radiusStruct(mRadiusStruct);

    // On first step iterate over y = [0, mBitmap.getHeight]
    mLaunchOptions.setX(0, 1);
    mLaunchOptions.setY(0, mBitmap.getHeight());
    mScriptStackBlur.forEach_blurHorizontal(mAllocationBitmap, mLaunchOptions);

    // On second step iterate over x = [0, mBitmap.getWidth]
    mLaunchOptions.setX(0, mBitmap.getWidth());
    mLaunchOptions.setY(0, 1);
    mScriptStackBlur.forEach_blurVertical(mAllocationBitmap, mLaunchOptions);

    // Copy bitmap allocation back to off-screen bitmap
    mAllocationBitmap.copyTo(mBitmap);
  }
コード例 #2
0
ファイル: NiceTabStrip.java プロジェクト: Efunbukola/app
 protected void blur() {
   mBlurInput.copyFrom(mBitmapToBlur);
   mBlurScript.setInput(mBlurInput);
   mBlurScript.forEach(mBlurOutput);
   mBlurOutput.copyTo(mBlurredBitmap);
 }