我的應用程序從相機拍攝圖像並保存,然後將其顯示在ImageView
上,但下一步是在顯示的圖像頂部放置一個圓形,以便用戶觸摸屏幕,然後保存「修改的圖像」。如何在圖像頂部繪製圓形
有點像圖像編輯器,如果你願意,問題是我不知道從哪裏開始圖像編輯。我試過這個
@Override
public boolean onTouch(View v, MotionEvent event) {
circleView.setVisibility(View.VISIBLE);
circleView.setX(event.getX()-125);
circleView.setY(event.getY()-125);
try{
Bitmap bitmap = Bitmap.createBitmap(relativeLayout.getWidth(),relativeLayout.getHeight(),Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
v.draw(canvas);
mImageView.setImageBitmap(bitmap);
FileOutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory());
bitmap.compress(Bitmap.CompressFormat.PNG,100,output);
output.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}
return true;
}//ENDOF onTouch
我該怎麼做才能保存圖像?