FILL

Synopsis
FILL
(FILL fillmode)
Description

Fills in a region of the graphics window containing the turtle and bounded by lines that have been drawn earlier. It fills using the current value of FLOODCOLOR.

If fillmode is TRUE, then FILL fills until the current PENCOLOR is encountered. If fillmode is FALSE, then FILL fills while on same color. If fillmode is not given, it defaults to FALSE.

FILL can be used in PERSPECTIVE mode as long as the area to filled is bounded and you only fill what's in plain view. For example, if you want to draw a cube, don't draw all six faces since at most three can be in view. Instead, draw just those three faces and fill them.

Example

Fill a square:

REPEAT 4 [FORWARD 100 RIGHT 90]
RIGHT 45
PENUP
FORWARD 20
FILL

Fill while on the same color:

SETFLOODCOLOR 4
SETPENCOLOR 1
CIRCLE 50
SETPENCOLOR 2
CIRCLE 100
FILL

Fill until the lines match PENCOLOR:

SETFLOODCOLOR 4
SETPENCOLOR 1
CIRCLE 50
SETPENCOLOR 2
CIRCLE 100
(FILL "TRUE)

A 3D example:

TO SQUARE :color
  REPEAT 4 [FORWARD 100 RIGHT 90]
  PENUP
  RIGHT 45
  FORWARD 50
  SETFLOODCOLOR :color
  FILL
  BACK 50
  LEFT 45
  PENDOWN
END

PERSPECTIVE
RIGHTROLL 45
DOWNPITCH 45
SQUARE 1
RIGHTROLL 90
SQUARE 2
UPPITCH 90
SQUARE 3


SourceForge.net Logo