usuiat / Zoomable

Jetpack Compose library that enables contents zooming with pinch gesture.
https://usuiat.github.io/Zoomable/
Apache License 2.0
325 stars 15 forks source link

How ZoomState exposes offsetX, offsetY and scale so i can find what part of the image is being displayed. #190

Closed osw-mj closed 3 months ago

osw-mj commented 3 months ago

Here is the explanation with example:

Suppose I've image A that is have full human body image and now using this library i've done zoomed to face and i've the button that will take me to next screen with image but that image should show me the image that I've zoomed to face not the old one of full body image.

osw-mj commented 3 months ago

Hey @usuiat How are you, Sorry but can you look into my question, Let me know what you think about this. Or do you have any confusion? Response this comments if you read it.

usuiat commented 3 months ago

@osw-mj Sorry for the late reply. ZoomState exposes offsetX, offsetY and scale. Using these properties, we may be able to guess which part of the image is being displayed. Please let me know if there are any other properties you need.

osw-mj commented 3 months ago

Yes same i want to know the part displayed and want to convert that part into the image file. Okay i think you know how it's possible can you make it easier for me means any function

usuiat commented 3 months ago

The figure shows the scale, offsetX, and offsetY when the blue image size is zoomed to orange.

image

The visible area then becomes a green rectangle, which can be represented by the equation in the figure.

image

However, this is the case when the aspect ratio of the image and the display area match. If the aspect ratios are different, it becomes more complicated. Probably, the required rectangular area will vary from application to application.

osw-mj commented 3 months ago

Okay I'm closing this issue for now. Thank you.