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
2505b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
2605b261ecSmrg
2705b261ecSmrg                        All Rights Reserved
2805b261ecSmrg
2935c4bbdfSmrgPermission to use, copy, modify, and distribute this software and its
3035c4bbdfSmrgdocumentation for any purpose and without fee is hereby granted,
3105b261ecSmrgprovided that the above copyright notice appear in all copies and that
3235c4bbdfSmrgboth that copyright notice and this permission notice appear in
3305b261ecSmrgsupporting documentation, and that the name of Digital not be
3405b261ecSmrgused in advertising or publicity pertaining to distribution of the
3535c4bbdfSmrgsoftware without specific, written prior permission.
3605b261ecSmrg
3705b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
3805b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
3905b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4005b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4105b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4205b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4305b261ecSmrgSOFTWARE.
4405b261ecSmrg
4505b261ecSmrg******************************************************************/
4605b261ecSmrg
4705b261ecSmrg#ifndef GCSTRUCT_H
4805b261ecSmrg#define GCSTRUCT_H
4905b261ecSmrg
5005b261ecSmrg#include "gc.h"
5105b261ecSmrg
5205b261ecSmrg#include "regionstr.h"
5305b261ecSmrg#include "region.h"
5405b261ecSmrg#include "pixmap.h"
5505b261ecSmrg#include "screenint.h"
564642e01fSmrg#include "privates.h"
5705b261ecSmrg#include <X11/Xprotostr.h>
5805b261ecSmrg
596747b715Smrg#define GCAllBits ((1 << (GCLastBit + 1)) - 1)
606747b715Smrg
6105b261ecSmrg/*
6205b261ecSmrg * functions which modify the state of the GC
6305b261ecSmrg */
6405b261ecSmrg
6505b261ecSmrgtypedef struct _GCFuncs {
6635c4bbdfSmrg    void (*ValidateGC) (GCPtr /*pGC */ ,
6735c4bbdfSmrg                        unsigned long /*stateChanges */ ,
6835c4bbdfSmrg                        DrawablePtr /*pDrawable */ );
6935c4bbdfSmrg
7035c4bbdfSmrg    void (*ChangeGC) (GCPtr /*pGC */ ,
7135c4bbdfSmrg                      unsigned long /*mask */ );
7235c4bbdfSmrg
7335c4bbdfSmrg    void (*CopyGC) (GCPtr /*pGCSrc */ ,
7435c4bbdfSmrg                    unsigned long /*mask */ ,
7535c4bbdfSmrg                    GCPtr /*pGCDst */ );
7635c4bbdfSmrg
7735c4bbdfSmrg    void (*DestroyGC) (GCPtr /*pGC */ );
7835c4bbdfSmrg
7935c4bbdfSmrg    void (*ChangeClip) (GCPtr pGC,
8035c4bbdfSmrg                        int type,
8135c4bbdfSmrg                        void *pvalue,
8235c4bbdfSmrg                        int nrects);
8335c4bbdfSmrg
8435c4bbdfSmrg    void (*DestroyClip) (GCPtr /*pGC */ );
8535c4bbdfSmrg
8635c4bbdfSmrg    void (*CopyClip) (GCPtr /*pgcDst */ ,
8735c4bbdfSmrg                      GCPtr /*pgcSrc */ );
8805b261ecSmrg} GCFuncs;
8905b261ecSmrg
9005b261ecSmrg/*
9105b261ecSmrg * graphics operations invoked through a GC
9205b261ecSmrg */
9305b261ecSmrg
9405b261ecSmrgtypedef struct _GCOps {
9535c4bbdfSmrg    void (*FillSpans) (DrawablePtr /*pDrawable */ ,
9635c4bbdfSmrg                       GCPtr /*pGC */ ,
9735c4bbdfSmrg                       int /*nInit */ ,
9835c4bbdfSmrg                       DDXPointPtr /*pptInit */ ,
9935c4bbdfSmrg                       int * /*pwidthInit */ ,
10035c4bbdfSmrg                       int /*fSorted */ );
10135c4bbdfSmrg
10235c4bbdfSmrg    void (*SetSpans) (DrawablePtr /*pDrawable */ ,
10335c4bbdfSmrg                      GCPtr /*pGC */ ,
10435c4bbdfSmrg                      char * /*psrc */ ,
10535c4bbdfSmrg                      DDXPointPtr /*ppt */ ,
10635c4bbdfSmrg                      int * /*pwidth */ ,
10735c4bbdfSmrg                      int /*nspans */ ,
10835c4bbdfSmrg                      int /*fSorted */ );
10935c4bbdfSmrg
11035c4bbdfSmrg    void (*PutImage) (DrawablePtr /*pDrawable */ ,
11135c4bbdfSmrg                      GCPtr /*pGC */ ,
11235c4bbdfSmrg                      int /*depth */ ,
11335c4bbdfSmrg                      int /*x */ ,
11435c4bbdfSmrg                      int /*y */ ,
11535c4bbdfSmrg                      int /*w */ ,
11635c4bbdfSmrg                      int /*h */ ,
11735c4bbdfSmrg                      int /*leftPad */ ,
11835c4bbdfSmrg                      int /*format */ ,
11935c4bbdfSmrg                      char * /*pBits */ );
12035c4bbdfSmrg
12135c4bbdfSmrg    RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ ,
12235c4bbdfSmrg                           DrawablePtr /*pDst */ ,
12335c4bbdfSmrg                           GCPtr /*pGC */ ,
12435c4bbdfSmrg                           int /*srcx */ ,
12535c4bbdfSmrg                           int /*srcy */ ,
12635c4bbdfSmrg                           int /*w */ ,
12735c4bbdfSmrg                           int /*h */ ,
12835c4bbdfSmrg                           int /*dstx */ ,
12935c4bbdfSmrg                           int /*dsty */ );
13035c4bbdfSmrg
13135c4bbdfSmrg    RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ ,
13235c4bbdfSmrg                            DrawablePtr /*pDstDrawable */ ,
13335c4bbdfSmrg                            GCPtr /*pGC */ ,
13435c4bbdfSmrg                            int /*srcx */ ,
13535c4bbdfSmrg                            int /*srcy */ ,
13635c4bbdfSmrg                            int /*width */ ,
13735c4bbdfSmrg                            int /*height */ ,
13835c4bbdfSmrg                            int /*dstx */ ,
13935c4bbdfSmrg                            int /*dsty */ ,
14035c4bbdfSmrg                            unsigned long /*bitPlane */ );
14135c4bbdfSmrg    void (*PolyPoint) (DrawablePtr /*pDrawable */ ,
14235c4bbdfSmrg                       GCPtr /*pGC */ ,
14335c4bbdfSmrg                       int /*mode */ ,
14435c4bbdfSmrg                       int /*npt */ ,
14535c4bbdfSmrg                       DDXPointPtr /*pptInit */ );
14635c4bbdfSmrg
14735c4bbdfSmrg    void (*Polylines) (DrawablePtr /*pDrawable */ ,
14835c4bbdfSmrg                       GCPtr /*pGC */ ,
14935c4bbdfSmrg                       int /*mode */ ,
15035c4bbdfSmrg                       int /*npt */ ,
15135c4bbdfSmrg                       DDXPointPtr /*pptInit */ );
15235c4bbdfSmrg
15335c4bbdfSmrg    void (*PolySegment) (DrawablePtr /*pDrawable */ ,
15435c4bbdfSmrg                         GCPtr /*pGC */ ,
15535c4bbdfSmrg                         int /*nseg */ ,
15635c4bbdfSmrg                         xSegment * /*pSegs */ );
15735c4bbdfSmrg
15835c4bbdfSmrg    void (*PolyRectangle) (DrawablePtr /*pDrawable */ ,
15935c4bbdfSmrg                           GCPtr /*pGC */ ,
16035c4bbdfSmrg                           int /*nrects */ ,
16135c4bbdfSmrg                           xRectangle * /*pRects */ );
16235c4bbdfSmrg
16335c4bbdfSmrg    void (*PolyArc) (DrawablePtr /*pDrawable */ ,
16435c4bbdfSmrg                     GCPtr /*pGC */ ,
16535c4bbdfSmrg                     int /*narcs */ ,
16635c4bbdfSmrg                     xArc * /*parcs */ );
16735c4bbdfSmrg
16835c4bbdfSmrg    void (*FillPolygon) (DrawablePtr /*pDrawable */ ,
16935c4bbdfSmrg                         GCPtr /*pGC */ ,
17035c4bbdfSmrg                         int /*shape */ ,
17135c4bbdfSmrg                         int /*mode */ ,
17235c4bbdfSmrg                         int /*count */ ,
17335c4bbdfSmrg                         DDXPointPtr /*pPts */ );
17435c4bbdfSmrg
17535c4bbdfSmrg    void (*PolyFillRect) (DrawablePtr /*pDrawable */ ,
17635c4bbdfSmrg                          GCPtr /*pGC */ ,
17735c4bbdfSmrg                          int /*nrectFill */ ,
17835c4bbdfSmrg                          xRectangle * /*prectInit */ );
17935c4bbdfSmrg
18035c4bbdfSmrg    void (*PolyFillArc) (DrawablePtr /*pDrawable */ ,
18135c4bbdfSmrg                         GCPtr /*pGC */ ,
18235c4bbdfSmrg                         int /*narcs */ ,
18335c4bbdfSmrg                         xArc * /*parcs */ );
18435c4bbdfSmrg
18535c4bbdfSmrg    int (*PolyText8) (DrawablePtr /*pDrawable */ ,
18635c4bbdfSmrg                      GCPtr /*pGC */ ,
18735c4bbdfSmrg                      int /*x */ ,
18835c4bbdfSmrg                      int /*y */ ,
18935c4bbdfSmrg                      int /*count */ ,
19035c4bbdfSmrg                      char * /*chars */ );
19135c4bbdfSmrg
19235c4bbdfSmrg    int (*PolyText16) (DrawablePtr /*pDrawable */ ,
19335c4bbdfSmrg                       GCPtr /*pGC */ ,
19435c4bbdfSmrg                       int /*x */ ,
19535c4bbdfSmrg                       int /*y */ ,
19635c4bbdfSmrg                       int /*count */ ,
19735c4bbdfSmrg                       unsigned short * /*chars */ );
19835c4bbdfSmrg
19935c4bbdfSmrg    void (*ImageText8) (DrawablePtr /*pDrawable */ ,
20035c4bbdfSmrg                        GCPtr /*pGC */ ,
20135c4bbdfSmrg                        int /*x */ ,
20235c4bbdfSmrg                        int /*y */ ,
20335c4bbdfSmrg                        int /*count */ ,
20435c4bbdfSmrg                        char * /*chars */ );
20535c4bbdfSmrg
20635c4bbdfSmrg    void (*ImageText16) (DrawablePtr /*pDrawable */ ,
20735c4bbdfSmrg                         GCPtr /*pGC */ ,
20835c4bbdfSmrg                         int /*x */ ,
20935c4bbdfSmrg                         int /*y */ ,
21035c4bbdfSmrg                         int /*count */ ,
21135c4bbdfSmrg                         unsigned short * /*chars */ );
21235c4bbdfSmrg
21335c4bbdfSmrg    void (*ImageGlyphBlt) (DrawablePtr pDrawable,
21435c4bbdfSmrg                           GCPtr pGC,
21535c4bbdfSmrg                           int x,
21635c4bbdfSmrg                           int y,
21735c4bbdfSmrg                           unsigned int nglyph,
21835c4bbdfSmrg                           CharInfoPtr *ppci,
21935c4bbdfSmrg                           void *pglyphBase);
22035c4bbdfSmrg
22135c4bbdfSmrg    void (*PolyGlyphBlt) (DrawablePtr pDrawable,
22235c4bbdfSmrg                          GCPtr pGC,
22335c4bbdfSmrg                          int x,
22435c4bbdfSmrg                          int y,
22535c4bbdfSmrg                          unsigned int nglyph,
22635c4bbdfSmrg                          CharInfoPtr *ppci,
22735c4bbdfSmrg                          void *pglyphBase);
22835c4bbdfSmrg
22935c4bbdfSmrg    void (*PushPixels) (GCPtr /*pGC */ ,
23035c4bbdfSmrg                        PixmapPtr /*pBitMap */ ,
23135c4bbdfSmrg                        DrawablePtr /*pDst */ ,
23235c4bbdfSmrg                        int /*w */ ,
23335c4bbdfSmrg                        int /*h */ ,
23435c4bbdfSmrg                        int /*x */ ,
23535c4bbdfSmrg                        int /*y */ );
23605b261ecSmrg} GCOps;
23705b261ecSmrg
23805b261ecSmrg/* there is padding in the bit fields because the Sun compiler doesn't
23905b261ecSmrg * force alignment to 32-bit boundaries.  losers.
24005b261ecSmrg */
24105b261ecSmrgtypedef struct _GC {
24235c4bbdfSmrg    ScreenPtr pScreen;
24335c4bbdfSmrg    unsigned char depth;
24435c4bbdfSmrg    unsigned char alu;
24535c4bbdfSmrg    unsigned short lineWidth;
24635c4bbdfSmrg    unsigned short dashOffset;
24735c4bbdfSmrg    unsigned short numInDashList;
24835c4bbdfSmrg    unsigned char *dash;
24935c4bbdfSmrg    unsigned int lineStyle:2;
25035c4bbdfSmrg    unsigned int capStyle:2;
25135c4bbdfSmrg    unsigned int joinStyle:2;
25235c4bbdfSmrg    unsigned int fillStyle:2;
25335c4bbdfSmrg    unsigned int fillRule:1;
25435c4bbdfSmrg    unsigned int arcMode:1;
25535c4bbdfSmrg    unsigned int subWindowMode:1;
25635c4bbdfSmrg    unsigned int graphicsExposures:1;
25735c4bbdfSmrg    unsigned int miTranslate:1; /* should mi things translate? */
25835c4bbdfSmrg    unsigned int tileIsPixel:1; /* tile is solid pixel */
25935c4bbdfSmrg    unsigned int fExpose:1;     /* Call exposure handling */
26035c4bbdfSmrg    unsigned int freeCompClip:1;        /* Free composite clip */
26135c4bbdfSmrg    unsigned int scratch_inuse:1;       /* is this GC in a pool for reuse? */
26235c4bbdfSmrg    unsigned int unused:15;     /* see comment above */
26335c4bbdfSmrg    unsigned int planemask;
26435c4bbdfSmrg    unsigned int fgPixel;
26535c4bbdfSmrg    unsigned int bgPixel;
26605b261ecSmrg    /*
26705b261ecSmrg     * alas -- both tile and stipple must be here as they
26805b261ecSmrg     * are independently specifiable
26905b261ecSmrg     */
27035c4bbdfSmrg    PixUnion tile;
27135c4bbdfSmrg    PixmapPtr stipple;
27235c4bbdfSmrg    DDXPointRec patOrg;         /* origin for (tile, stipple) */
27335c4bbdfSmrg    DDXPointRec clipOrg;
27435c4bbdfSmrg    struct _Font *font;
27535c4bbdfSmrg    RegionPtr clientClip;
27635c4bbdfSmrg    unsigned int stateChanges; /* masked with GC_<kind> */
27735c4bbdfSmrg    unsigned int serialNumber;
27835c4bbdfSmrg    const GCFuncs *funcs;
27935c4bbdfSmrg    const GCOps *ops;
28035c4bbdfSmrg    PrivateRec *devPrivates;
28135c4bbdfSmrg    RegionPtr pCompositeClip;
28205b261ecSmrg} GC;
28305b261ecSmrg
28435c4bbdfSmrg#endif                          /* GCSTRUCT_H */
285