COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		Kernel Include file
FILE:		color.def

AUTHOR:		Jim DeFrisco, Oct 23, 1992

REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	Jim	10/23/92	Initial revision


DESCRIPTION:
	Color related definitions for GEOS
		
	$Id: color.def,v 1.1 97/04/04 14:25:05 newdeal Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@

SetDef	__COLOR

StartKernel
;***************************************************************************
;	DEFAULT SCREEN COLORS (standard 16-color palette)
;***************************************************************************

Color 		etype byte

C_BLACK 	enum Color		; black color index
C_BLUE 		enum Color		; dark blue color index
C_GREEN 	enum Color		; dark green color index
C_CYAN 		enum Color		; dark cyan color index
C_RED 		enum Color		; dark red color index
C_VIOLET 	enum Color		; dark violet color index
C_BROWN 	enum Color		; brown color index
C_LIGHT_GRAY 	enum Color		; light gray color index
C_DARK_GRAY 	enum Color		; dark gray color index
C_LIGHT_BLUE 	enum Color		; light blue color index
C_LIGHT_GREEN 	enum Color		; light green color index
C_LIGHT_CYAN 	enum Color		; light cyan color index
C_LIGHT_RED 	enum Color		; light red color index
C_LIGHT_VIOLET 	enum Color		; light violet color index
C_YELLOW 	enum Color		; yellow color index
C_WHITE 	enum Color		; white color index

C_LIGHT_GREY	=	C_LIGHT_GRAY	; alternate spelling
C_DARK_GREY	=	C_DARK_GRAY	; alternate spelling

MAX_CF_INDEX	=	C_WHITE

C_BW_GREY	=	0x84		; "color" to pass to black
					; and white driver to get
					; 50% pattern (in dither mode)

;	Additional color enums for use as color indices

C_GRAY_0	enum Color, 0x10	; start of grey ramp,  0.0%
C_GRAY_7	enum Color, 0x11	; start of grey ramp,  6.3%
C_GRAY_13	enum Color, 0x12	; start of grey ramp, 13.3%
C_GRAY_20	enum Color, 0x13	; start of grey ramp, 20.0%
C_GRAY_27	enum Color, 0x14	; start of grey ramp, 26.7%
C_GRAY_33	enum Color, 0x15	; start of grey ramp, 33.3%
C_GRAY_40	enum Color, 0x16	; start of grey ramp, 40.0%
C_GRAY_47	enum Color, 0x17	; start of grey ramp, 46.7%
C_GRAY_53	enum Color, 0x18	; start of grey ramp, 53.3%
C_GRAY_60	enum Color, 0x19	; start of grey ramp, 60.0%
C_GRAY_68	enum Color, 0x1a	; start of grey ramp, 67.7%
C_GRAY_73	enum Color, 0x1b	; start of grey ramp, 73.3%
C_GRAY_80	enum Color, 0x1c	; start of grey ramp, 80.0%
C_GRAY_88	enum Color, 0x1d	; start of grey ramp, 87.7%
C_GRAY_93	enum Color, 0x1e	; start of grey ramp, 93.3%
C_GRAY_100	enum Color, 0x1f	; start of grey ramp,100.0%

C_UNUSED_0	enum Color, 0x20	; 8 unused spots
C_UNUSED_1	enum Color, 0x21
C_UNUSED_2	enum Color, 0x22
C_UNUSED_3	enum Color, 0x23
C_UNUSED_4	enum Color, 0x24
C_UNUSED_5	enum Color, 0x25
C_UNUSED_6	enum Color, 0x26
C_UNUSED_7	enum Color, 0x27

C_R0_G0_B0	enum Color, 0x28	; start of 6x6x6 RGB cube
C_R0_G0_B1	enum Color, 0x29
C_R0_G0_B2	enum Color, 0x2a
C_R0_G0_B3	enum Color, 0x2b
C_R0_G0_B4	enum Color, 0x2c
C_R0_G0_B5	enum Color, 0x2d
C_R0_G1_B0	enum Color, 0x2e
C_R0_G1_B1	enum Color, 0x2f
C_R0_G1_B2	enum Color, 0x30
C_R0_G1_B3	enum Color, 0x31
C_R0_G1_B4	enum Color, 0x32
C_R0_G1_B5	enum Color, 0x33
C_R0_G2_B0	enum Color, 0x34
C_R0_G2_B1	enum Color, 0x35
C_R0_G2_B2	enum Color, 0x36
C_R0_G2_B3	enum Color, 0x37
C_R0_G2_B4	enum Color, 0x38
C_R0_G2_B5	enum Color, 0x39
C_R0_G3_B0	enum Color, 0x3a
C_R0_G3_B1	enum Color, 0x3b
C_R0_G3_B2	enum Color, 0x3c
C_R0_G3_B3	enum Color, 0x3d
C_R0_G3_B4	enum Color, 0x3e
C_R0_G3_B5	enum Color, 0x3f
C_R0_G4_B0	enum Color, 0x40
C_R0_G4_B1	enum Color, 0x41
C_R0_G4_B2	enum Color, 0x42
C_R0_G4_B3	enum Color, 0x43
C_R0_G4_B4	enum Color, 0x44
C_R0_G4_B5	enum Color, 0x45
C_R0_G5_B0	enum Color, 0x46
C_R0_G5_B1	enum Color, 0x47
C_R0_G5_B2	enum Color, 0x48
C_R0_G5_B3	enum Color, 0x49
C_R0_G5_B4	enum Color, 0x4a
C_R0_G5_B5	enum Color, 0x4b
C_R1_G0_B0	enum Color, 0x4c
C_R1_G0_B1	enum Color, 0x4d
C_R1_G0_B2	enum Color, 0x4e
C_R1_G0_B3	enum Color, 0x4f
C_R1_G0_B4	enum Color, 0x50
C_R1_G0_B5	enum Color, 0x51
C_R1_G1_B0	enum Color, 0x52
C_R1_G1_B1	enum Color, 0x53
C_R1_G1_B2	enum Color, 0x54
C_R1_G1_B3	enum Color, 0x55
C_R1_G1_B4	enum Color, 0x56
C_R1_G1_B5	enum Color, 0x57
C_R1_G2_B0	enum Color, 0x58
C_R1_G2_B1	enum Color, 0x59
C_R1_G2_B2	enum Color, 0x5a
C_R1_G2_B3	enum Color, 0x5b
C_R1_G2_B4	enum Color, 0x5c
C_R1_G2_B5	enum Color, 0x5d
C_R1_G3_B0	enum Color, 0x5e
C_R1_G3_B1	enum Color, 0x5f
C_R1_G3_B2	enum Color, 0x60
C_R1_G3_B3	enum Color, 0x61
C_R1_G3_B4	enum Color, 0x62
C_R1_G3_B5	enum Color, 0x63
C_R1_G4_B0	enum Color, 0x64
C_R1_G4_B1	enum Color, 0x65
C_R1_G4_B2	enum Color, 0x66
C_R1_G4_B3	enum Color, 0x67
C_R1_G4_B4	enum Color, 0x68
C_R1_G4_B5	enum Color, 0x69
C_R1_G5_B0	enum Color, 0x6a
C_R1_G5_B1	enum Color, 0x6b
C_R1_G5_B2	enum Color, 0x6c
C_R1_G5_B3	enum Color, 0x6d
C_R1_G5_B4	enum Color, 0x6e
C_R1_G5_B5	enum Color, 0x6f
C_R2_G0_B0	enum Color, 0x70
C_R2_G0_B1	enum Color, 0x71
C_R2_G0_B2	enum Color, 0x72
C_R2_G0_B3	enum Color, 0x73
C_R2_G0_B4	enum Color, 0x74
C_R2_G0_B5	enum Color, 0x75
C_R2_G1_B0	enum Color, 0x76
C_R2_G1_B1	enum Color, 0x77
C_R2_G1_B2	enum Color, 0x78
C_R2_G1_B3	enum Color, 0x79
C_R2_G1_B4	enum Color, 0x7a
C_R2_G1_B5	enum Color, 0x7b
C_R2_G2_B0	enum Color, 0x7c
C_R2_G2_B1	enum Color, 0x7d
C_R2_G2_B2	enum Color, 0x7e
C_R2_G2_B3	enum Color, 0x7f
C_R2_G2_B4	enum Color, 0x80
C_R2_G2_B5	enum Color, 0x81
C_R2_G3_B0	enum Color, 0x82
C_R2_G3_B1	enum Color, 0x83
C_R2_G3_B2	enum Color, 0x84
C_R2_G3_B3	enum Color, 0x85
C_R2_G3_B4	enum Color, 0x86
C_R2_G3_B5	enum Color, 0x87
C_R2_G4_B0	enum Color, 0x88
C_R2_G4_B1	enum Color, 0x89
C_R2_G4_B2	enum Color, 0x8a
C_R2_G4_B3	enum Color, 0x8b
C_R2_G4_B4	enum Color, 0x8c
C_R2_G4_B5	enum Color, 0x8d
C_R2_G5_B0	enum Color, 0x8e
C_R2_G5_B1	enum Color, 0x8f
C_R2_G5_B2	enum Color, 0x90
C_R2_G5_B3	enum Color, 0x91
C_R2_G5_B4	enum Color, 0x92
C_R2_G5_B5	enum Color, 0x93
C_R3_G0_B0	enum Color, 0x94
C_R3_G0_B1	enum Color, 0x95
C_R3_G0_B2	enum Color, 0x96
C_R3_G0_B3	enum Color, 0x97
C_R3_G0_B4	enum Color, 0x98
C_R3_G0_B5	enum Color, 0x99
C_R3_G1_B0	enum Color, 0x9a
C_R3_G1_B1	enum Color, 0x9b
C_R3_G1_B2	enum Color, 0x9c
C_R3_G1_B3	enum Color, 0x9d
C_R3_G1_B4	enum Color, 0x9e
C_R3_G1_B5	enum Color, 0x9f
C_R3_G2_B0	enum Color, 0xa0
C_R3_G2_B1	enum Color, 0xa1
C_R3_G2_B2	enum Color, 0xa2
C_R3_G2_B3	enum Color, 0xa3
C_R3_G2_B4	enum Color, 0xa4
C_R3_G2_B5	enum Color, 0xa5
C_R3_G3_B0	enum Color, 0xa6
C_R3_G3_B1	enum Color, 0xa7
C_R3_G3_B2	enum Color, 0xa8
C_R3_G3_B3	enum Color, 0xa9
C_R3_G3_B4	enum Color, 0xaa
C_R3_G3_B5	enum Color, 0xab
C_R3_G4_B0	enum Color, 0xac
C_R3_G4_B1	enum Color, 0xad
C_R3_G4_B2	enum Color, 0xae
C_R3_G4_B3	enum Color, 0xaf
C_R3_G4_B4	enum Color, 0xb0
C_R3_G4_B5	enum Color, 0xb1
C_R3_G5_B0	enum Color, 0xb2
C_R3_G5_B1	enum Color, 0xb3
C_R3_G5_B2	enum Color, 0xb4
C_R3_G5_B3	enum Color, 0xb5
C_R3_G5_B4	enum Color, 0xb6
C_R3_G5_B5	enum Color, 0xb7
C_R4_G0_B0	enum Color, 0xb8
C_R4_G0_B1	enum Color, 0xb9
C_R4_G0_B2	enum Color, 0xba
C_R4_G0_B3	enum Color, 0xbb
C_R4_G0_B4	enum Color, 0xbc
C_R4_G0_B5	enum Color, 0xbd
C_R4_G1_B0	enum Color, 0xbe
C_R4_G1_B1	enum Color, 0xbf
C_R4_G1_B2	enum Color, 0xc0
C_R4_G1_B3	enum Color, 0xc1
C_R4_G1_B4	enum Color, 0xc2
C_R4_G1_B5	enum Color, 0xc3
C_R4_G2_B0	enum Color, 0xc4
C_R4_G2_B1	enum Color, 0xc5
C_R4_G2_B2	enum Color, 0xc6
C_R4_G2_B3	enum Color, 0xc7
C_R4_G2_B4	enum Color, 0xc8
C_R4_G2_B5	enum Color, 0xc9
C_R4_G3_B0	enum Color, 0xca
C_R4_G3_B1	enum Color, 0xcb
C_R4_G3_B2	enum Color, 0xcc
C_R4_G3_B3	enum Color, 0xcd
C_R4_G3_B4	enum Color, 0xce
C_R4_G3_B5	enum Color, 0xcf
C_R4_G4_B0	enum Color, 0xd0
C_R4_G4_B1	enum Color, 0xd1
C_R4_G4_B2	enum Color, 0xd2
C_R4_G4_B3	enum Color, 0xd3
C_R4_G4_B4	enum Color, 0xd4
C_R4_G4_B5	enum Color, 0xd5
C_R4_G5_B0	enum Color, 0xd6
C_R4_G5_B1	enum Color, 0xd7
C_R4_G5_B2	enum Color, 0xd8
C_R4_G5_B3	enum Color, 0xd9
C_R4_G5_B4	enum Color, 0xda
C_R4_G5_B5	enum Color, 0xdb
C_R5_G0_B0	enum Color, 0xdc
C_R5_G0_B1	enum Color, 0xdd
C_R5_G0_B2	enum Color, 0xde
C_R5_G0_B3	enum Color, 0xdf
C_R5_G0_B4	enum Color, 0xe0
C_R5_G0_B5	enum Color, 0xe1
C_R5_G1_B0	enum Color, 0xe2
C_R5_G1_B1	enum Color, 0xe3
C_R5_G1_B2	enum Color, 0xe4
C_R5_G1_B3	enum Color, 0xe5
C_R5_G1_B4	enum Color, 0xe6
C_R5_G1_B5	enum Color, 0xe7
C_R5_G2_B0	enum Color, 0xe8
C_R5_G2_B1	enum Color, 0xe9
C_R5_G2_B2	enum Color, 0xea
C_R5_G2_B3	enum Color, 0xeb
C_R5_G2_B4	enum Color, 0xec
C_R5_G2_B5	enum Color, 0xed
C_R5_G3_B0	enum Color, 0xee
C_R5_G3_B1	enum Color, 0xef
C_R5_G3_B2	enum Color, 0xf0
C_R5_G3_B3	enum Color, 0xf1
C_R5_G3_B4	enum Color, 0xf2
C_R5_G3_B5	enum Color, 0xf3
C_R5_G4_B0	enum Color, 0xf4
C_R5_G4_B1	enum Color, 0xf5
C_R5_G4_B2	enum Color, 0xf6
C_R5_G4_B3	enum Color, 0xf7
C_R5_G4_B4	enum Color, 0xf8
C_R5_G4_B5	enum Color, 0xf9
C_R5_G5_B0	enum Color, 0xfa
C_R5_G5_B1	enum Color, 0xfb
C_R5_G5_B2	enum Color, 0xfc
C_R5_G5_B3	enum Color, 0xfd
C_R5_G5_B4	enum Color, 0xfe


;	flags to pass to GrSetXXXXColor routines

ColorFlag	etype byte
CF_INDEX	enum	ColorFlag	; set color with index
CF_GRAY		enum	ColorFlag	; set color with gray value
CF_SAME		enum	ColorFlag	; don't change the color (hatch)
CF_CMY		enum	ColorFlag	; set color with CMY value
CF_RGB		enum	ColorFlag, 0x80	; set color with RGB values

;	structure region for RGB values

RGBValue	struct
    RGB_red	byte
    RGB_green	byte
    RGB_blue	byte
RGBValue	ends

; useful structure for storing any arbitrary color

ColorQuad		struct
    CQ_redOrIndex	byte			; red   (or color index)
    CQ_info		ColorFlag
    CQ_green		byte			; green (or ignored)
    CQ_blue		byte			; blue  (or ignored)
ColorQuad		ends

;---------------------------------------------------------------------------
; 		Structures for defining color correction tables
;---------------------------------------------------------------------------

	; a color correction table is a 5x5x5 cube of RGB difference values.
	; The correction is done by doing a lookup in the 3D table and 
	; applying the deltaRGB values to the original input values.

	; The sample points used are evenly spaced through the 255 allowed
	; values for each component, at:  0x00, 0x40, 0x80, 0xc0, 0xff

RGBDelta	struct
    RGBD_red	sbyte
    RGBD_green	sbyte
    RGBD_blue   sbyte
RGBDelta	ends

ColorTransfer		struct
    CT_data		RGBDelta 5*5*5 dup (?)		; 375 bytes of data
ColorTransfer		ends

;-----------------------------------------------------------------------------
;		Color Palette constants
;-----------------------------------------------------------------------------

;	Palette Structure
;
;	This is the structure of the custom palettes allocated by 
;	GrCreatePalette and associated with windows
Palette	struct
    P_entries	word	16			; # 3-byte entries in palette
Palette	ends


; GetPalType
; This enum is a flag passed to GrGetPalette 
;
GetPalType	etype	byte
GPT_ACTIVE	enum	GetPalType
GPT_DEFAULT	enum	GetPalType

; SetPalEntry
; This is the structure of information passed to GrSetPalette
SetPalElement	struct	
    SPE_entry	byte				; palette entry number
    SPE_color	RGBValue <>			; color to set that entry
SetPalElement	ends


EndKernel





