
Graphics
Printing taller patterns
The next example shows how several lines of graphics can be
formed into a figure taller than eight dots. It uses programming
techniques for producing textured or repetitive patterns.
In the following program, the lines inside each pair of FOR and
NEXT statements have been indented so that you can see how the
program works; the spaces are not needed for the program to run.
100 WIDTH "LPT1:"
110LPRINTCHR$;2;;&;CHR$(8);
120FORR=lTO6
130
LPRINT CHR$(27);"K";CHR$(lOO);CHR$(O);
140
FORX=lTO
50
150
LPRINTCHR$(170);CHR$(85);
160
NEXT X : LPRINT
170 NEXT R
180 LPRINT
CHR$(27);"@"
If you run the program you will see how it combines six print
lines into a pattern.
There are five basic steps that the program goes through to
produce this kind of pattern:
1.
The computer is prevented from adding any extra characters by
the WIDTH statement (line
100).
2.
The line spacing is changed to 8/72 of an inch. This is the
height of the dot patterns used in the program (line
110).
3. The program goes through the graphics command the required
number of times (line
120
and
170).
Software and Graphics
4-15