Rotate Bitmap (Rectangle) While Maintining Area

狂风中的少年 提交于 2019-12-06 11:50:15

The graphics transform function is perfect for this. Create a new bitmap of the size you want, create a graphics object based off that bitmap, apply the transform then draw onto the canvas (graphics.drawimage(original_image)).

Here is a much better example than I can give at this time.

And Bobpowell.net is a site I usually reference back to for great explanations on transforms.

Mr. Berna

I'm confused by this question. Rotation doesn't change scale, so your rectangle will always be 100 x 200 pixels (within the margin of error caused by bitmap rendering). Are you asking how to find the minimum bounding box that will hold a 100 x 200 pixel image rotated at an arbitrary angle? That's been answered elsewhere on Stack Overflow.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!