开发者

Imitate crop function of system Gallery

开发者 https://www.devze.com 2023-03-21 11:20 出处:网络
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 ,atGallery\\src\\com\\andro

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 the intent

  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.Then in onActivityResult

  Bitmap bitmap = BitmapFactory.decodeFile(IMAGE_PATH_TO_SAVE_CROPPED_IMAGE);
  // bitmap will contain the cropped image
0

精彩评论

暂无评论...
验证码 换一张
取 消