use of android.graphics.PorterDuffXfermode in project muzei by romannurik.
the class SettingsChooseSourceFragment method prepareGenerateSourceImages.
private void prepareGenerateSourceImages() {
mImageFillPaint.setColor(Color.WHITE);
mImageFillPaint.setAntiAlias(true);
mAlphaPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mSelectedSourceImage = new BitmapDrawable(getResources(), generateSourceImage(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_source_selected, null)));
}
use of android.graphics.PorterDuffXfermode in project platform_frameworks_base by android.
the class ScrimView method setDrawAsSrc.
public void setDrawAsSrc(boolean asSrc) {
mDrawAsSrc = asSrc;
mPaint.setXfermode(new PorterDuffXfermode(mDrawAsSrc ? PorterDuff.Mode.SRC : PorterDuff.Mode.SRC_OVER));
invalidate();
}
use of android.graphics.PorterDuffXfermode in project androidquery by androidquery.
the class BitmapAjaxCallback method getRoundedCornerBitmap.
private static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {
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());
final RectF rectF = new RectF(rect);
final float roundPx = pixels;
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
use of android.graphics.PorterDuffXfermode in project Lazy by l123456789jy.
the class BitmapUtil method combineImagesToSameSize.
/**
* 合并
* @param bgd 后景Bitmap
* @param fg 前景Bitmap
* @return 合成后Bitmap
*/
public static Bitmap combineImagesToSameSize(Bitmap bgd, Bitmap fg) {
Bitmap bmp;
int width = bgd.getWidth() < fg.getWidth() ? bgd.getWidth() : fg.getWidth();
int height = bgd.getHeight() < fg.getHeight() ? bgd.getHeight() : fg.getHeight();
if (fg.getWidth() != width && fg.getHeight() != height) {
fg = zoom(fg, width, height);
}
if (bgd.getWidth() != width && bgd.getHeight() != height) {
bgd = zoom(bgd, width, height);
}
bmp = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_ATOP));
Canvas canvas = new Canvas(bmp);
canvas.drawBitmap(bgd, 0, 0, null);
canvas.drawBitmap(fg, 0, 0, paint);
return bmp;
}
use of android.graphics.PorterDuffXfermode in project Shuttle by timusus.
the class IntroductoryOverlay method setupHolePaint.
private void setupHolePaint() {
PorterDuffXfermode xfermode = new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY);
mHolePaint = new Paint();
mHolePaint.setColor(0xFFFFFF);
mHolePaint.setAlpha(0);
mHolePaint.setXfermode(xfermode);
mHolePaint.setAntiAlias(true);
}
Aggregations