u-jmolse@cs.utah.edu (John M. Olsen) (09/05/87)
[In this file is the executable, the data and the source are in the
sources group. ]
Here is a line drawing demo that I slapped together to read some data I saw
posted to the net. The data is a mercator projection of the USA.
/| | /||| /\| | John M. Olsen
\|()|\|\_ |||. \/|/)@|\_ | 1547 Jamestown Drive
| | Salt Lake City, UT 84121-2051
u-jmolse@ug.utah.edu or ...!{seismo,ihnp4}!utah-cs!utah-ug!u-jmolse
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# README
# LineDrawer.uu
# This archive created: Sat Sep 5 14:49:33 1987
# By: Craig Norborg (Purdue University Computing Center)
cat << \SHAR_EOF > README
This README file has been extracted from the comments in linedrawer.c, but
has a few clarifications.
LineDrawer by John M. Olsen. V1.0 July 5, 1987
John M. Olsen
1547 Jamestown Drive
Salt Lake City, UT 84121-2051
Network addresses:
u-jmolse@ug.utah.edu or ...!{seismo,ihnp4}!utah-cs!utah-ug!u-jmolse
This is public domain software. Do whatever you want with it.
Just don't complain to me when it breaks after a few hundred people
have hacked on it. :^)
This program takes a data file as a parameter and makes a line drawing
based on the commands in the file. The instruction format is listed
below. There should be two data files included. One is a Mercator
projection of the USA, and the other is a really short demo of how to use
the color changing and line patterning commands.
Manx Instructions:
cc LineDrawer.c
ln LineDrawer.o -lc
It should (no guarantees) work fine with Lettuce C since I used only
longs, and have (hopefully) everything type cast correctly.
Data file format:
lines may have white space just about anywhere. Each command line begins
with a number followed by a number of parameters. Any line not starting
with an appropriate number (after white space, if any) is considered to
be a comment. Lines may also have a comment after the data. No error
checking is done, so it is guaranteed to do strange things if the data is
messed up.
1 <minx> <miny> <maxx> <maxy>. Specify the range the coordinates fall into.
Reversing the miny and maxy will flip a picture vertically, making
the origin be at the bottom left corner instead of the top left.
2 <x> <y>. Draw a line from current position to x,y.
3 <x> <y>. Move pen to position x,y.
4 <color>. Foreground pen color.
5 <color>. Background pen color.
6 <pattern>. Line pattern. This is an unsigned word 0 to 65536 (0 to $ffff)
7 <mode>. This can change the way 4 to 6 appear by using only foreground,
or complimenting colors, etc. It can do some strange stuff.
The current (unguaranteed) values usable here are:
JAM1: 0
JAM2: 1
COMPLIMENT: 2
INVERSVID: 4
You can add these, so 3 = JAM2 and COMPLIMENT.
SHAR_EOF
cat << \SHAR_EOF > LineDrawer.uu
begin 600 LineDrawer
M #\P # ( :> S $ /I &GD[Z"TA,
M:6YE1')A=V5R(&)Y($IO:&X@32X@3VQS96X@5C$N, 3E7_K$IM AF"C\\
M %.NA;^5$](>@#P(&T "B\H 1.N@H<4$\K0/^L9@H_/ !3KH6W%1/+RW_
MK$ZZ$JQ83TAX "!(>@#"3KH9(E!/*4"#*F< *9(> @2'H O4ZZ&0Q03RE
M@R9G "&2&R DZZ&=)83RE @QYG:B\M H_+0 (3KH IEQ/2JR#(F8D(&R#
M'B\H %9.NAD$6$\I0(,B(&R#'B\H %9.NABP6$\I0(,B(&R#(@RH " 4
M9Q O+(,B3KH8N%A/0JR#(F"J+RR#(DZZ&*A83R\L@QY.NAE66$\O+(,F3KH8
M+EA/+RR#*DZZ&"183T)G3KH6$%1/3EU.=7( 9W)A<&AI8W,N;&EB<F%R>0!I
M;G1U:71I;VXN;&EB<F%R>0 3E7_>"!L@QXK: R_]Q"IR\M_]Q.NAC 4$](
M> !+RW_W$ZZ&()03T*G+RW_W$ZZ&(903TAZ FX@;0 *+R@ !$ZZ"-!03RM
M__QG )4+RW__$ZZ!])83TC *T#_Z+"\_____V< C @;(,>+R@ 5DZZ%[Y8
M3RE @R)*K(,B9@ "%B M_^A@ '$2&W_[$AM__!(;?_T2&W_^$AZ @HO+?_\
M3KH"@D_O !A@ 'F2&W_X$AM_^1(>@'[+RW__$ZZ F9/[P 0(&R#'C H ')(
MP"(M_^"2K?_T3KH.["(M_^R2K?_T3KH/N"\ (FR#'C I '!(P"(M_^22K?_X
M3KH.R"(M__"2K?_X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