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


Java Paint.setFilterBitmap方法代码示例

本文整理汇总了Java中android.graphics.Paint.setFilterBitmap方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.setFilterBitmap方法的具体用法?Java Paint.setFilterBitmap怎么用?Java Paint.setFilterBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


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

示例1: setBackground

import android.graphics.Paint; //导入方法依赖的package包/类
public static void setBackground(View v, Bitmap bm) {

        if (bm == null) {
            v.setBackgroundResource(0);
            return;
        }

        int vwidth = v.getWidth()/4;
        int vheight = v.getHeight()/4;
        int bwidth = bm.getWidth();
        int bheight = bm.getHeight();
        float scalex = (float) vwidth / bwidth;
        float scaley = (float) vheight / bheight;
        float scale = Math.max(scalex, scaley) * 1.3f;

        Bitmap.Config config = Bitmap.Config.ARGB_8888;
        Bitmap bg = Bitmap.createBitmap(vwidth, vheight, config);
        Canvas c = new Canvas(bg);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setFilterBitmap(true);
        ColorMatrix greymatrix = new ColorMatrix();
        greymatrix.setSaturation(0);
        ColorMatrix darkmatrix = new ColorMatrix();
        darkmatrix.setScale(1f, 1f, 1f, .1f);
        greymatrix.postConcat(darkmatrix);
        ColorFilter filter = new ColorMatrixColorFilter(greymatrix);
        paint.setColorFilter(filter);
        Matrix matrix = new Matrix();
        matrix.setTranslate(-bwidth/2, -bheight/2); // move bitmap center to origin
        matrix.postRotate(10);
        matrix.postScale(scale, scale);
        matrix.postTranslate(vwidth/2, vheight/2);  // Move bitmap center to view center
        c.drawBitmap(bm, matrix, paint);
        v.setBackgroundDrawable(new BitmapDrawable(bg));
    }
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:37,代码来源:Utils.java

示例2: render

import android.graphics.Paint; //导入方法依赖的package包/类
public void render(Canvas canvas) {
  Rect dest = new Rect(0, 0, getWidth(), getHeight());
  Paint paint = new Paint();
  paint.setFilterBitmap(true);
  if (canvas != null) {
    canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.background1), null, dest, paint);
  }
  if (goodBubble != null) {
    goodBubble.draw(canvas);
  }
  if (heart != null) {
    heart.draw(canvas);
  }
  if (poisonBubble != null) {
    poisonBubble.draw(canvas);
  }
}
 
开发者ID:UshalNaidoo,项目名称:Android-Bubble-Game,代码行数:18,代码来源:GameScene.java

示例3: initBaseZoomableImageView

import android.graphics.Paint; //导入方法依赖的package包/类
@SuppressLint("NewApi")
protected void initBaseZoomableImageView( Context context) {
	mPaint = new Paint();
	mPaint.setDither(true);
	mPaint.setFilterBitmap(true);
	mPaint.setAntiAlias(true);
	if(context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
		landscape = true;
	}else {
		landscape = false;
	}
	// Setup the refresh runnable
	mRefresh = new Runnable() {
		@Override
		public void run() {
			postInvalidate();
		}
	};		
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:20,代码来源:BaseZoomableImageView.java

示例4: getCroppedBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
public static Bitmap getCroppedBitmap(Bitmap bmp, int radius) {
    Bitmap sbmp;
    if(bmp.getWidth() != radius || bmp.getHeight() != radius)
        sbmp = Bitmap.createScaledBitmap(bmp, radius, radius, false);
    else
        sbmp = bmp;
    Bitmap output = Bitmap.createBitmap(sbmp.getWidth(),
            sbmp.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    final int color = 0xffa19774;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, sbmp.getWidth(), sbmp.getHeight());

    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(Color.parseColor("#BAB399"));
    canvas.drawCircle(sbmp.getWidth() / 2 + 0.7f, sbmp.getHeight() / 2 + 0.7f,
            sbmp.getWidth() / 2+0.1f, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(sbmp, rect, rect, paint);

    return output;
}
 
开发者ID:gaurav414u,项目名称:android-ripple-pulse-animation,代码行数:27,代码来源:RoundedImageView.java

示例5: BaseRecyclerViewFastScrollPopup

import android.graphics.Paint; //导入方法依赖的package包/类
public BaseRecyclerViewFastScrollPopup(BaseRecyclerView rv, Resources res) {
    mRes = res;
    mRv = rv;

    mBgOriginalSize = res.getDimensionPixelSize(R.dimen.container_fastscroll_popup_size);
    mBg = rv.getContext().getDrawable(R.drawable.container_fastscroll_popup_bg);
    mBg.setBounds(0, 0, mBgOriginalSize, mBgOriginalSize);

    mTextPaint = new Paint();
    mTextPaint.setColor(Color.WHITE);
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(res.getDimensionPixelSize(R.dimen.container_fastscroll_popup_text_size));

    mShadowPaint = new Paint();
    mShadowPaint.setAntiAlias(true);
    mShadowPaint.setFilterBitmap(true);
    mShadowPaint.setDither(true);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:19,代码来源:BaseRecyclerViewFastScrollPopup.java

示例6: createCircularFramedImage

import android.graphics.Paint; //导入方法依赖的package包/类
public Bitmap createCircularFramedImage(int size, int color) {

        Paint background = createBackground(color);

        // create empty bitmap and canvas
        Bitmap outputImage = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
        Canvas imageCanvas = new Canvas(outputImage);

        // draw circular background
        float cx = size / 2;
        float cy = size / 2;
        float radius = size / 2;
        imageCanvas.drawCircle(cx, cy, radius, background);

        // draw input image onto canvas using transformation matrix
        Paint paint = new Paint();
        paint.setFilterBitmap(true);
        imageCanvas.drawBitmap(mInputImage, createTransformationMatrix(size), paint);

        return outputImage;
    }
 
开发者ID:malah-code,项目名称:Open-Quran-Radio,代码行数:22,代码来源:ImageHelper.java

示例7: BeatMapView

import android.graphics.Paint; //导入方法依赖的package包/类
public BeatMapView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    mBitPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBitPaint.setFilterBitmap(true);
    mBitPaint.setDither(true);

    note_0 = Utils.readBitMap(context, R.drawable.ic_note_0);
    note_1 = Utils.readBitMap(context, R.drawable.ic_note_1);
    note_2 = Utils.readBitMap(context, R.drawable.ic_note_2);
    note_3 = Utils.readBitMap(context, R.drawable.ic_note_3);
    note_4 = Utils.readBitMap(context, R.drawable.ic_note_4);

}
 
开发者ID:Lazyeraser,项目名称:DereHelper,代码行数:14,代码来源:BeatMapView.java

示例8: getRoundedCroppedBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
private Bitmap getRoundedCroppedBitmap(Bitmap bitmap, int radius) {
    Bitmap finalBitmap;

    if (bitmap.getWidth() != radius || bitmap.getHeight() != radius) {
        finalBitmap = Bitmap.createScaledBitmap(bitmap, radius, radius, false);
    } else {
        finalBitmap = bitmap;
    }

    Bitmap output = Bitmap.createBitmap(finalBitmap.getWidth(),
            finalBitmap.getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, finalBitmap.getWidth(),
            finalBitmap.getHeight());

    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(Color.parseColor("#BAB399"));
    canvas.drawCircle(finalBitmap.getWidth() / 2,
            finalBitmap.getHeight() / 2,
            finalBitmap.getWidth() / 2, paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(finalBitmap, rect, rect, paint);

    return output;
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvp-interactor-architecture,代码行数:31,代码来源:RoundedImageView.java

示例9: drawCircleBorder

import android.graphics.Paint; //导入方法依赖的package包/类
/**
   * 边缘画圆
   */
  private void drawCircleBorder(Canvas canvas, int radius, int w, int h, int color) {
      Paint paint = new Paint();
      paint.setAntiAlias(true);
      paint.setFilterBitmap(true);
      paint.setDither(true);
      paint.setColor(color);
      /* 设置paint的 style 为STROKE:空心 */
      paint.setStyle(Paint.Style.STROKE);
/* 设置paint的外框宽度 */
      paint.setStrokeWidth(mBorderThickness);
      canvas.drawCircle(w / 2, h / 2, radius, paint);
  }
 
开发者ID:JarvanMo,项目名称:CommonLibrary,代码行数:16,代码来源:RoundImageView.java

示例10: getCroppedRoundBitmap

import android.graphics.Paint; //导入方法依赖的package包/类
public Bitmap getCroppedRoundBitmap(Bitmap bmp, int radius) {
    Bitmap squareBitmap;
    Bitmap scaledSrcBmp;
    int diameter = radius * 2;
    int bmpWidth = bmp.getWidth();
    int bmpHeight = bmp.getHeight();
    Bitmap bitmap;
    int i;
    if (bmpHeight > bmpWidth) {
        bitmap = bmp;
        i = (bmpHeight - bmpWidth) / 2;
        squareBitmap = Bitmap.createBitmap(bitmap, 0, i, bmpWidth, bmpWidth);
    } else if (bmpHeight < bmpWidth) {
        int x = (bmpWidth - bmpHeight) / 2;
        bitmap = bmp;
        i = 0;
        squareBitmap = Bitmap.createBitmap(bitmap, x, i, bmpHeight, bmpHeight);
    } else {
        squareBitmap = bmp;
    }
    if (squareBitmap.getWidth() == diameter && squareBitmap.getHeight() == diameter) {
        scaledSrcBmp = squareBitmap;
    } else {
        scaledSrcBmp = Bitmap.createScaledBitmap(squareBitmap, diameter, diameter, true);
    }
    Bitmap output = Bitmap.createBitmap(scaledSrcBmp.getWidth(), scaledSrcBmp.getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);
    Paint paint = new Paint();
    Rect rect = new Rect(0, 0, scaledSrcBmp.getWidth(), scaledSrcBmp.getHeight());
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    paint.setDither(true);
    canvas.drawARGB(0, 0, 0, 0);
    canvas.drawCircle((float) (scaledSrcBmp.getWidth() / 2), (float) (scaledSrcBmp.getHeight() / 2), (float) (scaledSrcBmp.getWidth() / 2), paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(scaledSrcBmp, rect, rect, paint);
    return output;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:39,代码来源:RoundImageView.java

示例11: resizeBitmapByCanvas

import android.graphics.Paint; //导入方法依赖的package包/类
public Bitmap resizeBitmapByCanvas() {
    float width;
    float height;
    float originalWidth = (float) this.originalBitmap.getWidth();
    float originalHeight = (float) this.originalBitmap.getHeight();
    if (originalWidth > originalHeight) {
        width = (float) this.containerWidth;
        height = (((float) this.containerWidth) * originalHeight) / originalWidth;
    } else {
        height = (float) this.containerHeight;
        width = (((float) this.containerHeight) * originalWidth) / originalHeight;
    }
    if (width > originalWidth || height > originalHeight) {
        return this.originalBitmap;
    }
    Bitmap background = Bitmap.createBitmap((int) width, (int) height, Config.ARGB_8888);
    Canvas canvas = new Canvas(background);
    float scale = width / originalWidth;
    float yTranslation = (height - (originalHeight * scale)) / 2.0f;
    Matrix transformation = new Matrix();
    transformation.postTranslate(0.0f, yTranslation);
    transformation.preScale(scale, scale);
    Paint paint = new Paint();
    paint.setFilterBitmap(true);
    canvas.drawBitmap(this.originalBitmap, transformation, paint);
    return background;
}
 
开发者ID:asif-patel,项目名称:ImageMagnifier,代码行数:28,代码来源:MainActivity.java

示例12: getThumbValuePaint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * 取得thumb值的paint
 */
private Paint getThumbValuePaint() {
	Paint p = new Paint();
	p.setColor(Color.RED);
	p.setAntiAlias(true);// 去除锯齿
	p.setFilterBitmap(true);// 对位图进行滤波处理
	p.setTextSize(35);

	return p;
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:13,代码来源:RangeSeekBar.java

示例13: onDraw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas paramCanvas) {
    if (useDefaultStyle) {
        super.onDraw(paramCanvas);
        return;
    }
    final Drawable localDrawable = getDrawable();
    if (localDrawable == null)
        return;
    if (localDrawable instanceof NinePatchDrawable) {
        return;
    }
    if (this.paint == null) {
        final Paint localPaint = new Paint();
        localPaint.setFilterBitmap(false);
        localPaint.setAntiAlias(true);
        localPaint.setXfermode(MASK_XFERMODE);
        this.paint = localPaint;
    }
    final int width = getWidth();
    final int height = getHeight();
    /** 保存layer */
    int layer = paramCanvas.saveLayer(0.0F, 0.0F, width, height, null, 31);
    /** 设置drawable的大小 */
    localDrawable.setBounds(0, 0, width, height);
    /** 将drawable绑定到bitmap(this.mask)上面(drawable只能通过bitmap显示出来) */
    localDrawable.draw(paramCanvas);
    if ((this.mask == null) || (this.mask.isRecycled())) {
        this.mask = createOvalBitmap(width, height);
    }
    /** 将bitmap画到canvas上面 */
    paramCanvas.drawBitmap(this.mask, 0.0F, 0.0F, this.paint);
    /** 将画布复制到layer上 */
    paramCanvas.restoreToCount(layer);
    drawBorder(paramCanvas, width, height);
}
 
开发者ID:lzmlsfe,项目名称:19porn,代码行数:37,代码来源:CircleImageView.java

示例14: PointCloud

import android.graphics.Paint; //导入方法依赖的package包/类
public PointCloud(Drawable drawable) {
    mPaint = new Paint();
    mPaint.setFilterBitmap(true);
    mPaint.setColor(Color.rgb(255, 255, 255)); // TODO: make configurable
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);

    mDrawable = drawable;
    if (mDrawable != null) {
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:13,代码来源:PointCloud.java

示例15: initPaint

import android.graphics.Paint; //导入方法依赖的package包/类
private void initPaint() {
    mBitPaint = new Paint();
    // 防抖动
    mBitPaint.setDither(true);
    // 开启图像过滤
    mBitPaint.setFilterBitmap(true);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:8,代码来源:FingerPrinterView.java


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