【发布时间】:2013-10-05 22:18:19
【问题描述】:
我知道如何创建一个圆形位图,它在以下示例中显示
Crop square image to circle - Programmatically
Cropping circular area from bitmap in 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();
}
}
其实矩形裁剪是通过上面的代码实现的,,,我想用上面的函数进行圆形裁剪,,,请大家帮忙,,,
【问题讨论】: