How can I rotate an Bitmap a given number of degrees while maintaining the area of the original bitmap. ie, what I rotate a bitmap of Width:100,Height:200, my end result will be a bigger image but the rotated portion will still have an area of 100*200
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
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.
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.