1

i have used custom view which contains canvas to draw bitmap, overlay, shapes etc. this custom view is added to the relative layout in my activity. my problem is while i translate image on canvas to edit the bottom portion of image, it edits successfully but after editing when i save this bitmap the saved bitmap contains only the part of original bitmap which is shown at a time of save....remaining part of bitmap which is not shown on the screen bcoz of translation is not saved as a black part with bitmap.... any solution to this problem..? thanks.

private void settingBitmapToDraw() {
    // TODO Auto-generated method stub

    resultBitmap=Bitmap.createScaledBitmap(resultBitmap, WIDTH, HEIGHT, true);
    Matrix matrix=new Matrix();
    matrix.setRotate(TO_DEGREE);
    tempBitmap=Bitmap.createBitmap
                            (resultBitmap, 0, 0, WIDTH, HEIGHT, matrix, true);
    if(bitmap!=null)
    {
        bitmap.recycle();
        bitmap=null;
    }   
    bitmap=Bitmap.createBitmap(WIDTH, HEIGHT, tempBitmap.getConfig());
    canvas=new Canvas(bitmap);
    invalidate();

}
4

0 回答 0