android中手势操作图片的平移、缩放、旋转_android 手势旋转-CSDN博客
android中手势操作图片的平移、缩放、旋转 以及旋转后图片的顶点坐标计算
//原图片上的点
pts[0] = 0;
pts[1] = 0;
//matrix操作
matrix.mapPoints(pts);
//绘制matrix操作后的点
canvas.drawPoint(pts[0], pts[1], paint);
//逆运算 matrix.invert(invertMatrix); //点击再matrix上 屏幕上的点 pts[0] = x_down;
pts[1] = y_down; //将屏幕上的点逆运算,还原道原始图片上 invertMatrix.mapPoints(pts); //绘制点 canvas.drawPoint(pts[0], pts[1], paint);
path闭合后的区域,所有点所在的RectF
RectF r=new RectF();
//计算控制点的边界
path.computeBounds(r, true);
点在path封闭区域内
region.setPath(path, new Region((int) r.left, (int) r.top, (int) r.right, (int) r.bottom));
region.contains(1, 2);
图片旋转后矩形框
RectF tmpRect = new RectF(); ret = tempMatrix.mapRect(tmpRect, new RectF(0, 0, bitmapWidth, bitmapHeight));