Encyclopaedia Index

GRAPHICS PRIMITIVES

A set of PIL commands was introduced with PHOENICS version 1.5, allowing introduction of graphics features.

The following Q1 file illustrates the use of PLINE, PTEXT and GDRAW. The statements about colour numbers relate to personal computers.

file-name polygon.q1, illustrating some of the graphics commands and also readvdu, do-enddo, label, etc


TALK=T;RUN( 1, 1);VDU=VGACURSR
REAL(X1,Y1,X2,Y2,ANGLE,DANGLE,YFACTOR,RADIUS)
INTEGER(ICOL,IDASH,NSIDES)
CHAR(ANS)
LABEL TOP
MESG(DRAW A POLYGON
DELAY(100)
YFACTOR=1.25;RADIUS=0.2
ICOL=1;IDASH=1
NSIDES=9
MESG(NO OF SIDES = :NSIDES: OK? IF NOT ENTER ANOTHER NUMBER
READVDU(NSIDES,INT,:NSIDES:)
NSIDES


MESG("RADIUS"= :RADIUS: OK? IF NOT ENTER ANOTHER VALUE
READVDU(RADIUS,REAL,:RADIUS:)
RADIUS


MESG(COLOUR NUMBERS: 0=BLACK, 1=WHITE,
MESG(COLOUR NUMBERS: 2=DARK BLUE, 3=LESS DARK BLUE
MESG(COLOUR NUMBERS: 4=LIGHTER BLUE , 5=LIGHT BLUE,
MESG(COLOUR NUMBERS: 6=BLUE/GREEN 7=GREEN ,
MESG(COLOUR NUMBERS: 8=GREEN/YELLOW 9=YELLOW/GREEN,
MESG(COLOUR NUMBERS: 10=YELLOW, 11=YELLOW/ORANGE
MESG(COLOUR NUMBERS: 12=ORANGE/BROWN 13=BROWN/ORANGE
MESG(COLOUR NUMBERS: 14=BROWN/RED , 15=RED
MESG(COLOUR NUMBERS: <0 or>15 NOT ALLOWED
MESG(COLOUR NUMBER = :ICOL: OK? IF NOT ENTER ANOTHER NUMBER
READVDU(ICOL,INT,:ICOL:)
ICOL
IF(ICOL.GT.16) THEN
MESG(ICOL MUST NOT EXCEED 16
GOTO TOP
ENDIF


MESG(LINE NUMBERS: 0=FULL, 1-4=DASHED (NOT AVAILABLE ON PC YET)
MESG(LINE NUMBER = :IDASH: OK? IF NOT ENTER ANOTHER NUMBER
READVDU(IDASH,INT,:IDASH:)
IDASH


TEXT(:NSIDES:-SIDED POLYGON
X2=0.4+RADIUS;Y2=0.5;ANGLE=0;DANGLE=2.0*3.14159/NSIDES
DO II=1,NSIDES
ANGLE=ANGLE + DANGLE
X1=X2;Y1=Y2
X2=0.4+RADIUS*COS(ANGLE);Y2=0.5+RADIUS*YFACTOR*SIN(ANGLE)
PLINE(X1,Y1,X2,Y2,ICOL,IDASH)
ENDDO
PTEXT(POLYGON N=:NSIDES:,0.3,0.5,1)
GDRAW
MESG(MORE? (Y/N)
READVDU(ANS,CHAR,Y)
IF(:ANS:.EQ.Y) THEN
GOTO TOP
ENDIF
STOP

For further information, see the PHENC entries for: GLINE, GTEXT, GVIEW,GDOM, GGRID, GPATCH, PLINE, PTEXT, GDRAW, GCLEAR


wbs