Search in sources :

Example 76 with PorterDuffXfermode

use of android.graphics.PorterDuffXfermode in project VirtualApp by asLody.

the class LauncherIconView method drawProgress.

private void drawProgress(Canvas canvas) {
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
    canvas.drawCircle(mWidth / 2f, mHeight / 2f, mRadius, mPaint);
    mPaint.setXfermode(null);
    //start angle : -90 ~ 270;sweep Angle : 360 ~ 0;
    canvas.drawArc(mProgressOval, -90 + mProgress * 3.6f, 360 - mProgress * 3.6f, true, mPaint);
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode)

Example 77 with PorterDuffXfermode

use of android.graphics.PorterDuffXfermode in project VirtualApp by asLody.

the class LauncherIconView method updateInterAnim.

private void updateInterAnim(Canvas canvas) {
    //        if (!mInterAnimRunning) mInterDelta = 0.f;
    //outer circle
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
    canvas.drawCircle(mWidth / 2.f, mHeight / 2.f, mRadius, mPaint);
    mPaint.setXfermode(null);
    //inner circle
    canvas.drawCircle(mWidth / 2.f, mHeight / 2.f, mRadius - mInterDelta, mPaint);
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode)

Example 78 with PorterDuffXfermode

use of android.graphics.PorterDuffXfermode in project ENViews by codeestX.

the class ENLoadingView method draw.

private void draw() {
    Canvas canvas = surfaceHolder.lockCanvas();
    if (canvas == null)
        return;
    //使用这只画笔清屏,清屏后恢复画笔
    mPaint[0].setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
    canvas.drawPaint(mPaint[0]);
    mPaint[0].setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.DST_OVER));
    for (int i = 0; i < 4; i++) {
        drawItem(canvas, mFraction[i], i);
    }
    surfaceHolder.unlockCanvasAndPost(canvas);
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode) Canvas(android.graphics.Canvas) Paint(android.graphics.Paint)

Example 79 with PorterDuffXfermode

use of android.graphics.PorterDuffXfermode in project BlurKit-Android by flurgle.

the class RoundedImageView method onDraw.

@Override
protected void onDraw(Canvas canvas) {
    Drawable myDrawable = getDrawable();
    if (myDrawable != null && myDrawable instanceof BitmapDrawable && mCornerRadius > 0) {
        Paint paint = ((BitmapDrawable) myDrawable).getPaint();
        final int color = 0xff000000;
        Rect bitmapBounds = myDrawable.getBounds();
        final RectF rectF = new RectF(bitmapBounds);
        int saveCount = canvas.saveLayer(rectF, null, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
        getImageMatrix().mapRect(rectF);
        paint.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        paint.setColor(color);
        canvas.drawRoundRect(rectF, mCornerRadius, mCornerRadius, paint);
        Xfermode oldMode = paint.getXfermode();
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        super.onDraw(canvas);
        paint.setXfermode(oldMode);
        canvas.restoreToCount(saveCount);
    } else {
        super.onDraw(canvas);
    }
}
Also used : RectF(android.graphics.RectF) Rect(android.graphics.Rect) PorterDuffXfermode(android.graphics.PorterDuffXfermode) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Drawable(android.graphics.drawable.Drawable) PorterDuffXfermode(android.graphics.PorterDuffXfermode) Xfermode(android.graphics.Xfermode) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 80 with PorterDuffXfermode

use of android.graphics.PorterDuffXfermode in project DiagonalLayout by florent37.

the class DiagonalLayout method init.

public void init(Context context, AttributeSet attrs) {
    settings = new DiagonalLayoutSettings(context, attrs);
    settings.setElevation(ViewCompat.getElevation(this));
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.WHITE);
    pdMode = new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
}
Also used : PorterDuffXfermode(android.graphics.PorterDuffXfermode) Paint(android.graphics.Paint)

Aggregations

PorterDuffXfermode (android.graphics.PorterDuffXfermode)152 Paint (android.graphics.Paint)127 Canvas (android.graphics.Canvas)103 Bitmap (android.graphics.Bitmap)92 Rect (android.graphics.Rect)65 RectF (android.graphics.RectF)51 Matrix (android.graphics.Matrix)11 LinearGradient (android.graphics.LinearGradient)10 SuppressLint (android.annotation.SuppressLint)9 TypedArray (android.content.res.TypedArray)8 Point (android.graphics.Point)6 IOException (java.io.IOException)6 BitmapDrawable (android.graphics.drawable.BitmapDrawable)5 ColorMatrix (android.graphics.ColorMatrix)4 Path (android.graphics.Path)4 Resources (android.content.res.Resources)3 Drawable (android.graphics.drawable.Drawable)3 ResourceHelper (com.klinker.android.launcher.api.ResourceHelper)3 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)3 RadialGradient (android.graphics.RadialGradient)2