当前位置: 移动技术网 > IT编程>移动开发>Android > 如何使用Matrix对bitmap的旋转与镜像水平垂直翻转

如何使用Matrix对bitmap的旋转与镜像水平垂直翻转

2019年07月24日  | 移动技术网IT编程  | 我要评论

说三道四的意思,顺丰快递运费查询,七仙女下凡小游戏

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;
}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网