Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim xui As XUI
Dim cvs As Canvas
Dim xuiCvs As B4XCanvas
Private Pane1 As Pane
Private Pane2 As Pane
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") ' Load the layout file.
MainForm.Show
cvs.Initialize("")
Pane1.AddNode(cvs,0,0,Pane1.PrefWidth, Pane1.PrefHeight)
cvs.DrawRect(0,0, cvs.Width, cvs.Height, fx.Colors.Black, True, 0)
cvs.DrawText("Canvas", 10, 25, fx.DefaultFont(20), fx.Colors.Cyan, "LEFT")
xuiCvs.Initialize(Pane2)
Dim rect As B4XRect
rect.Initialize(0, 0, xuiCvs.TargetRect.Width, xuiCvs.TargetRect.Height)
xuiCvs.DrawRect(rect, xui.Color_Black, True, 0)
xuiCvs.DrawText("B4XCanvas", 10, 25, xui.CreateDefaultFont(20), xui.Color_Cyan, "LEFT")
Dim start, elapsed As Long
' start = DateTime.Now
' For i = 1 To 500
' Wait For (DrawRectRotatedCanvas) Complete()
' Next
' elapsed = DateTime.Now - start
' Log("Draw 500 rotated rectangles on Canvas required " & elapsed & " Milliseconds")
' rect.Initialize(100, 100, 300, 400)
' path.InitializeRoundedRect(rect, 0)
Dim path As B4XPath
Dim rect As B4XRect
rect.Initialize(100, 100, 300, 400)
path.InitializeRoundedRect(rect, 0)
start = DateTime.Now
For i = 1 To 500
DrawRectRotatedB4XCanvas(rect,path)
Next
elapsed = DateTime.Now - start
Log("Draw 500 rotated rectangles on B4XCanvas required " & elapsed & " Milliseconds")
End Sub
Sub DrawRectRotatedCanvas()
cvs.DrawRectRotated(100, 100, 200, 300, fx.Colors.Red, True, 0, 45)
End Sub
Sub DrawRectRotatedB4XCanvas(rect As B4XRect, path As B4XPath)
xuiCvs.DrawPathRotated(path, xui.Color_Blue, True, 0, 45, rect.CenterX, rect.CenterY)
End Sub