Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CircleFill
#1
Code: (Select All)
SUB CircleFill (CX AS LONG, CY AS LONG, R AS LONG, C AS LONG)
DIM Radius AS LONG, RadiusError AS LONG
DIM X AS LONG, Y AS LONG

Radius = ABS(R)
RadiusError = -Radius
X = Radius
Y = 0

IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB

' Draw the middle span here so we don't draw it twice in the main loop,
' which would be a problem with blending turned on.
LINE (CX - X, CY)-(CX + X, CY), C, BF

WHILE X > Y
   RadiusError = RadiusError + Y * 2 + 1
   IF RadiusError >= 0 THEN
       IF X <> Y + 1 THEN
           LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
           LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
       END IF
       X = X - 1
       RadiusError = RadiusError - X * 2
   END IF
   Y = Y + 1
   LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
   LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
WEND

END SUB
Reply


Messages In This Thread
CircleFill - by SMcNeill - 04-20-2022, 02:15 AM
RE: CircleFill - by James D Jarvis - 04-23-2022, 12:41 PM
RE: CircleFill - by SMcNeill - 11-15-2022, 11:24 PM



Users browsing this thread: 1 Guest(s)