Android Code Snippet [B4X] Rotate Bitmap

LucaMs

Expert
Licensed User
Author: Erel

B4X:
Sub RotateBitmap (bmp As B4XBitmap, Degrees As Float) As B4XBitmap
   Dim cvs As B4XCanvas
   Dim panel As B4XView = xui.CreatePanel("")
   panel.SetLayoutAnimated(0, 0, 0, bmp.Width, bmp.Height)
   cvs.Initialize(panel)
   cvs.DrawBitmapRotated(bmp, cvs.TargetRect, Degrees)
   cvs.Invalidate
   Dim b As B4XBitmap = cvs.CreateBitmap
   cvs.Release
   Return b
End Sub
 

LucaMs

Expert
Licensed User
Why not use B4XBitmap.Rotate ?
Wait a moment... 😁

because I immediately searched the site instead of looking (assuming) that that method existed.

I also tried to explain that it was a quick test, so much so that I didn't even look at the downloaded png.

Erel, then delete this snippet, since this method exists.
 
Last edited:
Top