Star Micronics Radix User Manual page 157

Table of Contents

Advertisement

Printing With Dot Graphics
143
40 OPEN "LPTl:" AS #l : WIDTH #1,255
50 PRINT #l,CHR$(27) "K" CHR$(WID MOD 256)
CHR$(INT(WID/256)) ;
60 FOR I = 0 TO WID-1
70 PRINT #1,CHR$(2AINT((l+SIN(I*PI/32))*J.5+.5))
88 NEXT I
90 LPRINT
100 CLOSE #l
In line 50 we've selected normal density graphics and said
that 100 characters of graphics data would follow. The loop
between lines 60 and 80 is repeated to plot 100 points along a
curve. This is an example of plotting a very simple mathematical
function (a sine wave) to create a design. Later in this chapter
we'll show something more complex. The mathematical concepts
(such as sine and pi) demonstrated here are not important; you
don't have to be a math whiz to use Radix's graphics.
Combining
text and gmphics
It's also possible to mix text and graphics in one line. This can
be useful for labeling charts or graphs, or even inserting fancy
graphics in text. Try adding these lines to our program:
45 PRINT #l,"WOW!" ;
85 PRINT #l,t'Thi.s
is great!" ;
Now if you run the program you should get a printout that
looks like this:
WOW f --I-----------------------T
h i 5 i 5 g p eat
!
But there is one thing to be careful of: all graphics data must
print on the same line. The graphics command is turned off at the
end of each line, even if you have specified that more graphics
codes follow. To see what we mean, change line 30 to plot 1000
points and run the program.

Advertisement

Table of Contents
loading

Table of Contents