DEFINITION MODULE GKSNorm;

(*
    Title: 	Graphical Kernel System Normalization Transformations
    LastEdit:	"Tue Feb 26 14:26:38 1985"
    Author: 	jd
		Cambridge University Computer Laboratory
*)

(* This module maintains the list of normalization transformations and
   the variable defining the currently selected transformation. It
   normalizes points under the current transformation, and will return
   the current clipping box on demand.
*)

FROM Vector IMPORT RVEC, RBOX;

FROM GKSTypes IMPORT RBOXPOINTER;

FROM SYSTEM IMPORT WORD;

EXPORT QUALIFIED
    SelectNormalization, SetWindow, SetViewport, SetClipping, 
    ClippingBox, NormalizePoint, UnNormalizePoint, NormalizeVector, 
    NormalizeLine, GetNormalizationIndex, GetNormalization;

    (********** External Declarations For GKS Clients **********)


PROCEDURE SelectNormalization (index: INTEGER);
PROCEDURE GetNormalizationIndex (): INTEGER;
PROCEDURE SetWindow (index: INTEGER; r: RBOX);
PROCEDURE SetViewport (index: INTEGER; r: RBOX);
PROCEDURE GetNormalization (index: INTEGER; VAR w, v: RBOX);
PROCEDURE SetClipping (on: BOOLEAN);

    (********** Internal Definitions for GKS **********)

PROCEDURE ClippingBox (StoredRef: BOOLEAN): RBOXPOINTER;
PROCEDURE NormalizePoint (VAR p: RVEC);
        (* transform under the current normalization *)
PROCEDURE UnNormalizePoint (VAR p: RVEC): BOOLEAN;
        (* and back again *)
PROCEDURE NormalizeVector (VAR v: RVEC);
        (* transform under the current normalization, then translate to a
           vector from the origin again
        *)
PROCEDURE NormalizeLine (high: INTEGER; VAR p: ARRAY OF RVEC);

END GKSNorm.
