Tout corps peut me dire d'effacer la peinture sur l'image, dans mon application j'ai été préparé la peinture des doigts sur l'image, si je veux effacer la peinture, obtenir la couleur noire sur l'image au lieu d'effacer l'image. mon code estComment effacer la peinture avec le doigt sur l'image?
public class MyView extends View {
int bh = originalBitmap.getHeight();
int bw = originalBitmap.getWidth();
public MyView(Context c) {
super(c);
//mBitmap = Bitmap.createScaledBitmap(originalBitmap,bw,bh,true);
mBitmap = Bitmap.createBitmap(bw,bh,Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
mPath = new Path();
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
mBitmapPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
}
public MyView (Context c, int color) {
super(c);
mBitmap = Bitmap.createScaledBitmap(originalBitmap,bw,bh,true);
mCanvas = new Canvas(mBitmap);
mPath = new Path();
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
mBitmapPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)) ;
mCanvas.drawColor(color);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
/*mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);*/
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.TRANSPARENT);
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
canvas.drawPath(mPath, mPaint);
}
pour la peinture effacer
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
vous voulez la fonctionnalité de la gomme même que Eraser dans MSPaint dans WindowsOS? –
voir ceci: http: //dl.dropbox.com/u/38493970/Image-4724.jpg Je veux effacer seulement la couleur rouge sur l'image au lieu d'effacer le rouge, il devient de couleur noire. –
Comment effacer la couleur. sur quel événement? – Ronnie