\documentstyle[a4,12pt]{article} \begin{document} \author{Fred King} \title{The ``Fred'' level 1.5 graphics library} \maketitle \parskip .1 in \setcounter{secnumdepth}{10} \parindent 0in \section{Preamble} This is a cryptic description of the ``Fred'' level 1.5 graphics library. The library offers an alternative to EDWIN for fast level 1.5 graphics. The routines may be accessed from IMP or Pascal. \%include "level1:graphinc.imp" or \%include 'level1:graphinc.pas' respectively. The IFF library includes an emulation of most of these routines which will write the same images to an .IFF file (though it won't cope with fonts). \section{The routines (IMP)} \small\tt \begin{verbatim}@16_E30000 %integer %array colour map(0:255) @16_7F400 %short %integer mouse x @16_7F402 %short %integer mouse y %byte %integer %function mouse buttons %integer %function REL MOUSE X %integer %function REL MOUSE Y Returns the relative change in the mouse position since last call. %integer %function MOUSE BUT %routine VLINE (%integer x, y0, y1) Draws vertical line from (x, y0) to (x, y1). %routine HLINE (%integer x0, x1, y) Draws horizontal line from (x0, y) to (x1, y). %routine OFFSET (%integer x, y) Sets display area so that screen origin is at (x&(\15), y) within framestore. %routine COLOUR (%integer colour) Sets colour for drawing to 'colour'. %routine ENABLE (%integer planes) Allows writing to planes that have bits in 'planes' 1, disables other planes. %routine UPDATE COLOUR MAP (%half %integer %name new map) Writes 256 new half word entries into the colour map from an address starting with new map %routine CLEAR Sets whole of framestore to colour 0. The currently selected colour and enabled palnes are unaltered. %routine HALF CLEAR (%integer h) Clears half the frame store for fast animation If h = 0 the box (0, 0), (687, 511) is cleared If h = 1 the box (0, 512), (687, 1023) is cleared The currently selected colour and enabled planes are unaltered. %routine LINE (%integer x0, y0, x1, y1) Draws arbitrary line from (x0, y0) to (x1, y1). %routine FILL (%integer x0, y0, x1, y1) Draws filled orthogonal box with diagonal corners at (x0, y0, x1, y1). %routine COL FILL (%integer x0, y0, x1, y1, %byte %integer %name b) Draws a filled orthogonal box with diagonal corners at (x0,y0, x1,y1) using colour values from the area of memory starting with b. B should in effect be the first element of an array of width x1-x0+1 and height y1-y0+1. The first byte is the BOTTOM left corner of the box. [jhb] %routine B W FILL (%integer x0, y0, x1, y1, %byte %integer %name b, t) %routine TRIANGLE (%integer x0, y0, x1, y1, x2, y2) Draws filled triangle with vertices at (x0, y0), (x1, y1), (x2, y2). %routine TRAPEZE (%integer x00, x01, y0, x10, x11, y1) Draws a filled trapezium with vertices (x00,y0), (x01,y0), (x10,y1), (x11,y1). %routine DISC (%integer x, y, r) Draws a filled circle of radius r and centre (x, y). %routine RING (%integer x, y, r) Draws the outline of a circle of radius r and centre (x, y). %routine DRAWARC (%integer x, y, r, x0, y0, x1, y1) %routine ENDARC (%integer x0, y0, x1, y1, r) %routine ANGLEARC (%integer x, y, r, %real phi0, phi1) %routine PLOT (%integer x, y) Draws a single pixel at (x, y). %routine PAINT (%integer %name s, %integer x0, y0, x1, y1, offset, stride) %routine TEXTAT (%integer x,y) Sets the position for drawing text to (x, y). %routine READFONT (%string(255) file, %integer %name font) Reads pre-processed font from 'file' and returns heap address as integer in 'font'. %routine SHOWSYMBOL (%integer k) Draws character 'k' in currently selected font at currently selected screen position. As a result the text screen position is updated sothat subsequent showsymbol and showstring calls draw beyond the character. %routine SHOWSTRING (%string(255) s) Draws characters in 's' in currently selected font starting at currently selected screen position. As a result the text screen position is updated so that subsequent show symbol and showstring calls draw beyond the string. } %routine FONT (%integer f) Selects font used by subsequent calls to showsymbol and show string. 'f' is the integer address returned by 'readfont', above. If 'f' is 0 the default Visual 200 font is selected. %integer %function FONT HEIGHT %integer %function FONT DEPTH %integer %function MAX FONT WIDTH %integer %function MIN FONT WIDTH %integer %function STRING WIDTH (%string(255) s) %integer %function CHAR HEIGHT (%integer c) %integer %function CHAR DEPTH (%integer c) %integer %function CHAR WIDTH (%integer c) %integer %function TEXT X POS %integer %function TEXT Y POS %routine POLY (%integer x, y) Defines a single vertex of (x, y) for subsequent call to closepoly. %routine CLOSEPOLY Draws a filled polygon with vertices defined by prior calls of poly. As a result all previous vertex definitions are lost and furthe calls to poly specify vertices for the next polygon to be drawn. %constant %integer black=0, red=1, green=2, blue=4 %constant %integer yellow=red+green, magenta=red+blue, cyan=blue+green %constant %integer white=red+green+blue %constant %integer mouse left=1, mouse middle=2, mouse right=4 %routine SHOW I (%integer n,p) %routine SHOW R (%real x, %integer n,m) %routine SHOW F (%real x, %integer n) %routine SHEX1 (%integer x) %routine SHEX2 (%integer x) %routine SHEX4 (%integer x) %routine SHEX (%integer x) \end{verbatim}\rm \normalsize \vspace{.75in} view:fredgraph printed on 24/02/89 at 16.36 \newpage \tableofcontents \end{document}