How to rotate bitmap and display currect aspect ratio

wheretheidivides

Active Member
Licensed User
Longtime User
Here is sample code of that uses the RSImageProcessing Library.

http://www.b4x.com/forum/addit...html#post92197

There are no instructions but someone asked for the code as it's an issue. So here it is. I took out anything that wasn't relevant. You should be able to figure it out, if not message here and I'll comment the code when I get time. It shows how to rotate a bitmap that is an imageview inside a panel. The smaller panel stays where it is and a bigger panel pops up. It doesn't zoom the smaller panel. The reason is that you can have a imageview bitmap in a panel. That panel can be put in the script designer as centered. So the problem is that putting a bitmap/imageview in a panel you are limited to the size of the panel. You can't go full screen. If you do then there are issues. I usually have a border panel underneath the picture that is 5 pixels larger in black to gibe a border effect. So I have a 2nd panel set up that turns on and off. It corrects for the aspect ratio of the image so that it always fills up width 100%. then it calculates the height from the aspect ratio to give a proper viewing.

There are just 2 settings, centered and 270 degress rotated. If you want to rotate at 90 degrees each click, then you have to set up another routine that adds 90 to degress (float) and reverse H/W each time. This was a lot easier. Also, I have orientation set at portrait.

1) main panel
2) small panel with imageview in it
3) click small panel and image becomes big
4) click on roate left, center, or right to rotate with correct aspect ratio. The panel is full screen but the imageview in it will just stay be correct. It always fills the width and then adjusts the height.
5) click on small to get rid of big picture
 

Attachments

  • RotateBitmapPanelIV.zip
    141.1 KB · Views: 511
Last edited:
Upvote 0
Top