android erasing bitmap. - Not able to save the proper bitmap

288 views Asked by At

I am developing app i have 1 Functionality like This I have done this by This code

Now i want to save the erased bitmap to save

Actually i have a bitmap loaded in canvas The first scrren

Now i am trying to Erase the bitmap like this (added on transperent canvas

And when user press save then only this must output (save as .png) this is my OnDraw method

protected void onDraw(Canvas canvas) {

canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
    c2.drawBitmap(Bitmap2, 0, 0, mBitmapPaint);
    canvas.drawBitmap(Transparent, 0, 0, null);
        //  c2.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
            for (PathPoints p : paths) {
                mPaint.setColor(p.getColor());
                Log.v("", "Color code : " + p.getColor());
                if (p.isTextToDraw()) {
                    canvas.drawText(p.textToDraw, p.x, p.y, mPaint);
                } else {
                    // if(isTouched)
                            c2.drawPath(p.getPath(), mPaint);

                }

            }
        }

And onsave Button i have done

Bitmap editedImage = Bitmap.createBitmap(drawView
                        .getDrawingCache());
                editedImage = Bitmap.createScaledBitmap(editedImage, 200, 300,
                        true);

But this gives me only the full image(First screen shot) You can see my entire Code

0

There are 0 answers