當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。