将bitmap按照centercrop的方式截取
来源:互联网 发布:ogame 源码 编辑:程序博客网 时间:2024/06/05 10:26
将已经加载得到的bitma以一定比例截取图片,newWidth,newHeight是想要得到图片的大小,可以传入屏幕的宽高
public static Bitmap zoomImg(Bitmap bm, int newWidth, int newHeight) { int w = bm.getWidth(); // 得到图片的宽,高 int h = bm.getHeight(); int retX; int retY; double wh = (double) w / (double) h; double nwh = (double) newWidth / (double) newHeight; if (wh > nwh) { retX = h * newWidth / newHeight; retY = h; } else { retX = w; retY = w * newHeight / newWidth; } int startX = w > retX ? (w - retX) / 2 : 0;//基于原图,取正方形左上角x坐标 int startY = h > retY ? (h - retY) / 2 : 0; Bitmap bit = Bitmap.createBitmap(bm, startX, startY, retX, retY, null, false); bm.recycle(); return bit;}
0 0
- 将bitmap按照centercrop的方式截取
- 将文件按照分隔符截取数据,截取的数据,根据要求插入到不同的表中
- 将字符串按照指定方式就地翻转
- 获取Bitmap的方式
- Bitmap的优化方式
- android Bitmap的截取及缩放
- 截取字符串的方式
- Java WebService将外部磁盘文件按照流的方式显示在页面
- SQL按照逗号截取
- 如何将bitmap进行缩放。这里说的是用画笔的方式。
- 一个按照行来截取显示文章摘要的函数
- mysql字符串字段按照逗号截取的存储过程
- 将一个字符串按照zip方式压缩和解压缩
- Bitmap有效的压缩方式
- Bitmap加载的正确方式
- bitmap的不同获取方式
- 将日期按照一定的格式转化
- 常用的字符串截取方式
- Java中别名现象和对象引用问题
- MySql EXPLAIN Output Format(Mysql执行计划分析参数)
- 大公司用C++做WEB开发主要是用在哪个部分或环节?
- 2.3趣味数学之分糖果问题
- (OK) cBPM-CentOS—wrapped by fastcgi—files—executing commands
- 将bitmap按照centercrop的方式截取
- js初学笔记(一)
- Android 权限 exproted 的作用
- I/O重定向
- fastcgi++——A C++ FastCGI Library
- 理解本真的REST架构风格
- 深入理解android之IPC机制与Binder框架
- 继承应用
- [FASTCGI] REST framework C++ library—Libmicrohttpd—libhttpserver