★ APPLICATIONS ★ PROGRAMMATION ★ CPC464 FILL SUBROUTINE (AUSTRALIAN PERSONAL COMPUTER) ★ |
CPC464 Fill Subroutine (Australian Personal Computer) | Applications Programmation |
This fill subroutine will fill any shape, including ones with holes and dangling lines. It can fill with any colour, and will work on shapes with multicoloured outlines. It also works in all three screen modes with only minor modification. It works by looking for the largest block in the shape. While filling it, it detects spaces around this block which need to be filled, and pushes these onto a stack. When the block is filled, the stack is popped and the next block is filled, following the same process. This continues until the stack is empty. To use the utility, enter seed coordinates (starting point to fill from) as xseed% and yseed%, background colour as bacol%, and fill colour as incol%, and then GOSUB the line where the subroutine starts. The program consists of three parts. The first is an example of filling a shape with a multi-coloured outline; the second is a routine to generate random shapes and fill them — this part can be stopped by pressing ESC twice; and the third part is the routine itself (2.5k long). Australian Personal Computer
|