DEFINITION MODULE GKSAttr;
(*
    Title: 	GKS Graphics Primitives Attributes Module
    LastEdit:	"Tue Feb 26 12:42:00 1985"
    Author: 	jd
		Cambridge University Computer Laboratory
*)


(*  This module controls the definition of GKS's global primitive attributes.
    Most primitives (Lines, Markers, Texts, Areas, and Patterns) have local
    definitions which may vary between workstations. For these, this module
    maintains the "pen number" global to GKS which determines which definition
    is current in every workstation.

    Two other types of attribute do not have this indirection, but are global
    in GKS. These are the current character definition, and the current
    reference point for patterns. This module maintains these current
    definitions directly.
*)
FROM Vector IMPORT RVEC;

FROM GKSTypes IMPORT
    WS, PATH, PRECISION,
    ATTRTYPE, ATTRIBUTE, TRANSFORM,
    LINESTYLE, MARKERSTYLE, FILLSTYLE;

EXPORT QUALIFIED
    SetPolyLineIndex, SetPolyLine, CurrentLine,
    SetPolyMarkerIndex, SetPolyMarker, CurrentMarker,
    SetTextIndex, SetText, CurrentText,
    SetFillAreaIndex, SetFillArea, CurrentFillArea,
    SetCharHeight, SetCharUpVector, SetCharExpand,
    SetCharPath, SetCharSpacing, CurrentChar, SetMetaChar,
    SetPattern, SetPatternSize, SetPatternReferencePoint, 
    CurrentPatternRef, SetMetaPattern,
    SetColour, DefaultAttributes, SelectPen, SelectAttribute,
    ChangeNormalization;

    (********** External Procedures Available to GKS Clients **********)

PROCEDURE SetPolyLineIndex (index: CARDINAL);
PROCEDURE SetPolyMarkerIndex (index: CARDINAL);
PROCEDURE SetTextIndex (index: CARDINAL);
PROCEDURE SetFillAreaIndex (index: CARDINAL);

PROCEDURE SetPolyLine (ws: WS; index, style, colour: CARDINAL; width: REAL);
PROCEDURE SetPolyMarker (ws: WS; index, style, colour: CARDINAL; size: REAL);
PROCEDURE SetText (ws: WS; index, font, colour: CARDINAL;
        precision: PRECISION);
PROCEDURE SetFillArea (ws: WS; index, style, pattern, colour: CARDINAL);
PROCEDURE SetPattern (ws: WS; index: CARDINAL; rowhigh, columnhigh: INTEGER;
        pattern: ARRAY OF CARDINAL);
PROCEDURE SetColour (ws: WS; index: CARDINAL; red, green, blue: REAL);

PROCEDURE SetCharHeight (h: REAL);
PROCEDURE SetCharUpVector (v: RVEC);
PROCEDURE SetCharExpand (e: REAL);
PROCEDURE SetCharPath (d: PATH);
PROCEDURE SetCharSpacing (s: REAL);

PROCEDURE SetPatternSize (sx, sy: REAL);
PROCEDURE SetPatternReferencePoint (p: RVEC);


    (********** Internal Definitions Accessible only to GKS **********)


VAR CurrentLine, 
    CurrentMarker,
    CurrentText,
    CurrentFillArea:     CARDINAL;

VAR CurrentChar,
    CurrentPatternRef:   ATTRIBUTE;

PROCEDURE DefaultAttributes (ws: WS);

PROCEDURE SetMetaChar (vertical, base: RVEC);
        (* a means of setting the current character size from those recorded
           in a metafile without having to go through a normalization trans
        *)

PROCEDURE SetMetaPattern (vertical, base: RVEC);
        (* ditto for pattern sizes stored in metafiles *)

PROCEDURE SelectPen (ws: WS; type: ATTRTYPE; index: CARDINAL);

PROCEDURE SelectAttribute (ws: WS; attr: ATTRIBUTE; display: TRANSFORM);

PROCEDURE ChangeNormalization (t: TRANSFORM);
        (* Recompute attributes after a change of normalization transformation *)

END GKSAttr.
