源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2021-09-16 07:37 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:如何使用Matrix对bitmap的旋转与镜像水平垂直翻转
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(); [b]m.postScale(1, -1);   //镜像垂直翻转 m.postScale(-1, 1);   //镜像水平翻转 [/b]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; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部