Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private pnlTest As B4XView
Private cvsTest As B4XCanvas
Private bmcTest As BitmapCreator
Private xFont As B4XFont
Private rctText, rctDest As B4XRect
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
cvsTest.Initialize(pnlTest)
bmcTest.Initialize(pnlTest.Width, pnlTest.Height)
Draw
End Sub
Private Sub Draw
xFont = xui.CreateDefaultFont(20)
cvsTest.DrawRect(cvsTest.TargetRect, xui.Color_Red, True, 1)
rctText = cvsTest.MeasureText("Test", xFont)
bmcTest.Initialize(rctText.Width, rctText.Height)
bmcTest.FillGradient(Array As Int(xui.Color_Blue, xui.Color_Magenta, xui.Color_Blue), bmcTest.TargetRect, "LEFT_RIGHT")
rctDest.Initialize(100dip + rctText.Left, 50dip + rctText.Top , 100dip + rctText.Right, 50dip + rctText.Bottom)
cvsTest.DrawBitmap(bmcTest.Bitmap, rctDest)
cvsTest.DrawText("Test", 100dip, 50dip, xFont, xui.Color_Yellow, "LEFT")
End Sub