Help Contents / Graphics / Drawing filled shapes / fill

fill
(fill "true)
(fill filltype)

fills in a region of the graphics window containing the turtle and bounded by lines that have been drawn earlier.  This is not portable; it doesn't work for all machines, and may not work exactly the same way on different machines. 

The command (fill "true) fills the area around the turtle defined by the color specified by penColor. Filling continues outward in all directions as long as the color is encountered. This style is useful for filling areas with multicolored boundaries. 

The third variant of fill takes an integer number as input, which specifies the applied flood fill method. It can be one of the following constants: 

	FILL_NORMAL FILL_SURFACE 
	FILL_TOLERANT FILL_SURFACE_TOLERANT 
	FILL_SMALL FILL_SMALL_SURFACE 
	FILL_SMALL_TOLERANT FILL_SMALL_SURFACE_TOLERANT 

The xxx_SURFACE types are like using (fill "true). 

Using the xxx_TOLERANT fill types  colors with a deviation are permitted. So you can use antialiased lines as boundary, or fill regions containing several colors near the pen color. The fill color tolerance can be set with the command setFillTolerance. 

The SMALL methods are a bit faster for small areas than the other methods. 

In most cases fill is not as fast and exact  as drawing a tesselated polygon, using Tesselation. 

Examples: 

	disLS 
	box 
	rt 45 
	pu fd 10 
	fill 

	clearScreen 
	enableLineSmooth 
	box 
	right 45 
	PenUp 
	forward 10 
	setFillTolerance 0.5 
	(fill FILL_TOLERANT) 
	PenDown 


next: Polygon
