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);
}
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);
}
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);
}
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);
}
}
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);
}
Aggregations