Tutorial - Filling Shapes

A number of the built-in shapes represent a closed area, such as a circle. Given such a shape we may want to fill it in. This tutorial covers the basics of filling.

The Fill Parameter

Any shape that can be filled has a fill parameter. This generally comes after all the parameters that control the outline of the shape ( such as the radius for a circle ).

The value of this parameter may be one of the following identifiers :- 'Hollow', 'Solid' or 'Filled'. The default value is 'Hollow' so this may be omitted ( as it has been so far ).

The 'Hollow' option will just draw the circumference and leave the inside alone.
The 'Solid' option will fill the inside with the current pen colour, making a solid disk.
The 'Filled' option will fill the interior or the circle with the current brush. We are still using the default brush so the interior will be solid grey.

Program()
	TPen workpen = Pen { width -> 5, colour -> {100, 0, 0} };
    Begin
	With workpen Do
		Circle(30)	   => { 40, 100};
		Circle(30, Hollow) => {120, 100};	
		Circle(30, Solid)  => {200, 100};
		Circle(30, Filled) => {280, 100};
	EndWith;
    End;
filling_1.grs Output of filling_1.grs filling_1.png

Some Other Fillable Shapes

There are a number predefined fillable shapes. The simplest being Rectangle, Ellipse and Sector.

filling_2.grs Output of filling_2.grs filling_2.png