|
Post by hillridge on Mar 18, 2019 6:00:37 GMT -8
How do you rotate a bitmap and have it display without clipping?
I understand how to rotate about the top left corner as is the default, and I understand how to rotate about the center, but in both cases a square bitmap will have portions clipped unless it is in 90° increments. I know the display size also has to be increased to accommodate the new layout, but am missing the last piece. I assume it is a bitmap transform to shift the effective origin so that the rotated bitmap fits in the new "window", but I'm not quite sure how to calculate the transform needed.
|
|
|
Post by hillridge on Mar 18, 2019 6:30:36 GMT -8
NM Answered my own question after a bit of coffee. The translate command that is used for moving the origin to the center for rotating about the center is also what is used to reposition the bitmap after rotation.
So the steps are: change the bitmap's display size to fit the new orientation load the identity matrix rotate bitmap translate to move origin set matrix display it
|
|