Skip to content

[Android]: Replace deprecated drawing cache with Canvas#20

Open
saheem128 wants to merge 1 commit intooblador:masterfrom
saheem128:master
Open

[Android]: Replace deprecated drawing cache with Canvas#20
saheem128 wants to merge 1 commit intooblador:masterfrom
saheem128:master

Conversation

@saheem128
Copy link

@saheem128 saheem128 commented Dec 9, 2023

What's in here:
This commit modifies the startGesture method in the PinchableView class to use a Canvas for creating a bitmap snapshot of the view. The previous implementation used the now-deprecated drawing cache, which could lead to compatibility and performance issues, especially in newer Android versions.

My motivation:
Whenever I pinch an image and then change the image dynamically, it would return the old image on the next pinch geasture. Now, that could be solved by simply writing v.invalidate() in the startGesture method to kind of make it redraw the view, but doing it in Canvas already solved my issue.

s

@frodriguez-hu
Copy link

Were you able to zoom the image from the pivot point instead of the center using Canvas?

@saheem128
Copy link
Author

Were you able to zoom the image from the pivot point instead of the center using Canvas?

No!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants