2

次の例に示されている循環ビットマップを作成する方法を知っています

正方形の画像を円に切り抜く - プログラムで

Androidでビットマップから円形領域を切り取る

上記の例では、画像を円形ビューに合わせる方法、、私はたくさん検索しましたが、大きいとわかったのは、、、、、ほとんどのコードで、次の関数を使用して画像をトリミングしています

 private void performCrop() 
 {
  // take care of exceptions
  try {
   // call the standard crop action intent (the user device may not
   // support it)
   Intent cropIntent = new Intent("com.android.camera.action.CROP");
   // indicate image type and Uri
   cropIntent.setDataAndType(picUri, "image/*");
   // set crop properties
   cropIntent.putExtra("crop", "true");
   // indicate aspect of desired crop
   cropIntent.putExtra("aspectX", 1);
   cropIntent.putExtra("aspectY", 1);
   // indicate output X and Y
   cropIntent.putExtra("outputX", 256);
   cropIntent.putExtra("outputY", 256);
   // retrieve data on return
   cropIntent.putExtra("return-data", true);
   // start the activity - we handle returning in onActivityResult
   startActivityForResult(cropIntent, PIC_CROP);
  }
  // respond to users whose devices do not support the crop action
  catch (ActivityNotFoundException anfe) {
   // display an error message
   String errorMessage = "Whoops - your device doesn't support the crop action!";
   Toast toast = Toast
     .makeText(this, errorMessage, Toast.LENGTH_SHORT);
   toast.show();
  }
 }

実際には、上記のコードを介して長方形のトリミングが実現されます。円形のトリミングに上記の関数を使用したいのですが、、、助けてください、、、

4

1 に答える 1