Android Question [XUI] Canvas : how to draw dotted line as circle?

wimpie3

Well-Known Member
Licensed User
Longtime User
I'm trying to draw this on a XUI Canvas:

1649835946387.png

It should be fast with a minimum amount of calculations. I was thinking of using drawpathrotated to draw paths but I can't get it working. Anyone up for a challenge?
 

Alexander Stolte

Expert
Licensed User
Longtime User
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
I came up with this but I'm not sure it is the most optimized way to do it:

B4X:
Dim p As B4XPath
p.InitializeArc(cx, cy, radius, 0, 15) ' slice measures 15 degrees
For t = 0 To 348 Step 30
    cvs.drawpathrotated(p,Colors.Black,False,thickness,t,cx,cy) ' rotate the slice 30 degrees each step
Next
cvs.DrawCircle(cx,cy,radius-(thickness/2),Colors.White,True,0)
 
Upvote 0
Top