[英]Android PhotoView - zoom to previous position (x y coordinates and scale)
I'm using https://github.com/chrisbanes/PhotoView so user can zoom the image and then draw some point.我正在使用https://github.com/chrisbanes/PhotoView以便用户可以缩放图像然后绘制一些点。
There is also a function to delete this point.还有一个功能可以删除这个点。 In this case I redraw whole bitmap:在这种情况下,我重绘整个位图:
matrix = new Matrix();
canvas.drawBitmap(bmp, matrix, paint);
setImageBitmap(bmp);
But now I want to zoom image to previous position/coordinates.但现在我想将图像缩放到以前的位置/坐标。
This should work:这应该有效:
setScale(scale, focalX, focalY, false);
I know the scale but I need focalX, focalY.我知道比例,但我需要focusX、focalY。
How can I get it?我怎么才能得到它? Maybe I should somehow calculate it from the也许我应该以某种方式从
getSuppMatrix(matrix);
But I'm not sure if it's possible and how.但我不确定这是否可能以及如何实现。
Do you have some tips?你有什么建议吗? Help?帮助?
Solved by getting matrix通过获取矩阵解决
getSuppMatrix(matrix);
before setting new bitmap在设置新位图之前
setImageBitmap(bmp);
And then setting previous matrix然后设置上一个矩阵
setSuppMatrix(matrix);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.