图片的缩放
2015-10-13 10:26
375 查看
/** * 缩放处理 * @param scaling 缩放比例 * @return 缩放后的图片 */ public Bitmap scale(float scaling) { Matrix matrix = new Matrix(); matrix.postScale(scaling, scaling); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } /** * 缩放处理 * @param newWidth 新的宽度 * @return Bitmap */ public Bitmap scaleByWidth(int newWidth) { return scale((float) newWidth / bitmap.getWidth()); } /** * 缩放处理 * @param newHeight 新的高度 * @return Bitmap */ public Bitmap scaleByHeight(int newHeight) { return scale((float) newHeight / bitmap.getHeight()); }
相关文章推荐
- 图片的反转
- js闭包(一)
- 前端页面布局常见问题汇聚
- 圆形投票进度条
- bower
- Setfocus - IE 需要使用setTimeout
- mysqlnd一个很不错的驱动
- 黑马程序员_Selenium Webdriver 简单应用
- Buffer和Cache的区别
- 关于c语言可变参数详解
- RSA加密
- 我做技术面试官的一些体会
- Linux-grep命令整理
- C中堆管理
- 公共技术点之 View 事件传递
- SSH免密码登录
- zoj 3905 Cake
- 使用Apache Benchmark做压力测试遇上的5个常见问题
- 004-Elasticsearch插件的介绍
- “光速"配置ssh免密码登录的配置