1/*
2
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28                        All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46*/
47
48#ifndef CMAP_H
49#define CMAP_H 1
50
51#include <X11/Xproto.h>
52#include "screenint.h"
53#include "window.h"
54
55/* these follow X.h's AllocNone and AllocAll */
56#define CM_PSCREEN 2
57#define CM_PWIN	   3
58/* Passed internally in colormap.c */
59#define REDMAP 0
60#define GREENMAP 1
61#define BLUEMAP 2
62#define PSEUDOMAP 3
63#define AllocPrivate (-1)
64#define AllocTemporary (-2)
65#define DynamicClass  1
66
67/* Values for the flags field of a colormap. These should have 1 bit set
68 * and not overlap */
69#define IsDefault 1
70#define AllAllocated 2
71#define BeingCreated 4
72
73
74typedef CARD32 Pixel;
75typedef struct _CMEntry *EntryPtr;
76/* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */
77typedef struct _colorResource *colorResourcePtr;
78
79extern _X_EXPORT int CreateColormap(
80    Colormap /*mid*/,
81    ScreenPtr /*pScreen*/,
82    VisualPtr /*pVisual*/,
83    ColormapPtr* /*ppcmap*/,
84    int /*alloc*/,
85    int /*client*/);
86
87extern _X_EXPORT int FreeColormap(
88    pointer /*pmap*/,
89    XID /*mid*/);
90
91extern _X_EXPORT int TellLostMap(
92    WindowPtr /*pwin*/,
93    pointer /* Colormap *pmid */);
94
95extern _X_EXPORT int TellGainedMap(
96    WindowPtr /*pwin*/,
97    pointer /* Colormap *pmid */);
98
99extern _X_EXPORT int CopyColormapAndFree(
100    Colormap /*mid*/,
101    ColormapPtr /*pSrc*/,
102    int /*client*/);
103
104extern _X_EXPORT int AllocColor(
105    ColormapPtr /*pmap*/,
106    unsigned short* /*pred*/,
107    unsigned short* /*pgreen*/,
108    unsigned short* /*pblue*/,
109    Pixel* /*pPix*/,
110    int /*client*/);
111
112extern _X_EXPORT void FakeAllocColor(
113    ColormapPtr /*pmap*/,
114    xColorItem * /*item*/);
115
116extern _X_EXPORT void FakeFreeColor(
117    ColormapPtr /*pmap*/,
118    Pixel /*pixel*/);
119
120typedef int (*ColorCompareProcPtr)(
121    EntryPtr /*pent*/,
122    xrgb * /*prgb*/);
123
124extern _X_EXPORT int FindColor(
125    ColormapPtr /*pmap*/,
126    EntryPtr /*pentFirst*/,
127    int /*size*/,
128    xrgb* /*prgb*/,
129    Pixel* /*pPixel*/,
130    int /*channel*/,
131    int /*client*/,
132    ColorCompareProcPtr /*comp*/);
133
134extern _X_EXPORT int QueryColors(
135    ColormapPtr /*pmap*/,
136    int /*count*/,
137    Pixel* /*ppixIn*/,
138    xrgb* /*prgbList*/,
139    ClientPtr client);
140
141extern _X_EXPORT int FreeClientPixels(
142    pointer /*pcr*/,
143    XID /*fakeid*/);
144
145extern _X_EXPORT int AllocColorCells(
146    int /*client*/,
147    ColormapPtr /*pmap*/,
148    int /*colors*/,
149    int /*planes*/,
150    Bool /*contig*/,
151    Pixel* /*ppix*/,
152    Pixel* /*masks*/);
153
154extern _X_EXPORT int AllocColorPlanes(
155    int /*client*/,
156    ColormapPtr /*pmap*/,
157    int /*colors*/,
158    int /*r*/,
159    int /*g*/,
160    int /*b*/,
161    Bool /*contig*/,
162    Pixel* /*pixels*/,
163    Pixel* /*prmask*/,
164    Pixel* /*pgmask*/,
165    Pixel* /*pbmask*/);
166
167extern _X_EXPORT int FreeColors(
168    ColormapPtr /*pmap*/,
169    int /*client*/,
170    int /*count*/,
171    Pixel* /*pixels*/,
172    Pixel /*mask*/);
173
174extern _X_EXPORT int StoreColors(
175    ColormapPtr /*pmap*/,
176    int /*count*/,
177    xColorItem* /*defs*/,
178    ClientPtr client);
179
180extern _X_EXPORT int IsMapInstalled(
181    Colormap /*map*/,
182    WindowPtr /*pWin*/);
183
184extern _X_EXPORT Bool ResizeVisualArray(
185    ScreenPtr /* pScreen */,
186    int /* new_vis_count */,
187    DepthPtr /* depth */);
188
189#endif /* CMAP_H */
190