gcstruct.h revision 05b261ec
105b261ecSmrg/***********************************************************
205b261ecSmrg
305b261ecSmrgCopyright 1987, 1998  The Open Group
405b261ecSmrg
505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its
605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that
705b261ecSmrgthe above copyright notice appear in all copies and that both that
805b261ecSmrgcopyright notice and this permission notice appear in supporting
905b261ecSmrgdocumentation.
1005b261ecSmrg
1105b261ecSmrgThe above copyright notice and this permission notice shall be included in
1205b261ecSmrgall copies or substantial portions of the Software.
1305b261ecSmrg
1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1705b261ecSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1805b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2005b261ecSmrg
2105b261ecSmrgExcept as contained in this notice, the name of The Open Group shall not be
2205b261ecSmrgused in advertising or otherwise to promote the sale, use or other dealings
2305b261ecSmrgin this Software without prior written authorization from The Open Group.
2405b261ecSmrg
2505b261ecSmrg
2605b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
2705b261ecSmrg
2805b261ecSmrg                        All Rights Reserved
2905b261ecSmrg
3005b261ecSmrgPermission to use, copy, modify, and distribute this software and its
3105b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
3205b261ecSmrgprovided that the above copyright notice appear in all copies and that
3305b261ecSmrgboth that copyright notice and this permission notice appear in
3405b261ecSmrgsupporting documentation, and that the name of Digital not be
3505b261ecSmrgused in advertising or publicity pertaining to distribution of the
3605b261ecSmrgsoftware without specific, written prior permission.
3705b261ecSmrg
3805b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
3905b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
4005b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4105b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4205b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4305b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4405b261ecSmrgSOFTWARE.
4505b261ecSmrg
4605b261ecSmrg******************************************************************/
4705b261ecSmrg
4805b261ecSmrg
4905b261ecSmrg
5005b261ecSmrg#ifndef GCSTRUCT_H
5105b261ecSmrg#define GCSTRUCT_H
5205b261ecSmrg
5305b261ecSmrg#include "gc.h"
5405b261ecSmrg
5505b261ecSmrg#include "regionstr.h"
5605b261ecSmrg#include "region.h"
5705b261ecSmrg#include "pixmap.h"
5805b261ecSmrg#include "screenint.h"
5905b261ecSmrg#include <X11/Xprotostr.h>
6005b261ecSmrg
6105b261ecSmrg/*
6205b261ecSmrg * functions which modify the state of the GC
6305b261ecSmrg */
6405b261ecSmrg
6505b261ecSmrgtypedef struct _GCFuncs {
6605b261ecSmrg    void	(* ValidateGC)(
6705b261ecSmrg		GCPtr /*pGC*/,
6805b261ecSmrg		unsigned long /*stateChanges*/,
6905b261ecSmrg		DrawablePtr /*pDrawable*/);
7005b261ecSmrg
7105b261ecSmrg    void	(* ChangeGC)(
7205b261ecSmrg		GCPtr /*pGC*/,
7305b261ecSmrg		unsigned long /*mask*/);
7405b261ecSmrg
7505b261ecSmrg    void	(* CopyGC)(
7605b261ecSmrg		GCPtr /*pGCSrc*/,
7705b261ecSmrg		unsigned long /*mask*/,
7805b261ecSmrg		GCPtr /*pGCDst*/);
7905b261ecSmrg
8005b261ecSmrg    void	(* DestroyGC)(
8105b261ecSmrg		GCPtr /*pGC*/);
8205b261ecSmrg
8305b261ecSmrg    void	(* ChangeClip)(
8405b261ecSmrg		GCPtr /*pGC*/,
8505b261ecSmrg		int /*type*/,
8605b261ecSmrg		pointer /*pvalue*/,
8705b261ecSmrg		int /*nrects*/);
8805b261ecSmrg
8905b261ecSmrg    void	(* DestroyClip)(
9005b261ecSmrg		GCPtr /*pGC*/);
9105b261ecSmrg
9205b261ecSmrg    void	(* CopyClip)(
9305b261ecSmrg		GCPtr /*pgcDst*/,
9405b261ecSmrg		GCPtr /*pgcSrc*/);
9505b261ecSmrg    DevUnion	devPrivate;
9605b261ecSmrg} GCFuncs;
9705b261ecSmrg
9805b261ecSmrg/*
9905b261ecSmrg * graphics operations invoked through a GC
10005b261ecSmrg */
10105b261ecSmrg
10205b261ecSmrgtypedef struct _GCOps {
10305b261ecSmrg    void	(* FillSpans)(
10405b261ecSmrg		DrawablePtr /*pDrawable*/,
10505b261ecSmrg		GCPtr /*pGC*/,
10605b261ecSmrg		int /*nInit*/,
10705b261ecSmrg		DDXPointPtr /*pptInit*/,
10805b261ecSmrg		int * /*pwidthInit*/,
10905b261ecSmrg		int /*fSorted*/);
11005b261ecSmrg
11105b261ecSmrg    void	(* SetSpans)(
11205b261ecSmrg		DrawablePtr /*pDrawable*/,
11305b261ecSmrg		GCPtr /*pGC*/,
11405b261ecSmrg		char * /*psrc*/,
11505b261ecSmrg		DDXPointPtr /*ppt*/,
11605b261ecSmrg		int * /*pwidth*/,
11705b261ecSmrg		int /*nspans*/,
11805b261ecSmrg		int /*fSorted*/);
11905b261ecSmrg
12005b261ecSmrg    void	(* PutImage)(
12105b261ecSmrg		DrawablePtr /*pDrawable*/,
12205b261ecSmrg		GCPtr /*pGC*/,
12305b261ecSmrg		int /*depth*/,
12405b261ecSmrg		int /*x*/,
12505b261ecSmrg		int /*y*/,
12605b261ecSmrg		int /*w*/,
12705b261ecSmrg		int /*h*/,
12805b261ecSmrg		int /*leftPad*/,
12905b261ecSmrg		int /*format*/,
13005b261ecSmrg		char * /*pBits*/);
13105b261ecSmrg
13205b261ecSmrg    RegionPtr	(* CopyArea)(
13305b261ecSmrg		DrawablePtr /*pSrc*/,
13405b261ecSmrg		DrawablePtr /*pDst*/,
13505b261ecSmrg		GCPtr /*pGC*/,
13605b261ecSmrg		int /*srcx*/,
13705b261ecSmrg		int /*srcy*/,
13805b261ecSmrg		int /*w*/,
13905b261ecSmrg		int /*h*/,
14005b261ecSmrg		int /*dstx*/,
14105b261ecSmrg		int /*dsty*/);
14205b261ecSmrg
14305b261ecSmrg    RegionPtr	(* CopyPlane)(
14405b261ecSmrg		DrawablePtr /*pSrcDrawable*/,
14505b261ecSmrg		DrawablePtr /*pDstDrawable*/,
14605b261ecSmrg		GCPtr /*pGC*/,
14705b261ecSmrg		int /*srcx*/,
14805b261ecSmrg		int /*srcy*/,
14905b261ecSmrg		int /*width*/,
15005b261ecSmrg		int /*height*/,
15105b261ecSmrg		int /*dstx*/,
15205b261ecSmrg		int /*dsty*/,
15305b261ecSmrg		unsigned long /*bitPlane*/);
15405b261ecSmrg    void	(* PolyPoint)(
15505b261ecSmrg		DrawablePtr /*pDrawable*/,
15605b261ecSmrg		GCPtr /*pGC*/,
15705b261ecSmrg		int /*mode*/,
15805b261ecSmrg		int /*npt*/,
15905b261ecSmrg		DDXPointPtr /*pptInit*/);
16005b261ecSmrg
16105b261ecSmrg    void	(* Polylines)(
16205b261ecSmrg		DrawablePtr /*pDrawable*/,
16305b261ecSmrg		GCPtr /*pGC*/,
16405b261ecSmrg		int /*mode*/,
16505b261ecSmrg		int /*npt*/,
16605b261ecSmrg		DDXPointPtr /*pptInit*/);
16705b261ecSmrg
16805b261ecSmrg    void	(* PolySegment)(
16905b261ecSmrg		DrawablePtr /*pDrawable*/,
17005b261ecSmrg		GCPtr /*pGC*/,
17105b261ecSmrg		int /*nseg*/,
17205b261ecSmrg		xSegment * /*pSegs*/);
17305b261ecSmrg
17405b261ecSmrg    void	(* PolyRectangle)(
17505b261ecSmrg		DrawablePtr /*pDrawable*/,
17605b261ecSmrg		GCPtr /*pGC*/,
17705b261ecSmrg		int /*nrects*/,
17805b261ecSmrg		xRectangle * /*pRects*/);
17905b261ecSmrg
18005b261ecSmrg    void	(* PolyArc)(
18105b261ecSmrg		DrawablePtr /*pDrawable*/,
18205b261ecSmrg		GCPtr /*pGC*/,
18305b261ecSmrg		int /*narcs*/,
18405b261ecSmrg		xArc * /*parcs*/);
18505b261ecSmrg
18605b261ecSmrg    void	(* FillPolygon)(
18705b261ecSmrg		DrawablePtr /*pDrawable*/,
18805b261ecSmrg		GCPtr /*pGC*/,
18905b261ecSmrg		int /*shape*/,
19005b261ecSmrg		int /*mode*/,
19105b261ecSmrg		int /*count*/,
19205b261ecSmrg		DDXPointPtr /*pPts*/);
19305b261ecSmrg
19405b261ecSmrg    void	(* PolyFillRect)(
19505b261ecSmrg		DrawablePtr /*pDrawable*/,
19605b261ecSmrg		GCPtr /*pGC*/,
19705b261ecSmrg		int /*nrectFill*/,
19805b261ecSmrg		xRectangle * /*prectInit*/);
19905b261ecSmrg
20005b261ecSmrg    void	(* PolyFillArc)(
20105b261ecSmrg		DrawablePtr /*pDrawable*/,
20205b261ecSmrg		GCPtr /*pGC*/,
20305b261ecSmrg		int /*narcs*/,
20405b261ecSmrg		xArc * /*parcs*/);
20505b261ecSmrg
20605b261ecSmrg    int		(* PolyText8)(
20705b261ecSmrg		DrawablePtr /*pDrawable*/,
20805b261ecSmrg		GCPtr /*pGC*/,
20905b261ecSmrg		int /*x*/,
21005b261ecSmrg		int /*y*/,
21105b261ecSmrg		int /*count*/,
21205b261ecSmrg		char * /*chars*/);
21305b261ecSmrg
21405b261ecSmrg    int		(* PolyText16)(
21505b261ecSmrg		DrawablePtr /*pDrawable*/,
21605b261ecSmrg		GCPtr /*pGC*/,
21705b261ecSmrg		int /*x*/,
21805b261ecSmrg		int /*y*/,
21905b261ecSmrg		int /*count*/,
22005b261ecSmrg		unsigned short * /*chars*/);
22105b261ecSmrg
22205b261ecSmrg    void	(* ImageText8)(
22305b261ecSmrg		DrawablePtr /*pDrawable*/,
22405b261ecSmrg		GCPtr /*pGC*/,
22505b261ecSmrg		int /*x*/,
22605b261ecSmrg		int /*y*/,
22705b261ecSmrg		int /*count*/,
22805b261ecSmrg		char * /*chars*/);
22905b261ecSmrg
23005b261ecSmrg    void	(* ImageText16)(
23105b261ecSmrg		DrawablePtr /*pDrawable*/,
23205b261ecSmrg		GCPtr /*pGC*/,
23305b261ecSmrg		int /*x*/,
23405b261ecSmrg		int /*y*/,
23505b261ecSmrg		int /*count*/,
23605b261ecSmrg		unsigned short * /*chars*/);
23705b261ecSmrg
23805b261ecSmrg    void	(* ImageGlyphBlt)(
23905b261ecSmrg		DrawablePtr /*pDrawable*/,
24005b261ecSmrg		GCPtr /*pGC*/,
24105b261ecSmrg		int /*x*/,
24205b261ecSmrg		int /*y*/,
24305b261ecSmrg		unsigned int /*nglyph*/,
24405b261ecSmrg		CharInfoPtr * /*ppci*/,
24505b261ecSmrg		pointer /*pglyphBase*/);
24605b261ecSmrg
24705b261ecSmrg    void	(* PolyGlyphBlt)(
24805b261ecSmrg		DrawablePtr /*pDrawable*/,
24905b261ecSmrg		GCPtr /*pGC*/,
25005b261ecSmrg		int /*x*/,
25105b261ecSmrg		int /*y*/,
25205b261ecSmrg		unsigned int /*nglyph*/,
25305b261ecSmrg		CharInfoPtr * /*ppci*/,
25405b261ecSmrg		pointer /*pglyphBase*/);
25505b261ecSmrg
25605b261ecSmrg    void	(* PushPixels)(
25705b261ecSmrg		GCPtr /*pGC*/,
25805b261ecSmrg		PixmapPtr /*pBitMap*/,
25905b261ecSmrg		DrawablePtr /*pDst*/,
26005b261ecSmrg		int /*w*/,
26105b261ecSmrg		int /*h*/,
26205b261ecSmrg		int /*x*/,
26305b261ecSmrg		int /*y*/);
26405b261ecSmrg
26505b261ecSmrg    DevUnion	devPrivate;
26605b261ecSmrg} GCOps;
26705b261ecSmrg
26805b261ecSmrg/* there is padding in the bit fields because the Sun compiler doesn't
26905b261ecSmrg * force alignment to 32-bit boundaries.  losers.
27005b261ecSmrg */
27105b261ecSmrgtypedef struct _GC {
27205b261ecSmrg    ScreenPtr		pScreen;
27305b261ecSmrg    unsigned char	depth;
27405b261ecSmrg    unsigned char	alu;
27505b261ecSmrg    unsigned short	lineWidth;
27605b261ecSmrg    unsigned short	dashOffset;
27705b261ecSmrg    unsigned short	numInDashList;
27805b261ecSmrg    unsigned char	*dash;
27905b261ecSmrg    unsigned int	lineStyle : 2;
28005b261ecSmrg    unsigned int	capStyle : 2;
28105b261ecSmrg    unsigned int	joinStyle : 2;
28205b261ecSmrg    unsigned int	fillStyle : 2;
28305b261ecSmrg    unsigned int	fillRule : 1;
28405b261ecSmrg    unsigned int 	arcMode : 1;
28505b261ecSmrg    unsigned int	subWindowMode : 1;
28605b261ecSmrg    unsigned int	graphicsExposures : 1;
28705b261ecSmrg    unsigned int	clientClipType : 2; /* CT_<kind> */
28805b261ecSmrg    unsigned int	miTranslate:1; /* should mi things translate? */
28905b261ecSmrg    unsigned int	tileIsPixel:1; /* tile is solid pixel */
29005b261ecSmrg    unsigned int	fExpose:1;     /* Call exposure handling */
29105b261ecSmrg    unsigned int	freeCompClip:1;  /* Free composite clip */
29205b261ecSmrg    unsigned int	unused:14; /* see comment above */
29305b261ecSmrg    unsigned long	planemask;
29405b261ecSmrg    unsigned long	fgPixel;
29505b261ecSmrg    unsigned long	bgPixel;
29605b261ecSmrg    /*
29705b261ecSmrg     * alas -- both tile and stipple must be here as they
29805b261ecSmrg     * are independently specifiable
29905b261ecSmrg     */
30005b261ecSmrg    PixUnion		tile;
30105b261ecSmrg    PixmapPtr		stipple;
30205b261ecSmrg    DDXPointRec		patOrg;		/* origin for (tile, stipple) */
30305b261ecSmrg    struct _Font	*font;
30405b261ecSmrg    DDXPointRec		clipOrg;
30505b261ecSmrg    DDXPointRec		lastWinOrg;	/* position of window last validated */
30605b261ecSmrg    pointer		clientClip;
30705b261ecSmrg    unsigned long	stateChanges;	/* masked with GC_<kind> */
30805b261ecSmrg    unsigned long       serialNumber;
30905b261ecSmrg    GCFuncs		*funcs;
31005b261ecSmrg    GCOps		*ops;
31105b261ecSmrg    DevUnion		*devPrivates;
31205b261ecSmrg    /*
31305b261ecSmrg     * The following were moved here from private storage to allow device-
31405b261ecSmrg     * independent access to them from screen wrappers.
31505b261ecSmrg     * --- 1997.11.03  Marc Aurele La France (tsi@xfree86.org)
31605b261ecSmrg     */
31705b261ecSmrg    PixmapPtr		pRotatedPixmap; /* tile/stipple rotated for alignment */
31805b261ecSmrg    RegionPtr		pCompositeClip;
31905b261ecSmrg    /* fExpose & freeCompClip defined above */
32005b261ecSmrg} GC;
32105b261ecSmrg
32205b261ecSmrg#endif /* GCSTRUCT_H */
323