当前位置: 首页>>代码示例>>Java>>正文


Java Blur类代码示例

本文整理汇总了Java中android.graphics.BlurMaskFilter.Blur的典型用法代码示例。如果您正苦于以下问题:Java Blur类的具体用法?Java Blur怎么用?Java Blur使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Blur类属于android.graphics.BlurMaskFilter包,在下文中一共展示了Blur类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ShadowGenerator

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
private ShadowGenerator() {
    mIconSize = LauncherAppState.getInstance().getInvariantDeviceProfile().iconBitmapSize;
    mCanvas = new Canvas();
    mBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
    mBlurPaint.setMaskFilter(new BlurMaskFilter(mIconSize * BLUR_FACTOR, Blur.NORMAL));
    mDrawPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:8,代码来源:ShadowGenerator.java

示例2: ShadowGenerator

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
private ShadowGenerator(Context context) {
    mIconSize = LauncherAppState.getIDP(context).iconBitmapSize;
    mCanvas = new Canvas();
    mBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
    mBlurPaint.setMaskFilter(new BlurMaskFilter(mIconSize * BLUR_FACTOR, Blur.NORMAL));
    mDrawPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:8,代码来源:ShadowGenerator.java

示例3: createPillWithShadow

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
public static Bitmap createPillWithShadow(int rectColor, int width, int height) {

        float shadowRadius = height * 1f / 32;
        float shadowYOffset = height * 1f / 16;

        int radius = height / 2;

        Canvas canvas = new Canvas();
        Paint blurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
        blurPaint.setMaskFilter(new BlurMaskFilter(shadowRadius, Blur.NORMAL));

        int centerX = Math.round(width / 2 + shadowRadius);
        int centerY = Math.round(radius + shadowRadius + shadowYOffset);
        int center = Math.max(centerX, centerY);
        int size = center * 2;
        Bitmap result = Bitmap.createBitmap(size, size, Config.ARGB_8888);
        canvas.setBitmap(result);

        int left = center - width / 2;
        int top = center - height / 2;
        int right = center + width / 2;
        int bottom = center + height / 2;

        // Draw ambient shadow, center aligned within size
        blurPaint.setAlpha(AMBIENT_SHADOW_ALPHA);
        canvas.drawRoundRect(left, top, right, bottom, radius, radius, blurPaint);

        // Draw key shadow, bottom aligned within size
        blurPaint.setAlpha(KEY_SHADOW_ALPHA);
        canvas.drawRoundRect(left, top + shadowYOffset, right, bottom + shadowYOffset,
                radius, radius, blurPaint);

        // Draw the circle
        Paint drawPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
        drawPaint.setColor(rectColor);
        canvas.drawRoundRect(left, top, right, bottom, radius, radius, drawPaint);

        return result;
    }
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:40,代码来源:ShadowGenerator.java

示例4: init

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
/**
 * Called by the constructors - sets up the drawing parameters for the drop shadow.
 */
private void init() {
    mShadowPaint.setColor(Color.BLACK);
    mShadowPaint.setStyle(Style.FILL);
    setWillNotDraw(false);
    mShadowBitmap = Bitmap.createBitmap(sShadowRect.width(),
            sShadowRect.height(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(mShadowBitmap);
    mShadowPaint.setMaskFilter(new BlurMaskFilter(BLUR_RADIUS, Blur.NORMAL));
    c.translate(BLUR_RADIUS, BLUR_RADIUS);
    c.drawRoundRect(sShadowRectF, sShadowRectF.width() / 40,
            sShadowRectF.height() / 40, mShadowPaint);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:16,代码来源:ShadowLayout.java

示例5: init

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
private void init() {
    this.mPaint = new Paint();
    this.mPaint.setDither(true);
    this.mPaint.setAntiAlias(true);
    if (this.isBlur) {
        this.mPaint.setMaskFilter(new BlurMaskFilter(15.0f, Blur.SOLID));
    }
    this.mPaint.setStyle(Style.FILL);
    addViewForTip();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:HightLightView.java

示例6: dropShadow

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
public static Bitmap dropShadow(Bitmap src) {
	if (src == null)
		return null;
	
	try {
		// Parameters
		int verticalPadding = 10;
		int horizontalPadding = 10;
		int radius = 3;
		int color = 0x44000000;
		
		// Create result bitmap
		Bitmap bmOut = Bitmap.createBitmap(src.getWidth() + horizontalPadding, src.getHeight() + verticalPadding, Bitmap.Config.ARGB_8888);
		Canvas canvas = new Canvas(bmOut);
		canvas.drawColor(0, PorterDuff.Mode.CLEAR);
		Paint ptBlur = new Paint();
		ptBlur.setMaskFilter(new BlurMaskFilter(radius, Blur.OUTER));
		int[] offsetXY = new int[2];
		// Capture alpha into a bitmap
		Bitmap bmAlpha = src.extractAlpha(ptBlur, offsetXY);
		Paint ptAlphaColor = new Paint();
		ptAlphaColor.setColor(color);
		canvas.drawBitmap(bmAlpha, 0, 0, ptAlphaColor);
		bmAlpha.recycle();
		// Paint image source
		canvas.drawBitmap(src, radius, radius, null);
		return bmOut;
	} catch (Exception ex) {
		return src;
	}
}
 
开发者ID:chteuchteu,项目名称:Munin-for-Android,代码行数:32,代码来源:Util.java

示例7: TextSeekBarDrawable

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
public TextSeekBarDrawable(Resources res, int id, boolean labelOnRight) {
	mText = res.getString(id);
	mProgress = res.getDrawable(android.R.drawable.progress_horizontal);
	mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mPaint.setTypeface(Typeface.DEFAULT_BOLD);
	mPaint.setTextSize(16);
	mPaint.setColor(0xff000000);
	mOutlinePaint = new Paint(mPaint);
	mOutlinePaint.setStyle(Style.STROKE);
	mOutlinePaint.setStrokeWidth(3);
	mOutlinePaint.setColor(0xbbffc300);
	mOutlinePaint.setMaskFilter(new BlurMaskFilter(1, Blur.NORMAL));
	mTextWidth = mOutlinePaint.measureText(mText);
	mTextXScale = labelOnRight? 1 : 0;
	mAnimation = new ScrollAnimation();
}
 
开发者ID:gskbyte,项目名称:kora,代码行数:17,代码来源:ColorDialog.java

示例8: initPaints

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
/** 
 * @brief Prepare the Paints for later user in the onDraw() method.
 * 
 * Note that this method peform also some other basic initializations, such
 * as computing some sizes in a device-independent way and initializing
 * some String formatter. 
 * 
 *  As a rule of thumb, every expensive operation that does not need to
 *  be performed on every onDraw() call should be called here. 
 */
private void initPaints() {
	axisFormat = new DecimalFormat("#.#E0");
	
	// Compute a Device independent point size
	pointSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
			4, getResources().getDisplayMetrics());
	
	// ...and in the same spirit get a device independent width for the
	// ticks that we will draw on the axis. 
	tickWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
			3, getResources().getDisplayMetrics());
	
	// Paint used for the X and Y axis. 
	axisPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	axisPaint.setColor(
			getResources().getColor(R.color.rootsRendererView_axis));
	axisPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
			12, getResources().getDisplayMetrics()));
	
	// Paint used for the points of the plot
	pointsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	pointsPaint.setColor(
			getResources().getColor(R.color.rootsRendererView_points));
	pointsPaint.setStyle(Style.FILL_AND_STROKE);
	pointsPaint.setMaskFilter(new BlurMaskFilter(2, Blur.INNER));
	
	// Paint similar to the above, but used for points marked
	// in the Approximation list. 
	markedPointsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	markedPointsPaint.setColor(
			getResources().getColor(R.color.rootsRendererView_MarkedPoints));
	markedPointsPaint.setStyle(Style.FILL_AND_STROKE);
	markedPointsPaint.setMaskFilter(new BlurMaskFilter (2, Blur.INNER));
}
 
开发者ID:robol,项目名称:MPSolveForAndroid,代码行数:45,代码来源:RootsRendererView.java

示例9: init

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
/**
 * Called by the constructors - sets up the drawing parameters for the drop shadow.
 */
private void init() {
  mShadowPaint.setColor(Color.BLACK);
  mShadowPaint.setStyle(Style.FILL);
  setWillNotDraw(false);
  mShadowBitmap =
      Bitmap.createBitmap(sShadowRect.width(), sShadowRect.height(), Bitmap.Config.ARGB_8888);
  Canvas c = new Canvas(mShadowBitmap);
  mShadowPaint.setMaskFilter(new BlurMaskFilter(BLUR_RADIUS, Blur.NORMAL));
  c.translate(BLUR_RADIUS, BLUR_RADIUS);
  c.drawRoundRect(sShadowRectF, sShadowRectF.width() / 40, sShadowRectF.height() / 40,
      mShadowPaint);
}
 
开发者ID:f2prateek,项目名称:android-couchpotato,代码行数:16,代码来源:ShadowLayout.java

示例10: getGlow

import android.graphics.BlurMaskFilter.Blur; //导入依赖的package包/类
/**
 * Returns a glowed image of the provided icon. If the
 * provided name is already in the cache, the cached image
 * will be returned. Otherwise, the bitmap will be glowed and
 * cached under the provided name
 *
 * @param name The name of the bitmap - if name == null dont cache
 * @param src  The bitmap of the icon itself
 * @return Glowed bitmap
 */
public Bitmap getGlow(String name, int glowColor, Bitmap src) {
    if (name != null && mGlowCache.containsKey(name)) {
        return mGlowCache.get(name);
    } else {
        // An added margin to the initial image
        int margin = 0;
        int halfMargin = margin / 2;

        // The glow radius
        int glowRadius = 12;

        // Extract the alpha from the source image
        Bitmap alpha = src.extractAlpha();

        // The output bitmap (with the icon + glow)
        Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin,
                src.getHeight() + margin, Bitmap.Config.ARGB_8888);

        // The canvas to paint on the image
        Canvas canvas = new Canvas(bmp);

        Paint paint = new Paint();
        paint.setColor(glowColor);

        // Outer glow
        ColorFilter emphasize = new LightingColorFilter(glowColor, 1);
        paint.setColorFilter(emphasize);
        canvas.drawBitmap(src, halfMargin, halfMargin, paint);
        paint.setColorFilter(null);
        paint.setMaskFilter(new BlurMaskFilter(glowRadius, Blur.OUTER));
        canvas.drawBitmap(alpha, halfMargin, halfMargin, paint);

        if(name!=null){
            // Cache icon
            mGlowCache.put(name, bmp);
        }

        return bmp;
    }
}
 
开发者ID:EatHeat,项目名称:OmniSnitch,代码行数:51,代码来源:BitmapFilter.java


注:本文中的android.graphics.BlurMaskFilter.Blur类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。