1 /*
2  * FIG : Facility for Interactive Generation of figures
3  * Copyright (c) 1987 Christopher A. Kent
4  * Parts Copyright (c) 1989-2007 by Brian V. Smith
5  *
6  * Any party obtaining a copy of these files is granted, free of charge, a
7  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
8  * nonexclusive right and license to deal in this software and documentation
9  * files (the "Software"), including without limitation the rights to use,
10  * copy, modify, merge, publish, distribute, sublicense and/or sell copies of
11  * the Software, and to permit persons who receive copies from any such
12  * party to do so, with the only requirement being that the above copyright
13  * and this permission notice remain intact.
14  *
15  */
16 
17 #ifndef W_COLOR_H
18 #define W_COLOR_H
19 
20 #include <X11/Intrinsic.h>
21 #include "w_indpanel.h"		/* ind_sw_info */
22 
23 #define USE_EXISTING_COLOR	True
24 #define DONT_USE_EXISTING_COLOR	False
25 
26 extern	void	show_pencolor(void), next_pencolor(ind_sw_info *sw), prev_pencolor(ind_sw_info *sw);
27 extern	void	show_fillcolor(void), next_fillcolor(ind_sw_info *sw), prev_fillcolor(ind_sw_info *sw);
28 extern	void	count_user_colors(void);
29 extern void YStoreColors (Colormap colormap, XColor *color, int ncolors);
30 extern int add_color_cell (Boolean use_exist, int indx, int r, int g, int b);
31 extern void color_borders (void);
32 extern void create_color_panel (Widget form, Widget label, Widget cancel, ind_sw_info *isw);
33 extern void del_color_cell (int indx);
34 extern void pen_fill_activate (int func);
35 extern void pick_contrast (XColor color, Widget widget);
36 extern void restore_mixed_colors (void);
37 extern void set_cmap (Window window);
38 
39 
40 extern	Widget	delunusedColors;
41 
42 /*
43  * color.h - color definitions
44  *
45  * Author:	Christopher A. Kent
46  *		Western Research Laboratory
47  *		Digital Equipment Corporation
48  * Date:	Sun Dec 13 1987
49  */
50 
51 Boolean switch_colormap(void);
52 Boolean alloc_color_cells(Pixel *pixels, int n);
53 
54 /*
55  * $Log: w_color.h,v $
56  * Revision 1.1  1995/02/28  15:40:16  feuille
57  * Initial revision
58  *
59  * Revision 1.2  90/06/30  14:33:12  rlh2
60  * patchlevel 1
61  *
62  * Revision 1.1  90/05/10  11:16:54  rlh2
63  * Initial revision
64  *
65  * Revision 1.2  88/06/30  09:58:56  mikey
66  * Handles CMY also.
67  *
68  * Revision 1.1  88/06/30  09:10:53  mikey
69  * Initial revision
70  *
71  */
72 
73 typedef	struct _RGB {
74 	unsigned short r, g, b;
75 } RGB;
76 
77 typedef	struct _HSV {
78 	float	h, s, v;	/* [0, 1] */
79 } HSV;
80 
81 typedef struct _CMY {
82 	unsigned short c, m, y;
83 } CMY;
84 
85 extern RGB	RGBWhite, RGBBlack;
86 
87 RGB	MixRGB();
88 RGB	MixHSV();
89 RGB	HSVToRGB(HSV hsv);
90 HSV	RGBToHSV(RGB rgb);
91 float	RGBDist();
92 RGB	PctToRGB(float rr, float gg, float bb);
93 HSV	PctToHSV();
94 RGB	CMYToRGB();
95 CMY	RGBToCMY();
96 #endif /* W_COLOR_H */
97