Android图片裁剪
来源:互联网 发布:阿里云在线客服 编辑:程序博客网 时间:2024/05/18 10:17
在进行扩大的时候要判断坐标以及宽高的控制,防止出现bug
/** * 裁剪照片 * 根据传入的照片以及要裁剪的坐标,以及裁剪的宽高来裁剪 * 裁剪时把图片宽高扩大20 * 在裁剪的坐标点-10 * 在宽高的基础上+10 * * @param bitmap * @return */public static Bitmap getcreateBitmap(Bitmap bitmap, int x, int y, int width, int height) { int x1;//最终x坐标 if (x < 10) { x1 = x; } else { x1 = x - 10; } int y1;//最终y坐标 if (y < 10) { y1 = y; } else { y1 = y - 10; } int width1;//最终图片宽 int pwidth = bitmap.getWidth(); int tempwidth = x + width + 20;//判断总宽有没有超过源照片的的宽 if (tempwidth > pwidth) { width1 = width; } else { width1 = width + 20; } int height1;//最终图片高 int pheight = bitmap.getHeight(); int tempheight = y + height + 20;//判断总高有没有超过源照片的的高 if (tempheight > pheight) { height1 = height; } else { height1 = height + 20; } Bitmap b = Bitmap.createBitmap(bitmap, x1, y1, width1, height1); return b;}
阅读全文
0 0
- android系统图片裁剪
- android裁剪图片
- android 图片裁剪
- android 裁剪图片
- Android 图片裁剪功能
- android 图片裁剪
- android图片裁剪
- android图片裁剪
- android图片的裁剪
- Android自定义裁剪图片
- android 图片裁剪
- android 图片裁剪
- android图片裁剪器
- Android 图片裁剪
- android裁剪图片
- Android应用图片裁剪
- Android裁剪图片总结
- Android图片裁剪Demo
- Python 资源大全中文版
- Wget 下载Java环境开发包
- JS省市县三级联动输入
- Python基础篇(1)-第一个Python程序
- 《Python学习手册》学习笔记(30)之第30章类的设计(关键词:编程语言/Python/OOP/面向对象/类)
- Android图片裁剪
- 最小树形图
- 怎么让会议室预定这件事,简单有效的实现?
- Linux中文字体
- Python-NumPy
- 细说Nginx系列--前奏
- JSON解析
- 【定位】-XPath定位
- MySQL事务以及select...for update