对图片的截取

对图片的截取,按照1/3比例:
int bmpWidth = bitmap.getWidth();
int bmpHeight = bitmap.getHeight();
int h = bmpHeight * mScreenWidth / bmpWidth;
//截图(按1/3比例)
int resultHeight = (Integer) (bmpWidth * 210/320);
bitmap= Bitmap.createBitmap(bitmap, 0, bmpHeight / 3
- resultHeight / 2, bmpWidth, resultHeight);
int hh = (Integer) (mScreenWidth * resultHeight / bmpWidth);
bitmap= Bitmap.createScaledBitmap(bitmap, mScreenWidth, hh, false);

猜你喜欢

转载自gzsxt.iteye.com/blog/2009679
今日推荐