DEFINITION MODULE GKSDefs;

(*
    Title: 	GKS standard workstation definitions package
    LastEdit:	"Tue Sep  7 17:02:16 1982"
    Author: 	jd
		Cambridge University Computer Laboratory
*)

(* This module provides a non-standard extension to GKS which is,
   however, useful, and saves a lot of typing. GKS defines that the
   various "pens" in which lines, text, markers, etc. are drawn, are
   different for each workstation, and are selected by INTEGER
   indexes. This module simply establishes a mapping for each of the
   definition types into the INTEGERS so that a client need not 
   remember which number corresponds to which attributes.

   The intention is that at the start of day, the GKS client can use this
   module to define all the different primitive types which he expects to
   use. These can then be used by calls of the Select* functions. GKS
   defines that the result of selecting an index for which there is no
   definition is the use of the default definition, e.g. black solid lines
   of standard width, so it is safe to make fewer definitions than you 
   might ever select. It is also completely safe to call Define* at any
   time, more than once for the same definitions if you like.
   
   The only nonstandard idea here is the use of a colour palette; 
   GKS says that colours are specified by (r,g,b) values.
*)
FROM Palette IMPORT
    COLOUR, PALETTE;

FROM GKSTypes IMPORT
    WS, LINESTYLE, MARKERSTYLE, FILLSTYLE, PRECISION;

EXPORT QUALIFIED
    DefineLines, SelectLine,
    DefineMarkers, SelectMarker,
    DefineTexts, SelectText,
    DefineFillAreas, SelectFillArea;

PROCEDURE DefineLines (ws: WS; palette: PALETTE; 
    style: LINESTYLE; width: REAL);
    (* Creates a set of line definitions for the ws, one for each colour
       in the palette. They are given indexes corresponding to their colours.
       The only way to get different line widths with this interface is to
       reDefine them just before Selecting.
    *)

PROCEDURE SelectLine (c: COLOUR; style: LINESTYLE);
    (* the GKS function SetPolyLineIndex (ORD (c)); causes all workstations to
       use a line definition, which for those set up with the DefineLines
       procedure, corresponds to the most recent definition set up by
       DefineLines
    *)

PROCEDURE DefineMarkers (ws: WS; palette: PALETTE;
    style: MARKERSTYLE; size: REAL);
PROCEDURE SelectMarker (c: COLOUR; style: MARKERSTYLE);

PROCEDURE DefineTexts (ws: WS; palette: PALETTE; 
    font: CARDINAL; p: PRECISION);
PROCEDURE SelectText (c: COLOUR; font: CARDINAL; p: PRECISION);

PROCEDURE DefineFillAreas (ws: WS; palette: PALETTE;
    style: FILLSTYLE; pattern: CARDINAL);
    (* pattern only significant if style = PatternArea *)
PROCEDURE SelectFillArea (c: COLOUR; style: FILLSTYLE);

END GKSDefs.
