-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add this doc to wiki #331
Comments
Looks good, thanks! However I think it would make sense to add a |
Great! There was a |
Just bring it back 😉 |
Yeah it was private, and I refactored the class to re-use |
… to simplify extracting the visible area from an image.
I've added Methods that return I'll write a wiki article once this is released. |
Since many have already asked the question of how to get a Bitmap of the visible region, I have written the following docs after figuring it out myself. Please add it to the wiki so it can help others :)
--- Rendered ---
Getting a Bitmap of the visible region
You can obtain a Bitmap of the current visible region (in the image view) of the source image by using the
viewToSourceCoord
for each diagonal coordinate of the rectangular image view (e.g. top left and bottom right) in order to map the view coordinates to the source image coordinates. Forming aRect
from the result, the BitmapRegionDecoder can then be used to decode the visible region to a rectangular Bitmap.Note that when the image is zoomed out and has a border, converting a view coordinate that is in the border will return a source coordinate that isn't valid (either a negative x or y coordinate, or an x/y coordinate greater than the width/height of the image) and could cause decode failure.
--- Raw ---
The text was updated successfully, but these errors were encountered: