FillArea()

Syntax

FillArea(x, y, BorderColor [, Color])
Description
Fill an arbitrary area starting from x,y location until the BorderColor is encountered. This is useful for filling any kind of shape.

If the 'Color' parameter is not specified, the default color set with FrontColor() will be used. RGB() can be used to get a valid color value. A color table with common colors is available here.

If the 'Color' parameter is set to -1, then the area defined by the color found at the (x,y) coordinates will be filled.

The current output is set with StartDrawing().

Example:
  Width = 270
  Height = 270
  If OpenWindow(0, 0, 0, Width, Height, "FillArea", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If StartDrawing(WindowOutput(0))
      x = Width/2
      y = Height/2
      Circle(x, y, 125 ,$00FF00)
      Circle(x, y, 120 ,$FF0000)
      LineXY(x-120, y, x+120, y, $FFFFFF)
      FillArea(x, y+5, -1, $0000FF) ; Replace -1 by $00FF00, and compare the result
      StopDrawing() ; It is absolutely essential when the drawing operations are finished!!! Never forget it! 
    EndIf
   
    Repeat : Event = WaitWindowEvent() : Until  Event = #PB_Event_CloseWindow
  EndIf

Supported OS

Windows, Linux, MacOS X

<- Ellipse() - 2DDrawing Index - FrontColor() ->