home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
090.lha
/
EHBarGph.mod
< prev
next >
Wrap
Text File
|
1986-11-20
|
3KB
|
114 lines
MODULE pix;
FROM SYSTEM IMPORT BYTE, ASH, ADR;
FROM CommandLine IMPORT CLStrings, GetCL;
FROM M2Conversions IMPORT ConvertToReal;
FROM HiRes IMPORT sp, wp, graphics, bye;
FROM MathLib0 IMPORT real, entier, sin, cos;
FROM Pens IMPORT SetAPen, Draw, Move, RectFill;
FROM Views IMPORT Modes, ModeSet, ViewPortPtr;
FROM Rasters IMPORT RastPortPtr, SetRast;
FROM Colors IMPORT SetRGB4;
FROM InOut IMPORT Done, ReadCard, OpenInputFile, CloseInput;
FROM RealInOut IMPORT ReadReal, WriteReal;
IMPORT Trapper;
CONST
WIDTH = 300;
HEIGHT = 380;
DEPTH = 6;
VAR
ok: BOOLEAN;
argc,c,i,v,w,xmin,ymin,xmax,ymax : CARDINAL;
argv: ARRAY [0..1] OF CLStrings;
Vptr : ViewPortPtr;
Rptr : RastPortPtr;
mx,mi,k,maxy: REAL;
n: ARRAY [0..62] OF REAL;
PROCEDURE InitColor;
VAR
q,i,r,g,b : CARDINAL;
rc,gc,bc,j,k: REAL;
BEGIN
SetRGB4(Vptr,0,0,0,0);
FOR i := 1 TO 31 DO
q := i - 1;
j := FLOAT(q);
IF q > 9 THEN
rc := 0.0;
ELSE
rc := 10.0 - j;
END;
IF (q > 12) OR (q < 2) THEN
gc := 0.0;
ELSE
gc := j - 2.0;
END;
IF (q < 6) OR (q > 20) THEN
bc := 0.0;
ELSE
bc := j - 6.0;
END;
IF q > 15 THEN
bc := 15.0 - (j - 15.0);
rc := bc;
END;
r := TRUNC(rc); g := TRUNC(gc); b := TRUNC(bc);
SetRGB4(Vptr,i,r,g,b);
END ;
END InitColor;
BEGIN
IF GetCL(argc,argv) THEN
IF argc > 0 THEN
OpenInputFile(argv[0]);
ReadCard(argc);
IF argc < 62 THEN
mi := MAX(REAL); mx := MIN(REAL);
maxy := FLOAT(HEIGHT) - 10.0;
FOR i := 0 TO argc - 1 DO
ReadReal(n[i]);
IF n[i] < mi THEN mi := n[i] END;
IF n[i] > mx THEN mx := n[i] END;
END;
CloseInput;
k := maxy/(mx - mi);
w := WIDTH DIV (argc - 2);
graphics(DEPTH,ModeSet{Lace,ExtraHalfBright});
Vptr := ADR(sp^.VPort); (* ViewPortPtr *)
Rptr := ADR(sp^.RPort); (* RastPortPtr *)
InitColor;
FOR i := 0 TO argc - 1 DO
v := TRUNC(k * (n[i] - mi));
xmin := i * w + 5; xmax := xmin + (w - 2);
ymax := TRUNC(maxy) + 10;
c := i + 1;
IF c > 31 THEN c := c + 1 END;
SetAPen(Rptr,c);
RectFill(Rptr,xmin,ymax - v,xmax,ymax);
END;
bye()
END
END
END;
END pix.