Android Question Which is the correlation in x,y coordinates

Enthousiastic

Active Member
Licensed User
Hello , I am using the drawarc and drawText subs in activity and the dim in globals.

Dim csvArc as canvas
Dim mion1 As Float : mion1=35
Dim ChrPoint As String : ChrPoint="."

DrawArc(csvArc,125,130,110,279+mion1,41,Colors.Black,False)
csvArc.DrawText(ChrPoint,44,54,Typeface.DEFAULT_BOLD,20,Colors.Red,"LEFT")

Which is the correlation in x,y coordinates on DrawArc,DrawText,DrawPie , because as you see if i put in 125,130 in DrawText instead of 44,54 the "." will not be exactly at the arc.

The purpose is to use the arc as volume meter , and the above subs are as a try for the maximum level of volume meter corresponding for 279+35 angle.

The DrawArc an DrawPie are for the forum as follows :

Sub DrawArc(cnvs As Canvas, x As Float, y As Float, radius As Float, startAngle As Float, endAngle As Float, Color As Int,Fill As Boolean)
Dim s As Float
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
p.LineTo(x + 2 * radius * SinD(i), y + 2 * radius * CosD(i))
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, radius, Color, Fill, 0)
cnvs.RemoveClip
End Sub

Sub DrawPie(cvs As Canvas, x As Float, y As Float, a1 As Float, a2 As Float, r1 As Float, r2 As Float, col As Int, Fill As Boolean, Stroke As Float)
Dim p As Path
Dim a, stp As Float

If a2 < a1 Then
stp = -1
Else
stp = 1
End If

p.Initialize(x + r1 * CosD(a1), y - r1 * SinD(a1))
p.LineTo(x + r2 * CosD(a1), y - r2 * SinD(a1))
For a = a1 + 1 To a2 Step stp
p.LineTo(x + r2 * CosD(a), y - r2 * SinD(a))
Next
p.LineTo(x + r1 * CosD(a2), y - r1 * SinD(a2))
For a = a2 + 1 To a1 Step -stp
p.LineTo(x + r1 * CosD(a), y - r1 * SinD(a))
Next
cvs.DrawPath(p, col, Fill, Stroke)
End Sub


Many thanks Enthousiastic
 
Top