Android PorterDuffXfermode - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PorterDuffXfermode class.

This code example shows how to use the following methods:
This code example shows how to use the following methods:
 
    private static final Paint sClearerPaint;
 
    static { 
        sClearerPaint = new Paint();
        sClearerPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    } 
 
    private int mColorMode = COLOR_MODE_UNKNOWN;
    private int mPinColor;
    private int mDotColor;
    private ColorStateList mPinColorStateList;
    private ColorStateList mDotColorStateList;
 
    private int mCurrentPinColor;
    private int mCurrentDotColor;
 
    private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    private Paint mMapPinPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
 
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
        private void drawRects(Canvas canvas, PorterDuff.Mode mode) {
            canvas.drawRect(0.0f, 0.0f, 50.0f, 50.0f, mBluePaint);
 
            canvas.save();
            canvas.translate(25.0f, 25.0f);
            mRedPaint.setXfermode(new PorterDuffXfermode(mode));
            canvas.drawRect(0.0f, 0.0f, 50.0f, 50.0f, mRedPaint);
            canvas.restore();
        } 
    } 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.FILL);
        canvas.drawPath(fillPath, mPaint);
 
        // mask in the icon where the bitmap is opaque 
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
        canvas.drawBitmap(bitmap, cropRect, circleRect, mPaint);
 
        // prepare paint for frame drawing 
        mPaint.setXfermode(null);
 
        mScale = 1f;
 
        mSrcRect = new Rect(0, 0, mSize, mSize);
        mDstRect = new RectF(0, 0, mSize, mSize);
        mFrameRect = new RectF(mDstRect);
        mFramePath = new Path();
    } 
 
    @Override 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setXfermode
        int radius  = Math.min(centerX, centerY) / 2;
         
        Bitmap result = Bitmap.createBitmap(radius * 2, radius * 2, Config.ARGB_8888);
        Canvas canvas = new Canvas(result);
        canvas.drawCircle(radius, radius, radius - SPACING_LINE, getCirclePaint());
        getCirclePaint().setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
        canvas.drawBitmap(src, -(centerX - radius), -(centerY - radius), getCirclePaint());
        //outer  
        canvas.drawCircle(radius, radius, radius, getLinePaint());
        //inner 
        canvas.drawCircle(radius, radius, radius - SPACING_LINE, getLinePaint());
        //reset 
        getCirclePaint().setXfermode(null);
        //recycle 
        src.recycle();
        return result;
    } 
     
    public static Bitmap getCircleBitmap(Drawable src){
        if(src instanceof BitmapDrawable){
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setXfermode
This code example shows how to use the following methods:
    private final RectF mRect = new RectF();
    private final RectF mRectInner = new RectF();
    private final Paint mPaintForeground = new Paint();
    private final Paint mPaintBackground = new Paint();
    private final Paint mPaintErase = new Paint();
    private static final Xfermode PORTER_DUFF_CLEAR = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
    private int mColorForeground = Color.WHITE;
    private int mColorBackground = Color.BLACK;
    private float mValue;
    private boolean mPieStyle;
    /** 
     * Value which makes our custom drawn indicator have roughly the same size 
     * as the built-in ProgressBar indicator. Unit: dp 
     */ 
    private static final float PADDING = 4;
    private float mPadding;
    private Bitmap mBitmap;
    /** 
     * Value which makes our custom drawn indicator have roughly the same 
     * thickness as the built-in ProgressBar indicator. Expressed as the ration 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
		final int width = getWidth(), height = getHeight();
		final Paint paint = new Paint();
		final LinearGradient shader = new LinearGradient(width / 2, 0, width / 2, height, 0xffffffff, 0x00ffffff,
				Shader.TileMode.CLAMP);
		paint.setShader(shader);
		paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
		canvas.drawRect(0, 0, width, height, paint);
	} 
 
	@Override 
	protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
		final int width = MeasureSpec.getSize(widthMeasureSpec);
		setMeasuredDimension(width, width / 2);
		// super.onMeasure(widthMeasureSpec, heightMeasureSpec); 
	} 
 
	@Override 
	public final void setOnSizeChangedListener(final OnSizeChangedListener listener) {
		mOnSizeChangedListener = listener;
	} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android PorterDuffXfermode Questions & Answers:

See Code Examples for Android PorterDuffXfermode Methods: