FILL

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

For use with graphics windows and graphic-boxes, FILL colors the entire window or graphicbox. Fill will cover over any graphics currently displayed.
There are three graphics commands that deal with color:
color
backcolor
fill

Syntax

Color commands are NOT case sensitive.
  1. #handle "fill color" - a graphics window
  2. #handle.ext "fill color" - a graphicbox
Color can be specified using any one of the standard system colors or using the RGB pure color method. See Colors. e.g.:
#handle.ext "backcolor cyan"
#handle.ext "backcolor 127 0 127"
'using a variable for value of color
color$="darkgray"
rgb$="155 30 155"
#handle.ext "color "; color$
#handle.ext "color "; rgb$

Hints

Color set with color commands can be changed with each new graphic command. Run this example:
    nomainwin

    WindowWidth=400
    WindowHeight=300

    graphicbox #g.gb1 0, 0, 182, 245
    graphicbox #g.gb2 182, 0, 180, 245
    open "Change Colors Demo" for graphics as #g
    #g "trapclose [quit]"

    #g.gb1 "fill yellow"
    #g.gb2 "fill cyan"
    wait
[quit]
    close #g
    end

Example

An example of the command in a graphics window.

    nomainwin

    WindowWidth=400
    WindowHeight=300

    open "Fill Demo" for graphics as #g
    #g "trapclose [quit]"

    'fill window with color
    #g "fill  0 127 255"
    wait

[quit]
    close #g
    end

An example of the command in a graphicbox.

    nomainwin

    WindowWidth=400
    WindowHeight=300

    graphicbox #g.gb 2, 2, 390, 270
    open "Fill Demo" for window_nf as #g
    #g "trapclose [quit]"

    'fill graphicbox with color
    #g.gb "fill cyan"
    wait

[quit]
    close #g
    end

An example combining all three color commands in a graphics window.

    nomainwin

    WindowWidth=400
    WindowHeight=300

    open "All Color Demo" for graphics as #g
    #g "trapclose [quit]"

    'fill window with color
    #g "fill cyan"
    'set the pen color
    #g "color red"
    'set the backcolor
    #g "backcolor yellow"
    'put the pen down and place it in the center of the window
    #g "down; home"
    'draw a filled circle
    #g "circlefilled 40"
    'draw some text
    #g "place 20 20;\The cyan window color is set by FILL command."
    #g "\\The red text color and the red outline of the circle"
    #g "\is set with the COLOR command."
    #g "place 20 200;\The circle is filled with the BACKCOLOR yellow."
    #g "place 20 230;\The color behind the text is the BACKCOLOR yellow."
    #g "flush" 'make graphics stick
    wait

[quit]
    close #g
    end

Useful Procedures

' Place a useful function or sub using this keyword here