Sub Process_Globals
End Sub
Sub Globals
Dim canvas1 As Canvas
End Sub
Sub Activity_Create(FirstTime As Boolean)
canvas1.Initialize(Activity)
DrawArc(canvas1, 100dip, 100dip, 100dip, 180, 90, Colors.Blue)
Activity.Invalidate
End Sub
Sub DrawArc(cnvs As Canvas, x As Float, y As Float, radius As Float, startAngle As Float, endAngle As Float, Color As Int)
Dim s As Float,x1,y1 As Int
s = startAngle
startAngle = 180 - endAngle
endAngle = 180 - s
If startAngle >= endAngle Then endAngle = endAngle + 360
Dim p As Path
p.Initialize(x, y)
For i = startAngle To endAngle Step 10
x1=x+2 * radius * SinD(i)
y1=y+2 * radius * CosD(i)
cnvs.DrawPoint(x1,y1,Colors.yellow)
Log(i&" "&x1&" "&y1)
p.LineTo(x1 , y1)
Next
p.LineTo(x + 2 * radius * SinD(endAngle), y + 2 * radius * CosD(endAngle))
p.LineTo(x, y)
cnvs.ClipPath(p) 'We are limiting the drawings to the required slice
cnvs.DrawCircle(x, y, .5*radius, Colors.red, False, 0)
cnvs.RemoveClip
End Sub