Getting coordinates from a Path object (there are no such methods at all)

How to get coordinates from Path and / or Region in Android? There are no methods that allow you to do this.

Basically, I need the coordinates of the points of my object that the Path object contains.

Maybe I can do it through Reflection? Any help would be appreciated.

+4
source share
2 answers

If we look at the source code for Path :

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/graphics/Path.java?av=f

We see that the coordinates are not stored on the Path and are transferred to our own calls.

One way would be to extend Path and override all the appropriate methods ( lineTo , quadTo , moveTo , etc.) to track the coordinates themselves.

0
source

Well. Perhaps if you use the Path getBounds method and save the result in a direct object, you can access the "left" and "top" properties field of this object to get the x and y coordinates

0
source

Source: https://habr.com/ru/post/1398231/


All Articles