當前位置: 首頁>>代碼示例>>Java>>正文


Java BlurMaskFilter類代碼示例

本文整理匯總了Java中android.graphics.BlurMaskFilter的典型用法代碼示例。如果您正苦於以下問題:Java BlurMaskFilter類的具體用法?Java BlurMaskFilter怎麽用?Java BlurMaskFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BlurMaskFilter類屬於android.graphics包,在下文中一共展示了BlurMaskFilter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initAnimation

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
private void initAnimation() {
    paint.setStrokeWidth(getHeight() * 0.01f);
    paint.setAntiAlias(true);
    paint.setDither(true);
    paint.setColor(Color.argb(248, 255, 255, 255));
    paint.setStrokeWidth(20f);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeJoin(Paint.Join.ROUND);
    paint.setStrokeCap(Paint.Cap.ROUND);

    paintGlow.set(paint);
    paintGlow.setColor(Color.argb(235, 74, 138, 255));
    paintGlow.setStrokeWidth(30f);
    paintGlow.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.NORMAL));

    float deltaY = (CameraOverlayView.PADDING * 2) * getHeight();
    Log.i(TAG, String.format("Delta Y : %s", deltaY));

    TranslateAnimation mAnimation = new TranslateAnimation(0f, 0f, 0f, deltaY);
    mAnimation.setDuration(3000);
    mAnimation.setRepeatCount(-1);
    mAnimation.setRepeatMode(Animation.REVERSE);
    mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    setAnimation(mAnimation);
}
 
開發者ID:jorenham,項目名稱:fingerblox,代碼行數:26,代碼來源:ScannerOverlayView.java

示例2: init

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public void init() {

        mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mBackgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        mBackgroundPaint.setColor(mBackgroudColor);

        mFocusPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mFocusPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        mFocusPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        if (mBlurRadius > 0)
            mFocusPaint.setMaskFilter(new BlurMaskFilter(mBlurRadius, BlurMaskFilter.Blur.NORMAL));

        setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

        if (mTipsView == null && mTipsViewResId != 0)
            mTipsView = LayoutInflater.from(mContext).inflate(mTipsViewResId, this, false);

        addView(mTipsView);
        setVisibility(View.GONE);
        setBackgroundColor(Color.TRANSPARENT);

        mTargetView.getViewTreeObserver().addOnGlobalLayoutListener(this);
    }
 
開發者ID:arjinmc,項目名稱:Android-GuideView,代碼行數:25,代碼來源:GuideView.java

示例3: drawImageDropShadow

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
/**
 *圖片陰影
 * @param originalBitmap
 */
public static Drawable drawImageDropShadow(Bitmap originalBitmap, Context context) {

    BlurMaskFilter blurFilter = new BlurMaskFilter(3,BlurMaskFilter.Blur.NORMAL);
    Paint shadowPaint = new Paint();
    shadowPaint.setAlpha(80);
    shadowPaint.setColor(context.getResources().getColor(R.color.black));
    shadowPaint.setMaskFilter(blurFilter);
    int[] offsetXY = new int[2];
    Bitmap shadowBitmap = originalBitmap.extractAlpha(shadowPaint, offsetXY);
    Bitmap shadowImage32 = shadowBitmap.copy(Bitmap.Config.ARGB_8888, true);
    if ( !shadowImage32.isPremultiplied() )
    {
        shadowImage32.setPremultiplied( true );
    }
    Canvas c = new Canvas(shadowImage32);
    c.drawBitmap(originalBitmap, offsetXY[0], offsetXY[1], null);
    return new BitmapDrawable(shadowImage32);
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:23,代碼來源:ImageTools.java

示例4: RenderThread

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
RenderThread(Context context, SurfaceHolder mSurfaceHolder) {
    this.mSurfaceHolder = mSurfaceHolder;

    SharedPreferences preferences =
            PreferenceManager.getDefaultSharedPreferences(context);

    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();

    mUniverse = new UniverseBuilder()
            .setPreferences(preferences)
            .setHeight(displayMetrics.heightPixels)
            .setWidth(displayMetrics.widthPixels)
            .create();
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPath = new Path();
    mBlurFilter = new BlurMaskFilter(mUniverse.getStarGlowSize(), BlurMaskFilter.Blur.SOLID);
}
 
開發者ID:catalinc,項目名稱:stars-daydream-android,代碼行數:19,代碼來源:RenderThread.java

示例5: setPaintMaskFilter

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public void setPaintMaskFilter(int mode) {
    switch (mode) {
        case UsoppBubble.MODE_NONE:
            break;
        case UsoppBubble.MODE_GLOW:
            mDataBean.mFilter = new BlurMaskFilter(10, BlurMaskFilter.Blur.OUTER);
            break;
        case UsoppBubble.MODE_EMBOSS:
            float[] direction = new float[]{10, 10, 10};
            float ambient = 0.5f;
            float specular = 1;
            float blurRadius = 1;
            mDataBean.mFilter = new EmbossMaskFilter(direction, ambient, specular, blurRadius);
            break;
    }
    mDataBean.mPaint.setMaskFilter(mDataBean.mFilter);
}
 
開發者ID:halohoop,項目名稱:UsoppBubble,代碼行數:18,代碼來源:UsoppFrameLayout.java

示例6: drawShadow

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
/**
 *  為指定圖片增加陰影
 *
 * @param map     圖片
 * @param radius  陰影的半徑
 * @return bitmap
 */
public static Bitmap drawShadow(Bitmap map, int radius) {
    if (map == null)
        return null;

    BlurMaskFilter blurFilter = new BlurMaskFilter(radius, BlurMaskFilter.Blur.OUTER);
    Paint shadowPaint = new Paint();
    shadowPaint.setMaskFilter(blurFilter);

    int[] offsetXY = new int[2];
    Bitmap shadowImage = map.extractAlpha(shadowPaint, offsetXY);
    shadowImage = shadowImage.copy(Bitmap.Config.ARGB_8888, true);
    Canvas c = new Canvas(shadowImage);
    c.drawBitmap(map, -offsetXY[0], -offsetXY[1], null);
    return shadowImage;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:23,代碼來源:BmpUtil.java

示例7: onSizeChanged

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
@Override
  protected synchronized void onSizeChanged(int width, int height, int old_width, int old_height) {
  	super.onSizeChanged(width, height, old_width, old_height);
  	if ((width == 0) || (height == 0)) return;
  	// paddingを考慮してマスク用のDrawableのサイズを計算
  	final int padding_left = getPaddingLeft();
  	final int padding_top = getPaddingTop();
  	final int sz = Math.min(width - padding_left - getPaddingRight(), height - padding_top - getPaddingBottom());
final int left =  (width - sz) / 2 + padding_left;
final int top = (height - sz) / 2 + padding_top;
mMaskBounds.set(left, top, left + sz, top + sz);
if (sz > 3) {
	mMaskedPaint.setMaskFilter(new BlurMaskFilter(sz * 2 / 3.0f, BlurMaskFilter.Blur.NORMAL));
}

      // View自體のサイズはそのまま
mViewBoundsF.set(0, 0, width, height);
      if (mMaskDrawable != null) {
	mMaskDrawable.setBounds(mMaskBounds);
}
  }
 
開發者ID:saki4510t,項目名稱:libcommon,代碼行數:22,代碼來源:MaskImageView.java

示例8: doHighlightImage

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public Bitmap doHighlightImage(Bitmap originalImage, int radius, @ColorInt int highlightColor) {
  Bitmap resultingBitmap =
      Bitmap.createBitmap(originalImage.getWidth() + 96, originalImage.getHeight() + 96,
          Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(resultingBitmap);
  canvas.drawColor(0, PorterDuff.Mode.CLEAR);
  Paint paintBlur = new Paint();
  paintBlur.setMaskFilter(new BlurMaskFilter(radius, BlurMaskFilter.Blur.NORMAL));
  int[] offsetXY = new int[2];
  Bitmap bitmapAlpha = originalImage.extractAlpha(paintBlur, offsetXY);
  Paint paintAlphaColor = new Paint();
  paintAlphaColor.setColor(highlightColor);
  canvas.drawBitmap(bitmapAlpha, offsetXY[0], offsetXY[1], paintAlphaColor);
  bitmapAlpha.recycle();
  canvas.drawBitmap(originalImage, 0, 0, null);
  return resultingBitmap;
}
 
開發者ID:mukeshsolanki,項目名稱:photofilter,代碼行數:18,代碼來源:ImageProcessor.java

示例9: HolographicOutlineHelper

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
private HolographicOutlineHelper(Context context) {
    Resources res = context.getResources();

    float mediumBlur = res.getDimension(R.dimen.blur_size_medium_outline);
    mMediumOuterBlurMaskFilter = new BlurMaskFilter(mediumBlur, BlurMaskFilter.Blur.OUTER);
    mMediumInnerBlurMaskFilter = new BlurMaskFilter(mediumBlur, BlurMaskFilter.Blur.NORMAL);

    mThinOuterBlurMaskFilter = new BlurMaskFilter(
            res.getDimension(R.dimen.blur_size_thin_outline), BlurMaskFilter.Blur.OUTER);

    mShadowBlurMaskFilter = new BlurMaskFilter(
            res.getDimension(R.dimen.blur_size_click_shadow), BlurMaskFilter.Blur.NORMAL);

    mDrawPaint.setFilterBitmap(true);
    mDrawPaint.setAntiAlias(true);
    mBlurPaint.setFilterBitmap(true);
    mBlurPaint.setAntiAlias(true);
    mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
    mErasePaint.setFilterBitmap(true);
    mErasePaint.setAntiAlias(true);
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:22,代碼來源:HolographicOutlineHelper.java

示例10: getDropShadow

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
/**
 * 可以對該圖的非透明區域著色
 * <p>
 * 有多種使用場景,常見如 Button 的 pressed 狀態,View 的陰影狀態等
 *
 * @param iv
 * @param src
 * @param radius
 * @param color
 * @return
 */
private static Bitmap getDropShadow(ImageView iv, Bitmap src, float radius, int color) {

    final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(color);

    final int width = src.getWidth(), height = src.getHeight();
    final Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(dest);
    final Bitmap alpha = src.extractAlpha();
    canvas.drawBitmap(alpha, 0, 0, paint);

    final BlurMaskFilter filter = new BlurMaskFilter(radius, BlurMaskFilter.Blur.OUTER);
    paint.setMaskFilter(filter);
    canvas.drawBitmap(alpha, 0, 0, paint);
    iv.setImageBitmap(dest);

    return dest;
}
 
開發者ID:vondear,項目名稱:RxTools,代碼行數:30,代碼來源:RxImageTool.java

示例11: GuideDrawable

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public GuideDrawable(float x, float y, float w, float h) {
  float density = getResources().getDisplayMetrics().density;

  mClipPath = new Path();
  mClipPath.addRect(x, y, x + w, y + h, Path.Direction.CW);

  mBorderPath = new Path();
  mBorderPath.addRect(x - density, y - density, x + w + density, y + h + density, Path.Direction.CW);

  mShadowPath = new Path();
  mShadowPath.addRect(x - 3 * density, y - 3 * density, x + w + 3 * density, y + h + 3 * density, Path.Direction.CW);

  mScale = new RectF(x + w / 2, y + h / 2, 1 + 8 * density / w, 1 + 8 * density / h);

  mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaint.setColor(getResources().getColor(R.color.state_button_light));

  mPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaint2.setColor(getResources().getColor(R.color.state_button_light_alpha));
  mPaint2.setMaskFilter(new BlurMaskFilter(density * 3, BlurMaskFilter.Blur.NORMAL));
}
 
開發者ID:sunnygoyal,項目名稱:PowerToggles,代碼行數:22,代碼來源:ConfigGuide.java

示例12: setFairyImage

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
private void setFairyImage() {
    boolean glow_available = fairy_glow_on && getBooleanPreferences(getApplicationContext(), PREF_KCA_NOTI_QUEST_FAIRY_GLOW);
    Bitmap src = BitmapFactory.decodeResource(getResources(), viewBitmapId);
    Bitmap alpha = src.extractAlpha();
    Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin,
            src.getHeight() + margin, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bmp);
    if (glow_available) {
        Paint glow_paint = new Paint();
        glow_paint.setColor(glowColor);
        glow_paint.setMaskFilter(new BlurMaskFilter(glowRadius, BlurMaskFilter.Blur.OUTER));
        canvas.drawBitmap(alpha, halfMargin, halfMargin, glow_paint);
    }
    Paint color_paint = new Paint();
    if (taiha_status) {
        color_paint.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(getApplicationContext(),
                R.color.colorHeavyDmgStateWarn), PorterDuff.Mode.MULTIPLY));
    } else if (glow_available) {
        color_paint.setColorFilter(new PorterDuffColorFilter(glowColor2, PorterDuff.Mode.MULTIPLY));
    }
    canvas.drawBitmap(src, halfMargin, halfMargin, color_paint);
    viewbutton.setImageBitmap(bmp);
}
 
開發者ID:antest1,項目名稱:kcanotify,代碼行數:24,代碼來源:KcaViewButtonService.java

示例13: setWithEffects

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public void setWithEffects(boolean withEffects) {
    this.withEffects = withEffects;
    if (isInEditMode())
        return;
    indicatorEffects(withEffects);
    if (withEffects) {
        rayPaint.setMaskFilter(new BlurMaskFilter(3, BlurMaskFilter.Blur.SOLID));
        activeMarkPaint.setMaskFilter(new BlurMaskFilter(5, BlurMaskFilter.Blur.SOLID));
        speedBackgroundPaint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.SOLID));
    }
    else {
        rayPaint.setMaskFilter(null);
        activeMarkPaint.setMaskFilter(null);
        speedBackgroundPaint.setMaskFilter(null);
    }
    updateBackgroundBitmap();
    invalidate();
}
 
開發者ID:anastr,項目名稱:SpeedView,代碼行數:19,代碼來源:RaySpeedometer.java

示例14: setWithEffects

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
public void setWithEffects(boolean withEffects) {
    this.withEffects = withEffects;
    if (isInEditMode())
        return;
    indicatorEffects(withEffects);
    if (withEffects) {
        markPaint.setMaskFilter(new BlurMaskFilter(5, BlurMaskFilter.Blur.SOLID));
        speedBackgroundPaint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.SOLID));
        circlePaint.setMaskFilter(new BlurMaskFilter(10, BlurMaskFilter.Blur.SOLID));
    }
    else {
        markPaint.setMaskFilter(null);
        speedBackgroundPaint.setMaskFilter(null);
        circlePaint.setMaskFilter(null);
    }
    updateBackgroundBitmap();
    invalidate();
}
 
開發者ID:anastr,項目名稱:SpeedView,代碼行數:19,代碼來源:DeluxeSpeedView.java

示例15: initStatics

import android.graphics.BlurMaskFilter; //導入依賴的package包/類
private static void initStatics(Context context) {
    final Resources resources = context.getResources();
    final DisplayMetrics metrics = resources.getDisplayMetrics();
    final float density = metrics.density;

    sIconWidth = sIconHeight = (int) resources.getDimension(android.R.dimen.app_icon_size);
    sIconTextureWidth = sIconTextureHeight = sIconWidth;
    sBlurPaint.setMaskFilter(new BlurMaskFilter(5 * density, BlurMaskFilter.Blur.NORMAL));
    sGlowColorPressedPaint.setColor(0xffffc300);
    sGlowColorFocusedPaint.setColor(0xffff8e00);

    ColorMatrix cm = new ColorMatrix();
    cm.setSaturation(0.2f);
    sDisabledPaint.setColorFilter(new ColorMatrixColorFilter(cm));
    sDisabledPaint.setAlpha(0x88);
}
 
開發者ID:k0shk0sh,項目名稱:NewKam,代碼行數:17,代碼來源:IconCache.java


注:本文中的android.graphics.BlurMaskFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。