このような画像の編集、回転、サイズ変更を可能にする Titanium Android モジュールを知っていますか?
質問する
308 次
1 に答える
1
これは camera.action.CROP です:
//STARTS CROPPING INTENT
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(Uri.fromFile(savedPicture), "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, CROP_PICTURE);
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CROP_PICTURE)
{
// SAVE PICTURE TO FILESYSTEM
Bundle extras = data.getExtras();
Bitmap croppedPicture = extras.getParcelable("data");
File pictureFolder = RouterApplication.getInstance().getPictureDirectory();
File picture = null;
FileOutputStream fOut = null;
try
{
picture = new File(pictureFolder, "a.jpg");
if (croppedPicture != null)
{
fOut = new FileOutputStream(picture);
croppedPicture.compress(Bitmap.CompressFormat.JPEG, 90, fOut);
}
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
于 2016-05-20T08:49:56.703 に答える