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 have a cube don't draw all 6 faces, only 3 at most can be in view, so draw just those 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