Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private cv As B4XCanvas
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Dim TimesRoman As B4XFont = xui.CreateFont(Typeface.SERIF, 23)
Dim w As Float = 300dip
Dim h As Float = 400dip
Dim basePanel As B4XView = xui.CreatePanel("")
basePanel.SetColorAndBorder(xui.Color_Transparent, 1dip, xui.Color_Black, 10dip)
Root.AddView(basePanel, Root.Width / 2 - w /2, Root.Height / 2 - h / 2, w, h)
cv.Initialize(basePanel)
drawCurvedText("ALPHR GUIDES", basePanel.Width / 2, .67 * basePanel.Height, 100dip, 225, xui.Color_Blue, TimesRoman)
cv.DrawCircle(basePanel.Width / 2, .67 * basePanel.Height, 97dip, xui.Color_LightGray, True, 0)
cv.Invalidate
End Sub
Private Sub drawCurvedText(s As String, pivotX As Float, pivotY As Float, radius As Float, startSweep As Float, textColor As Int, textFont As B4XFont)
Dim x, y As Float
For i = 0 To s.Length - 1
x = pivotX + radius * CosD(startSweep)
y = pivotY + radius * SinD(startSweep)
Dim letter As String = s.CharAt(i)
cv.DrawTextRotated(letter, x, y, textFont, textColor, "LEFT", startSweep + 90)
Dim letWid As Float = cv.MeasureText(letter, textFont).width
startSweep = startSweep + (letWid + 3dip) * (360 / (2 * cPI * radius))
Next
End Sub