use of android.graphics.PorterDuffXfermode in project MaterialDesignLibrary by navasmdc.
the class ButtonFloat method cropCircle.
public Bitmap cropCircle(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
use of android.graphics.PorterDuffXfermode in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class DrawingPreviewPlacerView method setHardwareAcceleratedDrawingEnabled.
public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) {
if (!enabled)
return;
final Paint layerPaint = new Paint();
layerPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER));
setLayerType(LAYER_TYPE_HARDWARE, layerPaint);
}
use of android.graphics.PorterDuffXfermode in project android_packages_apps_Launcher2 by CyanogenMod.
the class Cling method init.
void init(Launcher l, int[] positionData) {
if (!mIsInitialized) {
mLauncher = l;
mPositionData = positionData;
Resources r = getContext().getResources();
mPunchThroughGraphic = r.getDrawable(R.drawable.cling);
mPunchThroughGraphicCenterRadius = r.getDimensionPixelSize(R.dimen.clingPunchThroughGraphicCenterRadius);
mAppIconSize = r.getDimensionPixelSize(R.dimen.app_icon_size);
mRevealRadius = r.getDimensionPixelSize(R.dimen.reveal_radius) * 1f;
mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
mErasePaint = new Paint();
mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
mErasePaint.setColor(0xFFFFFF);
mErasePaint.setAlpha(0);
mIsInitialized = true;
}
}
use of android.graphics.PorterDuffXfermode in project TransitionHelper by ImmortalZ.
the class CirleAnimView method init.
private void init(Context context) {
mPaint = new Paint();
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAntiAlias(true);
mPaint.setColor(getResources().getColor(R.color.showmethod_end_color));
xfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_OUT);
setWillNotDraw(false);
}
use of android.graphics.PorterDuffXfermode in project SimpleCropView by IsseiAoki.
the class CropImageView method getCircularBitmap.
/**
* Crop the square image in a circular
*
* @param square image bitmap
* @return circular image bitmap
*/
public Bitmap getCircularBitmap(Bitmap square) {
if (square == null)
return null;
Bitmap output = Bitmap.createBitmap(square.getWidth(), square.getHeight(), Bitmap.Config.ARGB_8888);
final Rect rect = new Rect(0, 0, square.getWidth(), square.getHeight());
Canvas canvas = new Canvas(output);
int halfWidth = square.getWidth() / 2;
int halfHeight = square.getHeight() / 2;
final Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
canvas.drawCircle(halfWidth, halfHeight, Math.min(halfWidth, halfHeight), paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(square, rect, rect, paint);
return output;
}
Aggregations