1706f2543Smrg/***********************************************************
2706f2543Smrg
3706f2543SmrgCopyright 1987, 1998  The Open Group
4706f2543Smrg
5706f2543SmrgPermission to use, copy, modify, distribute, and sell this software and its
6706f2543Smrgdocumentation for any purpose is hereby granted without fee, provided that
7706f2543Smrgthe above copyright notice appear in all copies and that both that
8706f2543Smrgcopyright notice and this permission notice appear in supporting
9706f2543Smrgdocumentation.
10706f2543Smrg
11706f2543SmrgThe above copyright notice and this permission notice shall be included in
12706f2543Smrgall copies or substantial portions of the Software.
13706f2543Smrg
14706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15706f2543SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16706f2543SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17706f2543SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18706f2543SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19706f2543SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20706f2543Smrg
21706f2543SmrgExcept as contained in this notice, the name of The Open Group shall not be
22706f2543Smrgused in advertising or otherwise to promote the sale, use or other dealings
23706f2543Smrgin this Software without prior written authorization from The Open Group.
24706f2543Smrg
25706f2543Smrg
26706f2543SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27706f2543Smrg
28706f2543Smrg                        All Rights Reserved
29706f2543Smrg
30706f2543SmrgPermission to use, copy, modify, and distribute this software and its
31706f2543Smrgdocumentation for any purpose and without fee is hereby granted,
32706f2543Smrgprovided that the above copyright notice appear in all copies and that
33706f2543Smrgboth that copyright notice and this permission notice appear in
34706f2543Smrgsupporting documentation, and that the name of Digital not be
35706f2543Smrgused in advertising or publicity pertaining to distribution of the
36706f2543Smrgsoftware without specific, written prior permission.
37706f2543Smrg
38706f2543SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39706f2543SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40706f2543SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41706f2543SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42706f2543SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43706f2543SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44706f2543SmrgSOFTWARE.
45706f2543Smrg
46706f2543Smrg******************************************************************/
47706f2543Smrg
48706f2543Smrg#ifndef GC_H
49706f2543Smrg#define GC_H
50706f2543Smrg
51706f2543Smrg#include <X11/X.h>	/* for GContext, Mask */
52706f2543Smrg#include <X11/Xdefs.h>	/* for Bool */
53706f2543Smrg#include <X11/Xproto.h>
54706f2543Smrg#include "screenint.h"	/* for ScreenPtr */
55706f2543Smrg#include "pixmap.h"	/* for DrawablePtr */
56706f2543Smrg
57706f2543Smrg/* clientClipType field in GC */
58706f2543Smrg#define CT_NONE			0
59706f2543Smrg#define CT_PIXMAP		1
60706f2543Smrg#define CT_REGION		2
61706f2543Smrg#define CT_UNSORTED		6
62706f2543Smrg#define CT_YSORTED		10
63706f2543Smrg#define CT_YXSORTED		14
64706f2543Smrg#define CT_YXBANDED		18
65706f2543Smrg
66706f2543Smrg#define GCQREASON_VALIDATE	1
67706f2543Smrg#define GCQREASON_CHANGE	2
68706f2543Smrg#define GCQREASON_COPY_SRC	3
69706f2543Smrg#define GCQREASON_COPY_DST	4
70706f2543Smrg#define GCQREASON_DESTROY	5
71706f2543Smrg
72706f2543Smrg#define GC_CHANGE_SERIAL_BIT        (((unsigned long)1)<<31)
73706f2543Smrg#define GC_CALL_VALIDATE_BIT        (1L<<30)
74706f2543Smrg#define GCExtensionInterest   (1L<<29)
75706f2543Smrg
76706f2543Smrg#define DRAWABLE_SERIAL_BITS        (~(GC_CHANGE_SERIAL_BIT))
77706f2543Smrg
78706f2543Smrg#define MAX_SERIAL_NUM     (1L<<28)
79706f2543Smrg
80706f2543Smrg#define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \
81706f2543Smrg	    (globalSerialNumber  = 1): globalSerialNumber)
82706f2543Smrg
83706f2543Smrgtypedef struct _GCInterest *GCInterestPtr;
84706f2543Smrgtypedef struct _GC    *GCPtr;
85706f2543Smrgtypedef struct _GCOps *GCOpsPtr;
86706f2543Smrg
87706f2543Smrgextern _X_EXPORT void ValidateGC(
88706f2543Smrg    DrawablePtr /*pDraw*/,
89706f2543Smrg    GCPtr /*pGC*/);
90706f2543Smrg
91706f2543Smrgtypedef union {
92706f2543Smrg    CARD32 val;
93706f2543Smrg    pointer ptr;
94706f2543Smrg} ChangeGCVal, *ChangeGCValPtr;
95706f2543Smrg
96706f2543Smrgextern int ChangeGCXIDs(
97706f2543Smrg    ClientPtr /*client*/,
98706f2543Smrg    GCPtr /*pGC*/,
99706f2543Smrg    BITS32 /*mask*/,
100706f2543Smrg    CARD32 * /*pval*/);
101706f2543Smrg
102706f2543Smrgextern _X_EXPORT int ChangeGC(
103706f2543Smrg    ClientPtr /*client*/,
104706f2543Smrg    GCPtr /*pGC*/,
105706f2543Smrg    BITS32 /*mask*/,
106706f2543Smrg    ChangeGCValPtr /*pCGCV*/);
107706f2543Smrg
108706f2543Smrgextern _X_EXPORT GCPtr CreateGC(
109706f2543Smrg    DrawablePtr /*pDrawable*/,
110706f2543Smrg    BITS32 /*mask*/,
111706f2543Smrg    XID* /*pval*/,
112706f2543Smrg    int* /*pStatus*/,
113706f2543Smrg    XID /*gcid*/,
114706f2543Smrg    ClientPtr /*client*/);
115706f2543Smrg
116706f2543Smrgextern _X_EXPORT int CopyGC(
117706f2543Smrg    GCPtr/*pgcSrc*/,
118706f2543Smrg    GCPtr/*pgcDst*/,
119706f2543Smrg    BITS32 /*mask*/);
120706f2543Smrg
121706f2543Smrgextern _X_EXPORT int FreeGC(
122706f2543Smrg    pointer /*pGC*/,
123706f2543Smrg    XID /*gid*/);
124706f2543Smrg
125706f2543Smrgextern _X_EXPORT void FreeGCperDepth(
126706f2543Smrg    int /*screenNum*/);
127706f2543Smrg
128706f2543Smrgextern _X_EXPORT Bool CreateGCperDepth(
129706f2543Smrg    int /*screenNum*/);
130706f2543Smrg
131706f2543Smrgextern _X_EXPORT Bool CreateDefaultStipple(
132706f2543Smrg    int /*screenNum*/);
133706f2543Smrg
134706f2543Smrgextern _X_EXPORT void FreeDefaultStipple(
135706f2543Smrg    int /*screenNum*/);
136706f2543Smrg
137706f2543Smrgextern _X_EXPORT int SetDashes(
138706f2543Smrg    GCPtr /*pGC*/,
139706f2543Smrg    unsigned /*offset*/,
140706f2543Smrg    unsigned /*ndash*/,
141706f2543Smrg    unsigned char* /*pdash*/);
142706f2543Smrg
143706f2543Smrgextern _X_EXPORT int VerifyRectOrder(
144706f2543Smrg    int /*nrects*/,
145706f2543Smrg    xRectangle* /*prects*/,
146706f2543Smrg    int /*ordering*/);
147706f2543Smrg
148706f2543Smrgextern _X_EXPORT int SetClipRects(
149706f2543Smrg    GCPtr /*pGC*/,
150706f2543Smrg    int /*xOrigin*/,
151706f2543Smrg    int /*yOrigin*/,
152706f2543Smrg    int /*nrects*/,
153706f2543Smrg    xRectangle* /*prects*/,
154706f2543Smrg    int /*ordering*/);
155706f2543Smrg
156706f2543Smrgextern _X_EXPORT GCPtr GetScratchGC(
157706f2543Smrg    unsigned /*depth*/,
158706f2543Smrg    ScreenPtr /*pScreen*/);
159706f2543Smrg
160706f2543Smrgextern _X_EXPORT void FreeScratchGC(
161706f2543Smrg    GCPtr /*pGC*/);
162706f2543Smrg
163706f2543Smrg#endif /* GC_H */
164