Bitmap convert(Bitmap a, int width, int height)
{
int w = a.getWidth();
int h = a.getHeight();
Bitmap newb = Bitmap.createBitmap(ww, wh, Config.ARGB_8888);// 创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas(newb);
Matrix m = new Matrix();
m.postScale(1, -1); //镜像垂直翻转
m.postScale(-1, 1); //镜像水平翻转
m.postRotate(-90); //旋转-90度
Bitmap new2 = Bitmap.createBitmap(a, 0, 0, w, h, m, true);
cv.drawBitmap(new2, new Rect(0, 0, new2.getWidth(), new2.getHeight()),new Rect(0, 0, ww, wh), null);
return newb;
}
【如何使用Matrix对bitmap的旋转与镜像水平垂直翻转】相关文章:
★ Android当修改一些代码时使用什么编译命令可以最有效率
★ Android中关于Notification及NotificationManger的详解
★ Android应用开发中模拟按下HOME键的效果(实现代码)
★ Android 管理Activity中的fragments
★ android 如何获取MCC/MNC控制小区广播的开启
★ Android 判断SIM卡属于哪个移动运营商的实现代码
★ android中ListView多次刷新重复执行getView的解决方法