版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24712507/article/details/80452440
Matrix m = new Matrix();
// m.setScale(1, -1); // 垂直翻转
m.setScale(-1, 1); // 水平翻转
int w = mBitmap.getWidth();
int h = mBitmap.getHeight();
// 生成的翻转后的bitmap
mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, w, h, m, true);
因为摄像头获取的是镜面图像,所以这里进行翻转显示出来。
之后在调用Canvas的绘制即可:
mCanvas.drawBitmap(mBitmap, new Rect(0, 0, width, height), new RectF(0f, 0f, getWidth(), getHeight()), null);
参考:https://blog.csdn.net/u013273953/article/details/70899257
更多功能参考:https://blog.csdn.net/danfengw/article/details/48531107