samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 21, 2021 12:04:38 GMT -8
Hi,
When I rotate a bitmap, basically using the below methods or using translate, around its center or corner
GD.cmd_rotate(a);
GD.cmd_setmatrix(); It affects other standard widgets on the screen also, that are not close to the bitmap at all to get affected. I just tested this by showing a small 100*100 image. I just placed one button at another corner of the screen, far from the bitmap.
However, what happens is that the rotation of the bitmap wipes off the text of the button
Why?!
The only solution I found was using
GD.SaveContext(); before rotation, and using
GD.RestoreContext();
after bitmap rotation, before I show the button
|
|
|
Post by jamesbowman on Aug 21, 2021 19:54:37 GMT -8
Yes, the rotation is part of graphics state, like color etc. So after GD.cmd_setmatrix() everything drawn afterwards is rotated.
Using SaveContext() / RestoreContext() is the correct way to handle this - it preserves and restores all the graphics state.
|
|