简体   繁体   English

Android PhotoView - 缩放到上一个位置(xy 坐标和比例)

[英]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.

相关问题 如何在 PhotoVIew 中缩放(缩放和移动)位图的 x、y 坐标? - How to scale (zoom and move) to x,y coordinates of Bitmap in PhotoVIew? 在Android中放大后如何获取视图的xy位置 - How to get the x y position of a view after zoom-in in android 如何在Android中的画布上获取圆形drwan的位置(x和y坐标)? - how to get position(x and y coordinates) of circle drwan on canvas in android? 如何将多个对象的x,y,z坐标转换为显示这些对象位置的Android应用程序? - How could I turn coordinates x,y,z coordinates of several objects into an Android app that displays the position of these objects? Android PhotoView在方向改变后保持缩放 - Android PhotoView Keep Zoom After Orientation Change Android Pinch使用ScrollView缩放ImageView(PhotoView) - Android Pinch Zoom ImageView (PhotoView) with ScrollView 如何在不丢失x和y布局坐标的情况下添加缩放功能 - How to add zoom feature without loosing the x and y layout coordinates Android我想在画布缩放和平移时获得不同的x,y位置 - Android I want to get different x,y position on touch when canvas scale and translation 如何在Android中找到GeoPoint的x和y坐标 - How to find x and y coordinates of GeoPoint in android Android SDK设置ImageView的XY坐标 - android sdk set imageview x y coordinates
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM