iOS Question B4XCanvas.DrawPathRotated ?

MitchBu

Well-Known Member
Licensed User
Longtime User
I am trying to wrap my head around Drawpath, but nothing draws apart from "Testing".

Here is what I have so far:


B4XCanvas.DrawLine:
    Log("-- Begin program")
  
    Canvas1.Initialize(Panel1)

    Dim left As Float = 200
    Dim top As Float = 200
  
    Dim myPath As B4XPath
    myPath.Initialize(left, top)
    myPath.LineTo(400, 200)
    Canvas1.DrawPath(myPath, Colors.Black, True, 100)
  
    Canvas1.DrawText("Testing", 200dip, 100dip, Font.DEFAULT, Colors.Red,"LEFT")
    Canvas1.Invalidate

What am I doing wrong ?

TIA :)
 

roumei

Active Member
Licensed User
If you want to draw a filled path you need to add at least three points. If you want to draw just a line, you should set 'Filled' to false and reduce the 'StrokeWidth'.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
See test:

B4X:
    Dim Canvas1 As B4XCanvas
    Canvas1.Initialize(Panel1)
 
    Dim myPath As B4XPath
    myPath.Initialize(50dip, 50dip).LineTo(200dip,50dip).LineTo(200dip, 95dip).LineTo(50dip,95dip)
    Canvas1.DrawPath(myPath, xui.Color_Black, False, 2dip)
    Canvas1.DrawText("Testing", 55dip, 80dip, xui.CreateDefaultFont(32), xui.Color_Black,"LEFT")
    Canvas1.Invalidate

1616254667152.png
 
Upvote 0
Top