(******************************************************************************
*                                COLOR1  .DEF                                 *
*                              ABO Software Dep.                              *
*                                                                             *
* Purpose : To provide a device independent color type and routines for       *
*         generating and manipulating them.                                   *
*                                                                             *
*   Notes : Since colors are usualy more limited by the hardware than these   *
*         routines can provide, halftoning is used where possible.            *
*                                                                             *
*         Version Date : 22/10/92                                             *
******************************************************************************)
DEFINITION MODULE COLOR1;

FROM GRAPH1 IMPORT FPattern;
IMPORT FIO;

TYPE
	Color   =FPattern;
	ColorRGB    =RECORD
		R          :REAL;
		G          :REAL;
		B          :REAL;
	END;

	ColorHSV    =RECORD
		H          :REAL;
		S          :REAL;
		V          :REAL;
	END;

	ColorHLS    =RECORD
		H          :REAL;
		L          :REAL;
		S          :REAL;
	END;

	ColorRGBI   =RECORD
		R          :REAL;
		G          :REAL;
		B          :REAL;
		I          :REAL;
	END;

VAR

PROCEDURE SetColor(c:Color);

PROCEDURE GenColorRGBI(rgbi:ColorRGBI):Color;
PROCEDURE GenColorRGB (rgb :ColorRGB ):Color;
PROCEDURE GenColorHSV (hsv :ColorHSV ):Color;
PROCEDURE GenColorHLS (hls :ColorHLS ):Color;

PROCEDURE ConHSVtoRGB(hsv:ColorHSV):ColorRGB;
PROCEDURE ConRGBtoHSV(rgb:ColorRGB):ColorHSV;

PROCEDURE ConHLStoRGB(hls:ColorHLS):ColorRGB;
PROCEDURE ConRGBtoHLS(rgb:ColorRGB):ColorHLS;

PROCEDURE ConRGBItoRGB(rgbi:ColorRGBI):ColorRGB ;
PROCEDURE ConRGBtoRGBI(rgb :ColorRGB ):ColorRGBI;

PROCEDURE RdRGB(f:FIO.File):ColorRGB;
PROCEDURE RdHSV(f:FIO.File):ColorHSV;
PROCEDURE RdHLS(f:FIO.File):ColorHLS;

PROCEDURE WrRGB(f:FIO.File;rgb:ColorRGB);
PROCEDURE WrHSV(f:FIO.File;hsv:ColorHSV);
PROCEDURE WrHLS(f:FIO.File;hls:ColorHLS);

PROCEDURE debugRGBI(rgbi:ColorRGBI);
PROCEDURE debugRGB(rgb:ColorRGB);
PROCEDURE debugHSV(rgb:ColorHSV);
PROCEDURE debugHLS(rgb:ColorHLS);

END COLOR1.
