android笔划位图

时间:2015-11-14 14:30:43

标签: android bitmap

嗨我正在合并成像我的第一张图像成像第二张图片现在我只想在最终图像上画一个商店,但笔画应该是形状而不是正方形我的代码位图在下面

public Bitmap starShape(Bitmap original,Bitmap oldmask){
        Bitmap mask = Bitmap.createScaledBitmap(oldmask, original.getWidth(), original.getHeight(), false);
        Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Config.ARGB_8888);
        Canvas mCanvas = new Canvas(result);
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
        mCanvas.drawBitmap(original, 0, 0, null);
        mCanvas.drawBitmap(mask, 0, 0, paint);
        paint.setXfermode(null);
        return result;
    }

0 个答案:

没有答案