Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI '<--- xui library
Private ImageView1 As B4XView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
MainForm.RootPane.LoadLayout("1")
ImageView1.SetBitmap(RotateBitmap(xui.LoadBitmap(File.DirAssets, "smiley.png"), 45))
End Sub
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