Circle()

Syntax

Circle(x, y, Radius [, Color])
Description
Draw a circle on the current output. The filling mode is determined by DrawingMode(). The current output is set with StartDrawing().

Parameters

x, y The position of the center pixel of the circle.
Radius The radius of the circle. This radius does not include the center pixel.
Color (optional) The color to be used for the circle. If this parameter is not specified, the default color set with FrontColor() will be used. This color can be in RGB or RGBA format.

Return value

None.

Example

  If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
      Box(0, 0, 200, 200, RGB(255, 255, 255))
      For Radius = 100 To 10 Step -10
        Circle(100, 100, Radius, RGB(Random(255), Random(255), Random(255)))
      Next
      StopDrawing() 
      ImageGadget(0, 0, 0, 200, 200, ImageID(0))
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

Box(), RoundBox(), Line(), Ellipse() FrontColor(), RGB(), RGBA(), DrawingMode()

Supported OS

All

<- BoxedGradient() - 2DDrawing Index - CircularGradient() ->