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


Java PaintFlagsDrawFilter类代码示例

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


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

示例1: init

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
private void init() {
    Log.i(Tag, "init");

    mLineWidth = changeDp(1);
    mLineHeight = changeDp(3);
    mFixLineHeight = changeDp(6);
    mSunRadius = changeDp(12);
    mLineColor = Color.RED;
    mLineLevel = 30;

    //线的配置
    mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mLinePaint.setColor(mLineColor);
    mLinePaint.setStyle(Paint.Style.FILL_AND_STROKE);
    // 设置画笔宽度
    mLinePaint.setStrokeWidth(mLineWidth);
    mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG
            | Paint.FILTER_BITMAP_FLAG);
    debugRect = new Rect();
    mouthRect = new RectF();
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:22,代码来源:SunLineView.java

示例2: dispatchDraw

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
@Override
protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);
    if (mChanged && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        post(new Runnable() {
            @Override
            public void run() {
                if (mAttached && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    final int layerType = getLayerType();
                    // If it's already a hardware layer, it'll be built anyway.
                    if (layerType != LAYER_TYPE_HARDWARE || mFirst) {
                        mFirst = false;
                        setLayerType(LAYER_TYPE_HARDWARE, null);
                        buildLayer();
                        setLayerType(LAYER_TYPE_NONE, null);
                    }
                }
            }
        });
        mChanged = false;
    }
    PaintFlagsDrawFilter pfd = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint
            .FILTER_BITMAP_FLAG);
    canvas.setDrawFilter(pfd);
}
 
开发者ID:Break369,项目名称:MyLife,代码行数:26,代码来源:BuildLayerFrameLayout.java

示例3: getRoundedCornerBitmap

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap
            .getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(output);
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));

    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);
    final float roundPx = pixels;

    paint.setAntiAlias(true);
    paint.setDither(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    canvas.drawRoundRect(rectF, roundPx, roundPx, paint);

    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);

    return output;
}
 
开发者ID:Blankeer,项目名称:MDWechat,代码行数:24,代码来源:ImageHelper.java

示例4: onDraw

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
public void onDraw(Canvas canvas) {
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, 3));
    int W = canvas.getWidth();
    int H = canvas.getHeight();
    Rect frame = CameraManager.get().getFramingRect();
    if (frame != null) {
        drawCover(canvas, frame, W, H);
        if (this.resultBitmap != null) {
            canvas.drawBitmap(this.resultBitmap, (float) frame.left, (float) frame.top, this.paint);
            return;
        }
        drawScanningLine(canvas, frame);
        drawRectEdge(canvas, frame);
        this.paint.reset();
        postInvalidateDelayed(ANIMATION_DELAY);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:ViewfinderView.java

示例5: RoundImageView

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
public RoundImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView);
    float mRadius = array.getDimension(R.styleable.RoundImageView_radius, 10);
    rids[0] = mRadius;
    rids[1] = mRadius;
    rids[2] = mRadius;
    rids[3] = mRadius;
    rids[4] = 0f;
    rids[5] = 0f;
    rids[6] = 0f;
    rids[7] = 0f;
    array.recycle();
    mPath = new Path();
    paintFlagsDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
    setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
 
开发者ID:yuqirong,项目名称:CardSwipeLayout,代码行数:18,代码来源:RoundImageView.java

示例6: onDraw

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
    if (mAnimator_visible.isRunning()) {
        int x = (int) mAnimator_visible.getAnimatedValue();
        drawClear(x, canvas);
        invalidate();
    } else if (isVisible) {
        drawClear(0, canvas);
    }

    if (mAnimator_gone.isRunning()) {
        float scale = (float) mAnimator_gone.getAnimatedValue();
        drawClearGone(scale, canvas);
        invalidate();
    }
}
 
开发者ID:yuhodev,项目名称:login,代码行数:19,代码来源:ClearEditText.java

示例7: drawTargetBitmap

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
private void drawTargetBitmap(Canvas canvas,int alpha) {
//        mCanvas =canvas;
        mPaint = new Paint();
        mPaint.setColor(mSelectedColor);
        mPaint.setAntiAlias(true);
        mPaint.setDither(true);
        mPaint.setAlpha(alpha);
        mCanvas.drawRect(mIconRect, mPaint);
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
        mPaint.setAlpha(255);

        mCanvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));

        if (mIconBitmapSelected != null)
            mCanvas.drawBitmap(mIconBitmapSelected, mIconRect.left, mIconRect.top, mPaint);
        else
            mCanvas.drawBitmap(mIconBitmapNormal, mIconRect.left, mIconRect.top, mPaint);
        canvas.drawBitmap(mBitmap, 0, 0, null);

    }
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:21,代码来源:BottomItemView.java

示例8: init

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
private void init() {
    mStrokeWidth = AppUtil.dip2px(2);
    mPaint = new Paint();
    mPaint.setColor(0xFF0000FF);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(mStrokeWidth);
    mPaint.setAntiAlias(true);
    mPaint.setDither(false);


    mBGPaint = new Paint();
    mBGPaint.setColor(0xFFAAAAAA);
    mBGPaint.setStyle(Paint.Style.STROKE);
    mBGPaint.setStrokeWidth(mStrokeWidth);
    mBGPaint.setAntiAlias(true);
    mBGPaint.setDither(false);
    mDegree = 0;
    pfd = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG);
}
 
开发者ID:yangbinn,项目名称:PullRefreshLayout,代码行数:20,代码来源:CircleView.java

示例9: drawable2Bitmap

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
/**
 * drawable转bitmap
 *处理不同情况下的图片显示
 * @param drawable
 * @return
 */
private Bitmap drawable2Bitmap(Drawable drawable) {
    int w = drawable.getIntrinsicWidth();
    int h = drawable.getIntrinsicHeight();
    Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
    drawable.setBounds(0, 0, w, h);
    if ((w >= h) && CropType.centerTop.equals(cropType)) {
        canvas.translate((h - w) * 0.5F, 0);
    } else if ((w >= h) && CropType.center.equals(cropType)) {
        canvas.translate((h - w) * 0.5F, 0);
    } else if ((w < h) && CropType.center.equals(cropType)) {
        canvas.translate(0, (w - h) * 0.5F);
    }
    drawable.draw(canvas);
    return bitmap;
}
 
开发者ID:garyhu1,项目名称:collapselrecycler,代码行数:24,代码来源:CircleImageView.java

示例10: drawCircles

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
private void drawCircles(Canvas canvas) {
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG
            | Paint.FILTER_BITMAP_FLAG));

    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(0xffffffff);

    RectF r = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
    canvas.drawRect(r, paint);

    for (int i = radiusArray.length - 1; i >= 0; i--) {
        if (radiusArray[i] >= baseRadius) {
            paint.setColor(getColor(radiusArray[i]));

            canvas.drawCircle(canvas.getWidth() / 2,
                    canvas.getHeight() / 2, radiusArray[i], paint);
        }
    }

    paint.setColor(Color.argb(255, 0xfe, 0xaa, 0x4b));
    canvas.drawCircle(canvas.getWidth() / 2, canvas.getHeight() / 2,
            baseRadius, paint);
}
 
开发者ID:cheyiliu,项目名称:test4XXX,代码行数:25,代码来源:MainActivity.java

示例11: RoseBoxSeekBarView

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
/**
 * @param context
 * @param attrs
 * @param defStyle
 */
public RoseBoxSeekBarView(Context context, AttributeSet attrs, int defStyle) {
	super(context, attrs, defStyle);
	this.mContext = context;
	mResources = context.getApplicationContext().getResources();
	drawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG
			| Paint.FILTER_BITMAP_FLAG);
	int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
	int cacheSize = maxMemory / 8;
	mMemoryCache = new LruCache<String, Bitmap>(cacheSize) {
		@Override
		protected int sizeOf(String key, Bitmap bitmap) {
			// 重写此方法来衡量每张图片的大小,默认返回图片数量。
			return bitmap.getByteCount() / 1024;
		}
	};
	// typeface = Typeface.createFromAsset(getContext().getAssets(),
	// "fonts/HELVETICANEUELTSTD-THEX.OTF");

}
 
开发者ID:gizwits,项目名称:Gizwits-AirPurifier_Android,代码行数:25,代码来源:RoseBoxSeekBarView.java

示例12: onDraw

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));//抗锯齿
    if (mAnimator_visible.isRunning()) {
        int x = (int) mAnimator_visible.getAnimatedValue();
        drawClear(x,canvas);
        invalidate();
    }else if (isVisible){
        drawClear(0,canvas);
    }

    if(mAnimator_gone.isRunning()){
        float scale = (float) mAnimator_gone.getAnimatedValue();
        drawClearGone(scale, canvas);
        invalidate();
    }
}
 
开发者ID:tyzlmjj,项目名称:AndroidUI,代码行数:19,代码来源:ClearEditText.java

示例13: onRectChanged

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
protected void onRectChanged(RectF rectf)
{
    super.onRectChanged(rectf);
    o = new RectF();
    o.left = rectf.centerX() - 15.5F * mDensity;
    o.top = rectf.top + 2.0F * mDensity;
    o.right = o.left + 31F * mDensity;
    o.bottom = o.top + 31F * mDensity;
    p = Bitmap.createBitmap((int)rectf.width(), (int)rectf.height(), android.graphics.Bitmap.Config.ARGB_8888);
    r = false;
    if (q == null)
    {
        q = new Canvas();
        q.setDrawFilter(new PaintFlagsDrawFilter(0, 7));
    }
    q.setBitmap(p);
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:18,代码来源:LinePieChart.java

示例14: onDraw

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);

    mPaint.setColor(Color.RED);
    mPaint.setAntiAlias(true);

    for (int index = 0; index < mListPoint.size(); index++)
    {
        if (index > 0)
        {
            canvas.drawLine(mListPoint.get(index - 1).get(X_KEY), mListPoint.get(index - 1)
                    .get(Y_KEY),
                    mListPoint.get(index).get(X_KEY), mListPoint.get(index).get(Y_KEY), mPaint);
            canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG
                    | Paint.FILTER_BITMAP_FLAG));
        }
    }
}
 
开发者ID:cheyiliu,项目名称:test4android,代码行数:21,代码来源:LineView.java

示例15: init

import android.graphics.PaintFlagsDrawFilter; //导入依赖的package包/类
protected void init() {
	bgPaint = new Paint();
	bgPaint.setAntiAlias(true);
	bgPaint.setColor(backgroundColor);

	focusPaint = new Paint();
	focusPaint.setAntiAlias(true);
	focusPaint.setColor(focusColor);

	animatorSet = new AnimatorSet();

	bgRectF = new RectF();

       mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);

       this.setBackgroundResource(0);
}
 
开发者ID:zhongbaitu,项目名称:MaterialButton,代码行数:18,代码来源:FlatButton.java


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