I would like to draw a dashed circle.
I have come up with this algorithm which uses initializearc, but it does not feel very efficient. Is there a better way?
I have come up with this algorithm which uses initializearc, but it does not feel very efficient. Is there a better way?
B4X:
Dim c As B4XCanvas
c.Initialize(xview) ' view to draw on, assume a square
Private path As B4XPath
Private i As Int
For i = 0 To 360 Step 30
path.InitializeArc(c.targetrect.CenterX,c.TargetRect.CenterY,(c.TargetRect.Width / 2)-1dip,i,20)
c.DrawPath(path,outlinecolour,False,2dip) ' Draw arc, not filled
Next
'remove all of the "spokes"
Private pathin As B4XPath
Private rt As B4XRect
rt.Initialize(2dip,2dip,c.TargetRect.Right-2dip,c.TargetRect.Bottom-2dip)
pathin.InitializeOval(rt)
c.ClipPath(pathin)
c.ClearRect(rt)
c.RemoveClip
c.Invalidate
c.Release