android中Bitmap的放大和缩小的方法
16lz
2021-01-23
android中Bitmap的放大和缩小的方法
CSDN博客 原文http://blog.csdn.net/ada168855/article/details/9139777/**Bitmap放大的方法*/
private static Bitmap big(Bitmap bitmap) {
Matrix matrix = new Matrix();
matrix.postScale(1.5f,1.5f); //长和宽放大缩小的比例
Bitmap resizeBmp = Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true);
return resizeBmp;
}
/**Bitmap缩小的方法*/
private static Bitmap small(Bitmap bitmap) {
Matrix matrix = new Matrix();
matrix.postScale(0.8f,0.8f); //长和宽放大缩小的比例
Bitmap resizeBmp = Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true);
return resizeBmp;
}
更多相关文章
- Android遍历文件Listfile返回值为null问题解决方法适用Android8.
- Android 最新获取手机内置存储大小,SD卡存储空间大小方法
- Android 启动浏览器的方法
- Android根据电量变化为不同图片的方法【电池电量提示】
- Android之日期时间选择器使用方法
- Android 图片旋转(使用Matrix.setRotate方法)
- Android Http请求失败解决方法
- Glide的with()方法和生命周期的源码分析
- android TelephonyManager类的方法