gcstruct.h revision 4642e01f
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
49
50#ifndef GCSTRUCT_H
51#define GCSTRUCT_H
52
53#include "gc.h"
54
55#include "regionstr.h"
56#include "region.h"
57#include "pixmap.h"
58#include "screenint.h"
59#include "privates.h"
60#include <X11/Xprotostr.h>
61
62/*
63 * functions which modify the state of the GC
64 */
65
66typedef struct _GCFuncs {
67    void	(* ValidateGC)(
68		GCPtr /*pGC*/,
69		unsigned long /*stateChanges*/,
70		DrawablePtr /*pDrawable*/);
71
72    void	(* ChangeGC)(
73		GCPtr /*pGC*/,
74		unsigned long /*mask*/);
75
76    void	(* CopyGC)(
77		GCPtr /*pGCSrc*/,
78		unsigned long /*mask*/,
79		GCPtr /*pGCDst*/);
80
81    void	(* DestroyGC)(
82		GCPtr /*pGC*/);
83
84    void	(* ChangeClip)(
85		GCPtr /*pGC*/,
86		int /*type*/,
87		pointer /*pvalue*/,
88		int /*nrects*/);
89
90    void	(* DestroyClip)(
91		GCPtr /*pGC*/);
92
93    void	(* CopyClip)(
94		GCPtr /*pgcDst*/,
95		GCPtr /*pgcSrc*/);
96    DevUnion	devPrivate;
97} GCFuncs;
98
99/*
100 * graphics operations invoked through a GC
101 */
102
103typedef struct _GCOps {
104    void	(* FillSpans)(
105		DrawablePtr /*pDrawable*/,
106		GCPtr /*pGC*/,
107		int /*nInit*/,
108		DDXPointPtr /*pptInit*/,
109		int * /*pwidthInit*/,
110		int /*fSorted*/);
111
112    void	(* SetSpans)(
113		DrawablePtr /*pDrawable*/,
114		GCPtr /*pGC*/,
115		char * /*psrc*/,
116		DDXPointPtr /*ppt*/,
117		int * /*pwidth*/,
118		int /*nspans*/,
119		int /*fSorted*/);
120
121    void	(* PutImage)(
122		DrawablePtr /*pDrawable*/,
123		GCPtr /*pGC*/,
124		int /*depth*/,
125		int /*x*/,
126		int /*y*/,
127		int /*w*/,
128		int /*h*/,
129		int /*leftPad*/,
130		int /*format*/,
131		char * /*pBits*/);
132
133    RegionPtr	(* CopyArea)(
134		DrawablePtr /*pSrc*/,
135		DrawablePtr /*pDst*/,
136		GCPtr /*pGC*/,
137		int /*srcx*/,
138		int /*srcy*/,
139		int /*w*/,
140		int /*h*/,
141		int /*dstx*/,
142		int /*dsty*/);
143
144    RegionPtr	(* CopyPlane)(
145		DrawablePtr /*pSrcDrawable*/,
146		DrawablePtr /*pDstDrawable*/,
147		GCPtr /*pGC*/,
148		int /*srcx*/,
149		int /*srcy*/,
150		int /*width*/,
151		int /*height*/,
152		int /*dstx*/,
153		int /*dsty*/,
154		unsigned long /*bitPlane*/);
155    void	(* PolyPoint)(
156		DrawablePtr /*pDrawable*/,
157		GCPtr /*pGC*/,
158		int /*mode*/,
159		int /*npt*/,
160		DDXPointPtr /*pptInit*/);
161
162    void	(* Polylines)(
163		DrawablePtr /*pDrawable*/,
164		GCPtr /*pGC*/,
165		int /*mode*/,
166		int /*npt*/,
167		DDXPointPtr /*pptInit*/);
168
169    void	(* PolySegment)(
170		DrawablePtr /*pDrawable*/,
171		GCPtr /*pGC*/,
172		int /*nseg*/,
173		xSegment * /*pSegs*/);
174
175    void	(* PolyRectangle)(
176		DrawablePtr /*pDrawable*/,
177		GCPtr /*pGC*/,
178		int /*nrects*/,
179		xRectangle * /*pRects*/);
180
181    void	(* PolyArc)(
182		DrawablePtr /*pDrawable*/,
183		GCPtr /*pGC*/,
184		int /*narcs*/,
185		xArc * /*parcs*/);
186
187    void	(* FillPolygon)(
188		DrawablePtr /*pDrawable*/,
189		GCPtr /*pGC*/,
190		int /*shape*/,
191		int /*mode*/,
192		int /*count*/,
193		DDXPointPtr /*pPts*/);
194
195    void	(* PolyFillRect)(
196		DrawablePtr /*pDrawable*/,
197		GCPtr /*pGC*/,
198		int /*nrectFill*/,
199		xRectangle * /*prectInit*/);
200
201    void	(* PolyFillArc)(
202		DrawablePtr /*pDrawable*/,
203		GCPtr /*pGC*/,
204		int /*narcs*/,
205		xArc * /*parcs*/);
206
207    int		(* PolyText8)(
208		DrawablePtr /*pDrawable*/,
209		GCPtr /*pGC*/,
210		int /*x*/,
211		int /*y*/,
212		int /*count*/,
213		char * /*chars*/);
214
215    int		(* PolyText16)(
216		DrawablePtr /*pDrawable*/,
217		GCPtr /*pGC*/,
218		int /*x*/,
219		int /*y*/,
220		int /*count*/,
221		unsigned short * /*chars*/);
222
223    void	(* ImageText8)(
224		DrawablePtr /*pDrawable*/,
225		GCPtr /*pGC*/,
226		int /*x*/,
227		int /*y*/,
228		int /*count*/,
229		char * /*chars*/);
230
231    void	(* ImageText16)(
232		DrawablePtr /*pDrawable*/,
233		GCPtr /*pGC*/,
234		int /*x*/,
235		int /*y*/,
236		int /*count*/,
237		unsigned short * /*chars*/);
238
239    void	(* ImageGlyphBlt)(
240		DrawablePtr /*pDrawable*/,
241		GCPtr /*pGC*/,
242		int /*x*/,
243		int /*y*/,
244		unsigned int /*nglyph*/,
245		CharInfoPtr * /*ppci*/,
246		pointer /*pglyphBase*/);
247
248    void	(* PolyGlyphBlt)(
249		DrawablePtr /*pDrawable*/,
250		GCPtr /*pGC*/,
251		int /*x*/,
252		int /*y*/,
253		unsigned int /*nglyph*/,
254		CharInfoPtr * /*ppci*/,
255		pointer /*pglyphBase*/);
256
257    void	(* PushPixels)(
258		GCPtr /*pGC*/,
259		PixmapPtr /*pBitMap*/,
260		DrawablePtr /*pDst*/,
261		int /*w*/,
262		int /*h*/,
263		int /*x*/,
264		int /*y*/);
265
266    DevUnion	devPrivate;
267} GCOps;
268
269/* there is padding in the bit fields because the Sun compiler doesn't
270 * force alignment to 32-bit boundaries.  losers.
271 */
272typedef struct _GC {
273    ScreenPtr		pScreen;
274    unsigned char	depth;
275    unsigned char	alu;
276    unsigned short	lineWidth;
277    unsigned short	dashOffset;
278    unsigned short	numInDashList;
279    unsigned char	*dash;
280    unsigned int	lineStyle : 2;
281    unsigned int	capStyle : 2;
282    unsigned int	joinStyle : 2;
283    unsigned int	fillStyle : 2;
284    unsigned int	fillRule : 1;
285    unsigned int 	arcMode : 1;
286    unsigned int	subWindowMode : 1;
287    unsigned int	graphicsExposures : 1;
288    unsigned int	clientClipType : 2; /* CT_<kind> */
289    unsigned int	miTranslate:1; /* should mi things translate? */
290    unsigned int	tileIsPixel:1; /* tile is solid pixel */
291    unsigned int	fExpose:1;     /* Call exposure handling */
292    unsigned int	freeCompClip:1;  /* Free composite clip */
293    unsigned int	unused:14; /* see comment above */
294    unsigned long	planemask;
295    unsigned long	fgPixel;
296    unsigned long	bgPixel;
297    /*
298     * alas -- both tile and stipple must be here as they
299     * are independently specifiable
300     */
301    PixUnion		tile;
302    PixmapPtr		stipple;
303    DDXPointRec		patOrg;		/* origin for (tile, stipple) */
304    struct _Font	*font;
305    DDXPointRec		clipOrg;
306    DDXPointRec		lastWinOrg;	/* position of window last validated */
307    pointer		clientClip;
308    unsigned long	stateChanges;	/* masked with GC_<kind> */
309    unsigned long       serialNumber;
310    GCFuncs		*funcs;
311    GCOps		*ops;
312    PrivateRec		*devPrivates;
313    /*
314     * The following were moved here from private storage to allow device-
315     * independent access to them from screen wrappers.
316     * --- 1997.11.03  Marc Aurele La France (tsi@xfree86.org)
317     */
318    PixmapPtr		pRotatedPixmap; /* tile/stipple rotated for alignment */
319    RegionPtr		pCompositeClip;
320    /* fExpose & freeCompClip defined above */
321} GC;
322
323#endif /* GCSTRUCT_H */
324