1、关于图片截取
1 // Launch picker to choose photo for selected contact 2 Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); 3 intent.setType("image/*"); 4 intent.putExtra("crop", "true"); 5 intent.putExtra("aspectX", aspectX); 6 intent.putExtra("aspectY", aspectY);//aspectX:aspectY实际上是剪切框的宽高比例; 7 intent.putExtra("outputX", outputX); 8 intent.putExtra("outputY", outputY); 9 intent.putExtra("scale", scale); 10 intent.putExtra("return-data", return_data); 11 intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri()); 12 intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); 13 intent.putExtra("noFaceDetection",!faceDetection); // lol, negative boolean noFaceDetection 14 if (circleCrop) { 15 intent.putExtra("circleCrop", true); 16 } 17 18 startActivityForResult(intent, PHOTO_PICKED);
剪切图片有两种方式:一种是直接返回数据,另外一种是传入一个Uri,让剪切程序将结果保存到特定的位置;
详见:http://www.androidworks.com/crop_large_photos_with_android
2.画布抗锯齿
1 canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG));