What returns Canvas.getClipBounds () if the canvas rotates?

I have a simple question that makes me think for several hours.

Suppose a canvas that rotates to a certain (known) degree. I want to get the screen coordinates of a bitmap that I drew on a rotated canvas. To achieve this, I need a clip framework. This is not a problem for a non-rotating canvas. But he continues to give me strange meanings for the turned event. Honestly, I'm not sure if they are designed for a rotating canvas, as the top and bottom cannot be simple. Integer values ​​representing the distance from the currently viewed part along the Y axis to the top and bottom of the canvas. The same goes for left and right. So what do these values ​​mean to me and how can I use them to get the screen coordinates?

Finding the Android source did not help, as they use the native_getClipBounds () method, which I could not find anywhere ...

+3
source share
1 answer

Not quite an answer, but it was too long for a comment.

You say you know the angle. Why don't you draw a bitmap on paper and calculate the coordinates of the rotary bitmap angles and the degree of the bounding box of the rotated bitmap (red rectangle) and see which one (if any) is consistent with the numbers, re from Canvas.getClipBounds().

alt text

+2
source

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


All Articles