@@ -0,0 +1,1746 @@
+package org.ccci.gto.android.common.picasso.transformation;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Paint;%0Aimport android.graphics.PorterDuff;%0Aimport android.graphics.PorterDuffXfermode;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.support.annotation.DrawableRes;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.v4.content.ContextCompat;%0A%0Aimport com.squareup.picasso.Transformation;%0A%0Apublic class MaskTransformation implements Transformation %7B%0A    private static final Paint PAINT_MASK = new Paint();%0A%0A    static %7B%0A        PAINT_MASK.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));%0A    %7D%0A%0A    @NonNull%0A    private final Context mContext;%0A    @DrawableRes%0A    private final int mMask;%0A%0A    public MaskTransformation(@NonNull final Context context, final int mask) %7B%0A        mContext = context;%0A        mMask = mask;%0A    %7D%0A%0A    @Override%0A    public String key() %7B%0A        return %22MaskTransformation(mask=%22 + mContext.getResources().getResourceEntryName(mMask) + %22)%22;%0A    %7D%0A%0A    @Override%0A    public Bitmap transform(@NonNull final Bitmap source) %7B%0A        final int w = source.getWidth();%0A        final int h = source.getHeight();%0A%0A        final Drawable mask = ContextCompat.getDrawable(mContext, mMask);%0A        if (mask == null) %7B%0A            throw new IllegalArgumentException(%22Unable to load mask%22);%0A        %7D%0A%0A        final Bitmap result = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);%0A        final Canvas canvas = new Canvas(result);%0A        mask.setBounds(0, 0, w, h);%0A        mask.draw(canvas);%0A        canvas.drawBitmap(source, 0, 0, PAINT_MASK);%0A%0A        source.recycle();%0A%0A        return result;%0A    %7D%0A%7D%0A

create MaskTransformation