Private Sub ParseCommand(cmd As String, Args As List)
count = count + 1
' Log("ParseCommand: " & cmd & " ARGS: " & Args)
' Try
Select cmd
Case "Clear"
Dim rect As B4XRect
rect.Initialize(0, 0, pnl.Width, pnl.Height)
cvs.DrawRect(rect, Args.Get(0), True, 0)
Case "ClearRect"
cvs.ClearRect(Args.Get(0))
' Case "ClipPath"
' cvs.ClipPath(Args.Get(0))
Case "DrawBitmap"
cvs.DrawBitmap(Args.Get(0), Args.Get(1))
Case "DrawBitmapRotated"
cvs.DrawBitmapRotated(Args.Get(0), Args.Get(1), Args.Get(2))
Case "DrawCircle"
cvs.DrawCircle(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), Args.Get(5))
Case "DrawLine"
cvs.DrawLine(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), Args.Get(5))
' Case "DrawPath"
' cvs.DrawPath(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3))
' Case "DrawPathRotated"
' cvs.DrawPathRotated(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), Args.Get(5), Args.Get(6))
Case "DrawRect"
cvs.DrawRect(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3))
Case "DrawRectRotated"
Dim path As B4XPath
Dim rect As B4XRect = Args.Get(0)
rect.Initialize(rect.Left, rect.Top, rect.Right, rect.Bottom)
path.InitializeRoundedRect(rect, 0)
cvs.DrawPathRotated(path, Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), rect.CenterX, rect.CenterY)
Case "DrawRoundRect" ' DrawRoundRect(Rect As B4XRect, Color As Int, Filled As Boolean, StrokeWidth As Float, CornerRadius As Float)
If Args.Get(0) Is B4XRect Then
Log("(Point 2) Found rect")
Else
Log("(Point 2) Is not a rect") ' Bad. It is not recognized as B4XRect and this line will show on the log
End If
Dim path As B4XPath
Dim r As B4XRect = Args.Get(0)
Dim left As Float = r.Left
Dim top As Float = r.Top
Dim right As Float = r.Right
Dim bottom As Float = r.Bottom
r.Initialize(left, top, right, bottom)
path.InitializeRoundedRect(r, Args.Get(4))
cvs.DrawPathRotated(path, Args.Get(1), Args.Get(2), Args.Get(3), 0, rect.CenterX, rect.CenterY) ' 0 degrees
Case "DrawRoundRectRotated" ' DrawRoundRectRotated(Rect As B4XRect, Color As Int, Filled As Boolean, StrokeWidth As Float, CornerRadius As Float, Degrees As Float)
If Args.Get(0) Is B4XRect Then
Log("(Point 2) Found rect")
Else
Log("(Point 2) Is not a rect") ' Bad. It is not recognized as B4XRect and this line will show on the log
End If
Dim path As B4XPath
Dim r As B4XRect = Args.Get(0)
Dim left As Float = r.Left
Dim top As Float = r.Top
Dim right As Float = r.Right
Dim bottom As Float = r.Bottom
r.Initialize(left, top, right, bottom)
path.InitializeRoundedRect(r, Args.Get(4))
cvs.DrawPathRotated(path, Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(5), rect.CenterX, rect.CenterY)
Case "DrawText"
cvs.DrawText(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), "LEFT")
Case "DrawTextRotated"
cvs.DrawTextRotated(Args.Get(0), Args.Get(1), Args.Get(2), Args.Get(3), Args.Get(4), Args.Get(5), Args.Get(6))
Case ""
End Select
' Catch
' Log("ERROR -> " & LastException)
' End Try
End Sub