开发者

What does Canvas.getClipBounds() return if the canvas is rotated?

I have a simple question which keeps me thinking for a few hours now.

Assume a canvas which is rotated by a specific (known) degree. I want to get the screen coordinates of a bitmap I have drawn on the rotated canvas. To achieve this, I need the canvas' clip bou开发者_StackOverflow中文版nds. This would be no problem for a non-rotated canvas. But it keeps giving me strange values for the rotated case. To be honest, I'm not really sure, what they're supposed to be for a rotated canvas, as top and bottom can't be simple Integer values representing the distance of the currently viewable part on the y-axis to the top and the bottom of the canvas. The same applies to left and right. So what do these values mean to me and how can I use them to get the screen coordinates?

Looking at the Android source didn't help, as they're using a native_getClipBounds() method which I couldn't find anywhere...


Not really an answer, but it was turning into something too long for a comment.

You say you know the angle. Why don't you plot the bitmap on paper and calculate the coordinates of the rotated bitmap's corners and the extent of the bounding box of the rotated bitmap (the red rectangle) and see which of those (if any) agree with the numbers you're getting from Canvas.getClipBounds().

What does Canvas.getClipBounds() return if the canvas is rotated?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜