@TargetApi(10)
private Bitmap decodeRegionCrop(ImageViewTouch cropImage) {
int width = initWidth > initHeight ? initHeight : initWidth;
int screenWidth = DemoApplication.getApp().getScreenWidth();
float scale = cropImage.getScale() / getImageRadio();
RectF rectf = cropImage.getBitmapRect();
int left = -(int) (rectf.left * width / screenWidth / scale);
int top = -(int) (rectf.top * width / screenWidth / scale);
int right = left + (int) (width / scale);
int bottom = top + (int) (width / scale);
Rect rect = new Rect(left, top, right, bottom);
InputStream is = null;
System.gc();
Bitmap croppedImage = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
oriBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
is = new ByteArrayInputStream(baos.toByteArray());
BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
croppedImage = decoder.decodeRegion(rect, new BitmapFactory.Options());
} catch (Throwable e) {
} finally {
IOUtil.closeStream(is);
}
return croppedImage;
}
CropPhotoActivity.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:TAG
作者:
评论列表
文章目录