Reputation: 9033
In One of my application i need to get bitmap form the canvas....
Actually what is my app is...
There are 2 canvas on view...
I am erasing Bitmap from canvas1 so that image from canvas 2 is displaying... (Put trasperent canvas)
Now when user presses save button it must get bitmap from canvas1 only not from view Actually the code is like this
public void onClick(View v) {
Bitmap editedImage = Bitmap.createBitmap(drawView
.getDrawingCache());
editedImage = Bitmap.createScaledBitmap(editedImage, 200, 300,
true);
if (editedImage != null) {
//Intent intent = new Intent();
//intent.putExtra(ChooseActivity.BITMAP, editedImage);
// AddReportItemActivity.mPhoto =
// drawView.getDrawingCache();
//setResult(SUCCESS, intent);
// finish();
Bitmap bbicon;
But it not Bitmap that i actually want
My question is How to get bitmap from canvas..? Or any other solution?
I have visited this link But not able to understand Plz help
Upvotes: 1
Views: 5496
Reputation: 834
I am not sure what you specificaly want to achieve, however general pattern is to do it like this:
Bitmap.createBitmap()
Canvas(Bitmap)
canvas.drawBitmap(getResources(), R.drawable.my_drawable), 0f, 0f, null);
) Upvotes: 3