Tutorial by Examples

PorterDuff.Mode is used to create a PorterDuffColorFilter. A color filter modifies the color of each pixel of a visual resource. ColorFilter filter = new PorterDuffColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN); The above filter will tint the non-transparent pixels to blue color. The color fil...
An Xfermode (think "transfer" mode) works as a transfer step in drawing pipeline. When an Xfermode is applied to a Paint, the pixels drawn with the paint are combined with underlying pixels (already drawn) as per the mode: paint.setColor(Color.BLUE); paint.setXfermode(new PorterDuffXferm...
/** * Apply a radial mask (vignette, i.e. fading to black at the borders) to a bitmap * @param imageToApplyMaskTo Bitmap to modify */ public static void radialMask(final Bitmap imageToApplyMaskTo) { Canvas canvas = new Canvas(imageToApplyMaskTo); final float centerX = imageToApply...

Page 1 of 1