如何使用Matrix对bitmap的旋转与镜像水平垂直翻转_安卓软件开发教程-查字典教程网
如何使用Matrix对bitmap的旋转与镜像水平垂直翻转
如何使用Matrix对bitmap的旋转与镜像水平垂直翻转
发布时间:2016-12-28 来源:查字典编辑
摘要:Bitmapconvert(Bitmapa,intwidth,intheight){intw=a.getWidth();inth=a.get...

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;

}

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新安卓软件开发学习
    热门安卓软件开发学习
    编程开发子分类