模拟系统画廊裁切功能 [英] Imitate crop function of system Gallery
问题描述
我想模仿系统画廊裁切功能的PIC HTTP: //i.6.cn/cvbnm/88/4a/be/94d8630ca9a3261154f0acf2ebd9f39d.png ,我已经找到了烃源$ C $ C,在画廊的\\ src \\ COM \\机器人\\摄像头,但我不能加编辑矩形上的一个图片,我知道file.can你能告诉我如何添加编辑长方形的图片,可扩展和移动像编辑矩形编辑矩形在HighlightView.jave finiehed
i want to Imitate crop function of system Gallery as the pic http://i.6.cn/cvbnm/88/4a/be/94d8630ca9a3261154f0acf2ebd9f39d.png ,i have found the souce code ,at Gallery\src\com\android\camera , but i cannot add the edit rectangular on one pic,i know the edit rectangular is finiehed in the HighlightView.jave file.can you tell me how to add a edit rectangular on the pic,which can scale and move like edit rectangular
推荐答案
1.Fire意图
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intent.putExtra("crop", "true");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(IMAGE_PATH_TO_SAVE_CROPPED_IMAGE)));
startActivityForResult(Intent.createChooser(intent, "Select Picture"), RETURN_CODE);
2.然后在的onActivityResult
2.Then in onActivityResult
Bitmap bitmap = BitmapFactory.decodeFile(IMAGE_PATH_TO_SAVE_CROPPED_IMAGE);
// bitmap will contain the cropped image
这篇关于模拟系统画廊裁切功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!