PC Logo Wiki
Advertisement

Syntax

FILL

(FILL number)

Explanation

FILL fills an area on the graphics screen. The area is FILLed with the current pen mode, color and pattern. FILL starts at the current turtle position and stops at a closed border of the current pen color.

If FILL has an argument, FILL stops at a closed border of the pen color given as input. FILL and its argument must be enclosed in parentheses.

If the turtle's pen state is PENDOWN, FILL colors the area the current pen color. If the pen state is PENERASE, FILL colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, FILL colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle's pen state is PENUP, FILL has no effect.

If the turtle is on a horizontal or vertical line, C changes the color of the line and other connected vertical and horizontal lines to the current pen color. If the line is slanted, C has no effect.

Example

TO FILL.SQUARE

REPEAT 4 [FD 40 RT 90]
PENUP RT 45 FD 20 PENDOWN
FILL
SETPC 0

END

This procedure first draws a square, then the turtle is moved inside this square and it is filled. To illustrate the position of the turtle after the fill, the pen color is set to 0.

? FILL.SQUARE

?

Pc logo 23

This is a result of the procedure.

Advertisement