```
Sub ColorWheel As Bitmap
Dim Can As Canvas
Dim Bt As Bitmap
Dim D As Int = 240
Dim Center As Int = D/4
Dim Radius As Int = D/4
Dim X,Y As Int
Bt.InitializeMutable(d/2,d/2)
Can.Initialize2(Bt)
SetAntiAlias(Can)
For h=0 To d
For s=0 To d-10
X=Center+(s*Radius/D)*Cos(2*cPI*H/d)
Y=Center+(s*Radius/D)*Sin(2*cPI*H/D)
Can.DrawPoint(x,y ,HSLtoRGB(H,s,100,255))
' X2=Center+(s*Radius/D*Cos(2*cPI*(H-1)/d))
' Y2=Center+(s*Radius/D)*Sin(2*cPI*(H-1)/D)
' Can.DrawLine(X,Y,X2,Y2,HSLtoRGB(H,s+10,100,255),3)
Next
Next
Return Can.Bitmap
End Sub
Sub HSLtoRGB(Hue As Int, Saturation As Int, Luminance As Int, Alpha As Int ) As Int
Dim temp3(3) As Double , Red As Int, Green As Int, Blue As Int ,temp1 As Double, temp2 As Double ,n As Int
Dim pHue As Double, pSat As Double, pLum As Double , pRed As Double, pGreen As Double, pBlue As Double
pHue = Min(239, Hue) / 239
pSat = Min(239, Saturation) / 239
pLum = Min(239, Luminance) / 239
If pSat = 0 Then
pRed = pLum
pGreen = pLum
pBlue = pLum
Else
If pLum < 0.5 Then
temp2 = pLum * (1 + pSat)
Else
temp2 = pLum + pSat - pLum * pSat
End If
temp1 = 2 * pLum - temp2
temp3(0) = pHue + 1 / 3
temp3(1) = pHue
temp3(2) = pHue - 1 / 3
For n = 0 To 2
If temp3(n) < 0 Then temp3(n) = temp3(n) + 1
If temp3(n) > 1 Then temp3(n) = temp3(n) - 1
If 6 * temp3(n) < 1 Then
temp3(n) = temp1 + (temp2 - temp1) * 6 * temp3(n)
Else
If 2 * temp3(n) < 1 Then
temp3(n) = temp2
Else
If 3 * temp3(n) < 2 Then
temp3(n) = temp1 + (temp2 - temp1) * ((2 / 3) - temp3(n)) * 6
Else
temp3(n) = temp1
End If
End If
End If
Next
pRed = temp3(0)
pGreen = temp3(1)
pBlue = temp3(2)
End If
Red = pRed * 255
Green = pGreen * 255
Blue = pBlue * 255
Return Colors.ARGB(Alpha, Red,Green,Blue)
End Sub
Sub SetAntiAlias (c As Canvas)
Dim r As Reflector
Dim NativeCanvas As Object
r.Target = c
NativeCanvas = r.GetField("canvas")
Dim PaintFlagsDrawFilter As Object
PaintFlagsDrawFilter = r.CreateObject2("android.graphics.PaintFlagsDrawFilter", _
Array As Object(0, 1), Array As String("java.lang.int", "java.lang.int"))
r.Target = NativeCanvas
r.RunMethod4("setDrawFilter", Array As Object(PaintFlagsDrawFilter), Array As String("android.graphics.DrawFilter"))
End Sub
```