                  Demo Programs of the Colour Module on SUN
                  -----------------------------------------

This directory contains all files related to the demonstration programs 
of the Colours module for SUN/SUNOS.

List of files
-------------

  o cd_clrspc.c:	To display RGB, HSV, HLS and CIE colour spaces

  o cd_defclr.c:	To interactively define or match colours in RGB, 
			HSV, HLS, CIE XYZ and CIE LUV colour spaces

  o cd_ciexy.dat	The xy data file of the CIE chromaticity diagram

  o clrdemo.mak: 	The makefile for the demonstration programs.

The start of the source program cd_clrspc.c and cd_defclr.c contain the 
description of purpose, use and installation. Each function heading also 
contains its description. 

In general it is not recommended to let students see the source code of the
demonstration programs. In this case however these source program do serve
as good examples.

The following is extracted from the source program cd_clrspc.c:

/*------------------------------------------------------------------------------

  Program name: 

	cd_clrspc
                                      
  Purpose: 	

	To display RGB, HSV, HLS and CIE colour spaces
	
  Use:

	This program has no parameters. The user types the following 
	command to run the program:

	Unix:  cd_clrspc

        Firstly, the program dipslays the RGB colour space as the default.
	Then a choice device and three valuator devices are initialized and 
	set in the event mode for interaction. 

	The choice menu has the following options:

	o RGB 		   -> Displays the RGB colour space 

	o HSV              -> Displays the HSV colour space

	o HLS              -> Displays the HLS colour space

	o CIE 		   -> Displays a representation of the X + Y + Z = 1 
			      palne of CIE XYZ space

	o CIE Gamut	   -> Displays a representation of a monitor gamut in
			      CIE XYZ space

	o CIE Chromaticity -> Displays a CIE Chromaticity diagram with a
			      typical monitor colour gamut

	o Roate about y    -> Rotates the displayed colour space about the 
			      Y axis continously.

	o Hollow style     -> Switches the interior style of the displayed 
			      object to the hollow style.

	o Solid  style     -> Switches the interior style of the displayed 
			      object to the solid style.

	o Full view        -> Switches the display to the full view (default) 

	o Four views       -> Switches the display to the four views (top, 
			      off axis, front and right side).
			      If the radiosity picture is displayed, this
			      option is suspended. 

	o Reset rotation   -> Resets the rotation of the displayed object 
			      about X, Y and Z axes to the zero degree.  

        o Quit 		   -> Quits from the demo program.

        There are three valuator devices as follows:

	Rotation about X axis: The displayed picture is rotated about 
			       the X axis for the entered angle value.	  

	Rotation about Y axis: The displayed picture is rotated about 
			       the Y axis for the entered angle value.	  

	Rotation about Z axis: The displayed picture is rotated about 
			       the Z axis for the entered angle value.	  

  Installation:

	To use the makefile clrdemo.mak, type 

	Unix:  make -f clrdemo.mak cd_clrspc

	to create the cd_clrspc executable image.
	
  Version History:

  	1.0,  April, 1992,  Fenqiang Lin, First version

------------------------------------------------------------------------------*/

The following is extracted from the source program cd_defclr.c:

/*------------------------------------------------------------------------------

  Program name: 

	cd_defclr
                                      
  Purpose: 	

	To interactively define or match colours in RGB, HSV, HLS, CIE XYZ 
	and CIE LUV colour spaces
	
  Use:

	This program has no parameters. The user types the following 
	command to run the program:

	Unix:  cd_defclr

        The display screen is divided into 7 areas, whose layout looks like:

	.---------------------------------------------------------------.
	| .---------------------------.	|     Other colour spaces (4)	|
	| |     (1)  Colour Area      |	|				|
        | | base colour	| match colour|	|  ===========================  |
	| `---------------------------' |  =========================== 	|
	|     Message if necessary	|  ===========================  |
	|---------------------------------------------------------------|
	|   (2) Selected Colour Space	|     Other colour spaces (5)	|
	|  3 sliders to define colour   |                              	|
       	|  =========================== 	|  ===========================	|
	|  ===========================  |  ===========================	|
	|  =========================== 	|  ===========================	|
	|---------------------------------------------------------------|
	|	 			|     Other colour spaces (6)	|
	|   (3) |  CIE xy or uv         |   				|
	|	|			|  ===========================  |
	|	|  chromaticity		|  ===========================	|
	|	|			|  ===========================	|
	|	|  diagram		|-------------------------------|
	|	|			|     Other colour spcaes (7)	|
	|	|			|     				|
	|	|			|  ===========================	|
	|	+------------------	|  ===========================	|
	|				|  ===========================	|
	`---------------------------------------------------------------'

	The area (1) is the colour area to display the defined colour. 
	In case the MATCH COLOUR menu item is selected, the area (1) 
	is divided into left and right parts. The left part displays the 
	base colour randomly generated for the user to match. The right 
	part displays the newly defined colour such that the user can 
	easily compare two colours to see how close thay are. 
	If necessary, the message is displayed under the colour area. 

	The area (2) displays the three sliders of the selected colour 
	space. The user can press the mouse to locate a new position 
	of the sliders so that a new colour is defined.

	If the specified colour value goes out of range, a message is given 
	on the message area and the black colour is displayed on the colour 
	area.

	The area (3) displays either CIE xy chromaticity diagram or 
	CIE U*V* chromaticity diagram, on which a typical monitor 
	gamut is mapped. A point marker is moving around the chromaticity
	diagram to indicate the defined colour.

	The areas (4), (5), (6) and (7) displays the sliders of other 
	colour spaces together with the corresponding values and slider
	positions to the defined colour.

        The choice menu is grouped into three classes: 
		Colour Space options, 
		Mtach options, 
		Diagram options.
 
	The Colour Space options are:

	o RGB 		   -> Select the RGB colour space 

	o HSV              -> Select the HSV colour space

	o HLS              -> Select the HLS colour space

	o CIE XYZ 	   -> Select CIE XYZ colour space

	o CIE LUV	   -> Select CIE LUV colour space

	After the user selects a colour space, the area (2) displays
	the three sliders of the selected colour space.

	The Match options are:

	o Match Colour	   -> The program turns on the MATCH option. 
			      The colour area is divided into two parts,
			      where a randomly generated colour is displayed
			      on the left and the newly defined colour on 
			      the right. 

	o Match Diff       -> The colour difference value is displayed on 
			      the message area if the Match option is turned
			      on.

	o Match Done       -> The MATCH option is turned off and the DEFINE
			      option is turned on. The whole colour area 
			      displays the defined colour. This is the default
			      case.

	The Diagram options are:

	o Diagram xy 	   -> The area (3) displays the CIE xy chromaticity
			      diagram with the colour monitor gamut on it.
			      The point corresponding to the specified 
			      colour is displayed. This is the default case.

	o Diagram u*v* 	   -> The area (3) displays the CIE u*v* chromaticity
			      diagram with the colour monitor gamut on it.
			      The point corresponding to the specified 
			      colour is displayed. 

  Installation:

	To use the makefile clrdemo.mak, type 

	Unix:  make -f clrdemo.mak cd_defclr

	to create the cd_defclr executable image.
	
  Version History:

  	1.0,  April, 1992,  Fenqiang Lin, First version

------------------------------------------------------------------------------*/
