| 1 | /*********************************************************** |
| 2 | |
| 3 | Copyright 1987, 1998 The Open Group |
| 4 | |
| 5 | Permission to use, copy, modify, distribute, and sell this software and its |
| 6 | documentation for any purpose is hereby granted without fee, provided that |
| 7 | the above copyright notice appear in all copies and that both that |
| 8 | copyright notice and this permission notice appear in supporting |
| 9 | documentation. |
| 10 | |
| 11 | The above copyright notice and this permission notice shall be included in |
| 12 | all copies or substantial portions of the Software. |
| 13 | |
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 20 | |
| 21 | Except as contained in this notice, the name of The Open Group shall not be |
| 22 | used in advertising or otherwise to promote the sale, use or other dealings |
| 23 | in this Software without prior written authorization from The Open Group. |
| 24 | |
| 25 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. |
| 26 | |
| 27 | All Rights Reserved |
| 28 | |
| 29 | Permission to use, copy, modify, and distribute this software and its |
| 30 | documentation for any purpose and without fee is hereby granted, |
| 31 | provided that the above copyright notice appear in all copies and that |
| 32 | both that copyright notice and this permission notice appear in |
| 33 | supporting documentation, and that the name of Digital not be |
| 34 | used in advertising or publicity pertaining to distribution of the |
| 35 | software without specific, written prior permission. |
| 36 | |
| 37 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING |
| 38 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL |
| 39 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR |
| 40 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
| 41 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
| 42 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
| 43 | SOFTWARE. |
| 44 | |
| 45 | ******************************************************************/ |
| 46 | |
| 47 | #ifndef GCSTRUCT_H |
| 48 | #define GCSTRUCT_H |
| 49 | |
| 50 | #include "gc.h" |
| 51 | |
| 52 | #include "regionstr.h" |
| 53 | #include "region.h" |
| 54 | #include "pixmap.h" |
| 55 | #include "screenint.h" |
| 56 | #include "privates.h" |
| 57 | #include <X11/Xprotostr.h> |
| 58 | |
| 59 | #define GCAllBits ((1 << (GCLastBit + 1)) - 1) |
| 60 | |
| 61 | /* |
| 62 | * functions which modify the state of the GC |
| 63 | */ |
| 64 | |
| 65 | typedef struct _GCFuncs { |
| 66 | void (*ValidateGC) (GCPtr /*pGC */ , |
| 67 | unsigned long /*stateChanges */ , |
| 68 | DrawablePtr /*pDrawable */ ); |
| 69 | |
| 70 | void (*ChangeGC) (GCPtr /*pGC */ , |
| 71 | unsigned long /*mask */ ); |
| 72 | |
| 73 | void (*CopyGC) (GCPtr /*pGCSrc */ , |
| 74 | unsigned long /*mask */ , |
| 75 | GCPtr /*pGCDst */ ); |
| 76 | |
| 77 | void (*DestroyGC) (GCPtr /*pGC */ ); |
| 78 | |
| 79 | void (*ChangeClip) (GCPtr /*pGC */ , |
| 80 | int /*type */ , |
| 81 | pointer /*pvalue */ , |
| 82 | int /*nrects */ ); |
| 83 | |
| 84 | void (*DestroyClip) (GCPtr /*pGC */ ); |
| 85 | |
| 86 | void (*CopyClip) (GCPtr /*pgcDst */ , |
| 87 | GCPtr /*pgcSrc */ ); |
| 88 | } GCFuncs; |
| 89 | |
| 90 | /* |
| 91 | * graphics operations invoked through a GC |
| 92 | */ |
| 93 | |
| 94 | typedef struct _GCOps { |
| 95 | void (*FillSpans) (DrawablePtr /*pDrawable */ , |
| 96 | GCPtr /*pGC */ , |
| 97 | int /*nInit */ , |
| 98 | DDXPointPtr /*pptInit */ , |
| 99 | int * /*pwidthInit */ , |
| 100 | int /*fSorted */ ); |
| 101 | |
| 102 | void (*SetSpans) (DrawablePtr /*pDrawable */ , |
| 103 | GCPtr /*pGC */ , |
| 104 | char * /*psrc */ , |
| 105 | DDXPointPtr /*ppt */ , |
| 106 | int * /*pwidth */ , |
| 107 | int /*nspans */ , |
| 108 | int /*fSorted */ ); |
| 109 | |
| 110 | void (*PutImage) (DrawablePtr /*pDrawable */ , |
| 111 | GCPtr /*pGC */ , |
| 112 | int /*depth */ , |
| 113 | int /*x */ , |
| 114 | int /*y */ , |
| 115 | int /*w */ , |
| 116 | int /*h */ , |
| 117 | int /*leftPad */ , |
| 118 | int /*format */ , |
| 119 | char * /*pBits */ ); |
| 120 | |
| 121 | RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ , |
| 122 | DrawablePtr /*pDst */ , |
| 123 | GCPtr /*pGC */ , |
| 124 | int /*srcx */ , |
| 125 | int /*srcy */ , |
| 126 | int /*w */ , |
| 127 | int /*h */ , |
| 128 | int /*dstx */ , |
| 129 | int /*dsty */ ); |
| 130 | |
| 131 | RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ , |
| 132 | DrawablePtr /*pDstDrawable */ , |
| 133 | GCPtr /*pGC */ , |
| 134 | int /*srcx */ , |
| 135 | int /*srcy */ , |
| 136 | int /*width */ , |
| 137 | int /*height */ , |
| 138 | int /*dstx */ , |
| 139 | int /*dsty */ , |
| 140 | unsigned long /*bitPlane */ ); |
| 141 | void (*PolyPoint) (DrawablePtr /*pDrawable */ , |
| 142 | GCPtr /*pGC */ , |
| 143 | int /*mode */ , |
| 144 | int /*npt */ , |
| 145 | DDXPointPtr /*pptInit */ ); |
| 146 | |
| 147 | void (*Polylines) (DrawablePtr /*pDrawable */ , |
| 148 | GCPtr /*pGC */ , |
| 149 | int /*mode */ , |
| 150 | int /*npt */ , |
| 151 | DDXPointPtr /*pptInit */ ); |
| 152 | |
| 153 | void (*PolySegment) (DrawablePtr /*pDrawable */ , |
| 154 | GCPtr /*pGC */ , |
| 155 | int /*nseg */ , |
| 156 | xSegment * /*pSegs */ ); |
| 157 | |
| 158 | void (*PolyRectangle) (DrawablePtr /*pDrawable */ , |
| 159 | GCPtr /*pGC */ , |
| 160 | int /*nrects */ , |
| 161 | xRectangle * /*pRects */ ); |
| 162 | |
| 163 | void (*PolyArc) (DrawablePtr /*pDrawable */ , |
| 164 | GCPtr /*pGC */ , |
| 165 | int /*narcs */ , |
| 166 | xArc * /*parcs */ ); |
| 167 | |
| 168 | void (*FillPolygon) (DrawablePtr /*pDrawable */ , |
| 169 | GCPtr /*pGC */ , |
| 170 | int /*shape */ , |
| 171 | int /*mode */ , |
| 172 | int /*count */ , |
| 173 | DDXPointPtr /*pPts */ ); |
| 174 | |
| 175 | void (*PolyFillRect) (DrawablePtr /*pDrawable */ , |
| 176 | GCPtr /*pGC */ , |
| 177 | int /*nrectFill */ , |
| 178 | xRectangle * /*prectInit */ ); |
| 179 | |
| 180 | void (*PolyFillArc) (DrawablePtr /*pDrawable */ , |
| 181 | GCPtr /*pGC */ , |
| 182 | int /*narcs */ , |
| 183 | xArc * /*parcs */ ); |
| 184 | |
| 185 | int (*PolyText8) (DrawablePtr /*pDrawable */ , |
| 186 | GCPtr /*pGC */ , |
| 187 | int /*x */ , |
| 188 | int /*y */ , |
| 189 | int /*count */ , |
| 190 | char * /*chars */ ); |
| 191 | |
| 192 | int (*PolyText16) (DrawablePtr /*pDrawable */ , |
| 193 | GCPtr /*pGC */ , |
| 194 | int /*x */ , |
| 195 | int /*y */ , |
| 196 | int /*count */ , |
| 197 | unsigned short * /*chars */ ); |
| 198 | |
| 199 | void (*ImageText8) (DrawablePtr /*pDrawable */ , |
| 200 | GCPtr /*pGC */ , |
| 201 | int /*x */ , |
| 202 | int /*y */ , |
| 203 | int /*count */ , |
| 204 | char * /*chars */ ); |
| 205 | |
| 206 | void (*ImageText16) (DrawablePtr /*pDrawable */ , |
| 207 | GCPtr /*pGC */ , |
| 208 | int /*x */ , |
| 209 | int /*y */ , |
| 210 | int /*count */ , |
| 211 | unsigned short * /*chars */ ); |
| 212 | |
| 213 | void (*ImageGlyphBlt) (DrawablePtr /*pDrawable */ , |
| 214 | GCPtr /*pGC */ , |
| 215 | int /*x */ , |
| 216 | int /*y */ , |
| 217 | unsigned int /*nglyph */ , |
| 218 | CharInfoPtr * /*ppci */ , |
| 219 | pointer /*pglyphBase */ ); |
| 220 | |
| 221 | void (*PolyGlyphBlt) (DrawablePtr /*pDrawable */ , |
| 222 | GCPtr /*pGC */ , |
| 223 | int /*x */ , |
| 224 | int /*y */ , |
| 225 | unsigned int /*nglyph */ , |
| 226 | CharInfoPtr * /*ppci */ , |
| 227 | pointer /*pglyphBase */ ); |
| 228 | |
| 229 | void (*PushPixels) (GCPtr /*pGC */ , |
| 230 | PixmapPtr /*pBitMap */ , |
| 231 | DrawablePtr /*pDst */ , |
| 232 | int /*w */ , |
| 233 | int /*h */ , |
| 234 | int /*x */ , |
| 235 | int /*y */ ); |
| 236 | } GCOps; |
| 237 | |
| 238 | /* there is padding in the bit fields because the Sun compiler doesn't |
| 239 | * force alignment to 32-bit boundaries. losers. |
| 240 | */ |
| 241 | typedef struct _GC { |
| 242 | ScreenPtr pScreen; |
| 243 | unsigned char depth; |
| 244 | unsigned char alu; |
| 245 | unsigned short lineWidth; |
| 246 | unsigned short dashOffset; |
| 247 | unsigned short numInDashList; |
| 248 | unsigned char *dash; |
| 249 | unsigned int lineStyle:2; |
| 250 | unsigned int capStyle:2; |
| 251 | unsigned int joinStyle:2; |
| 252 | unsigned int fillStyle:2; |
| 253 | unsigned int fillRule:1; |
| 254 | unsigned int arcMode:1; |
| 255 | unsigned int subWindowMode:1; |
| 256 | unsigned int graphicsExposures:1; |
| 257 | unsigned int clientClipType:2; /* CT_<kind> */ |
| 258 | unsigned int miTranslate:1; /* should mi things translate? */ |
| 259 | unsigned int tileIsPixel:1; /* tile is solid pixel */ |
| 260 | unsigned int fExpose:1; /* Call exposure handling */ |
| 261 | unsigned int freeCompClip:1; /* Free composite clip */ |
| 262 | unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */ |
| 263 | unsigned int unused:13; /* see comment above */ |
| 264 | unsigned long planemask; |
| 265 | unsigned long fgPixel; |
| 266 | unsigned long bgPixel; |
| 267 | /* |
| 268 | * alas -- both tile and stipple must be here as they |
| 269 | * are independently specifiable |
| 270 | */ |
| 271 | PixUnion tile; |
| 272 | PixmapPtr stipple; |
| 273 | DDXPointRec patOrg; /* origin for (tile, stipple) */ |
| 274 | struct _Font *font; |
| 275 | DDXPointRec clipOrg; |
| 276 | pointer clientClip; |
| 277 | unsigned long stateChanges; /* masked with GC_<kind> */ |
| 278 | unsigned long serialNumber; |
| 279 | GCFuncs *funcs; |
| 280 | GCOps *ops; |
| 281 | PrivateRec *devPrivates; |
| 282 | /* |
| 283 | * The following were moved here from private storage to allow device- |
| 284 | * independent access to them from screen wrappers. |
| 285 | * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org) |
| 286 | */ |
| 287 | PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */ |
| 288 | RegionPtr pCompositeClip; |
| 289 | /* fExpose & freeCompClip defined above */ |
| 290 | } GC; |
| 291 | |
| 292 | #endif /* GCSTRUCT_H */ |