代码:
Sub myCircle(ByVal x0, ByVal y0, ByVal r)
Dim js, f, t, x, k, y_, j, y, c
js = Array(-1, 1, 0)
For f = 0 To 1
If f Then t = x0: x0 = y0: y0 = t
For x = Round(x0 - r * 0.71) To Round(x0 + r * 0.71)
For k = -1 To 1 Step 2
y_ = Round(y0 + Sqr(Abs(r ^ 2 - (x - x0) ^ 2)) * k)
For Each j In js
y = y_ + j
c = Abs(r - Sqr((x - x0) ^ 2 + (y - y0) ^ 2))
If c < 1 Then
c = Round(c * 255)
PSet (IIf(f, y, x), IIf(f, x, y)), RGB(c, c, c)
End If
Next j
Next k
Next x
Next f
End Sub
Private Sub Form_Load()
AutoRedraw = True
ScaleMode = 3
BackColor = vbWhite
Circle (100, 100), 90
myCircle 200, 100, 90
End Sub
Sub myCircle(ByVal x0, ByVal y0, ByVal r)
Dim js, f, t, x, k, y_, j, y, c
js = Array(-1, 1, 0)
For f = 0 To 1
If f Then t = x0: x0 = y0: y0 = t
For x = Round(x0 - r * 0.71) To Round(x0 + r * 0.71)
For k = -1 To 1 Step 2
y_ = Round(y0 + Sqr(Abs(r ^ 2 - (x - x0) ^ 2)) * k)
For Each j In js
y = y_ + j
c = Abs(r - Sqr((x - x0) ^ 2 + (y - y0) ^ 2))
If c < 1 Then
c = Round(c * 255)
PSet (IIf(f, y, x), IIf(f, x, y)), RGB(c, c, c)
End If
Next j
Next k
Next x
Next f
End Sub
Private Sub Form_Load()
AutoRedraw = True
ScaleMode = 3
BackColor = vbWhite
Circle (100, 100), 90
myCircle 200, 100, 90
End Sub