移动部分画布Android

时间:2015-06-23 14:20:06

标签: android android-canvas mask ondraw android-bitmap

我已使用以下代码附加了代码:

    @Override
public void MaskImageByCase(Bitmap mask,Bitmap overlay,Bitmap originalImage,ImageView caseContainer) {
    Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas mCanvas = new Canvas(result);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    Bitmap scaledImg = Bitmap.createScaledBitmap(originalImage, mask.getWidth(), mask.getHeight(), false);
    mCanvas.drawBitmap(scaledImg, 0, 0, null);
    mCanvas.drawBitmap(mask, 0, 0, paint);
    paint.setXfermode(null);
    caseContainer.setScaleType(ImageView.ScaleType.CENTER);
    result = overlay(result,overlay);
    caseContainer.setScaleType(ImageView.ScaleType.FIT_XY);
    caseContainer.setImageBitmap(result);

}

我想仅在originalImage位图上启用夹点,缩放和拖动等手势。 我怎样才能实现这种行为?

0 个答案:

没有答案