Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Digital Equipment Corporation
Portions Copyright \(co 1990, 1991 by
Tektronix, Inc.
Permission to use, copy, modify and distribute this documentation for
any purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both that copyright notice
and this permission notice appear in all copies, and that the names of
Digital and Tektronix not be used in in advertising or publicity pertaining
to this documentation without specific, written prior permission.
Digital and Tektronix makes no representations about the suitability
of this documentation for any purpose.
It is provided "as is" without express or implied warranty.
t
GC XCreateGC\^(\^Display *display\^, Drawable d\^, unsigned long valuemask\^, XGCValues *\^values\^);
int XCopyGC\^(\^Display *display\^, GC src\^, unsigned long valuemask\^, GC dest\^);
int XChangeGC\^(\^Display *display\^, GC gc\^, unsigned long valuemask\^, XGCValues *\^values\^);
Status XGetGCValues\^(\^Display *display\^, GC gc\^, unsigned long valuemask\^, XGCValues *values_return\^);
int XFreeGC\^(\^Display *display\^, GC gc\^);
GContext XGContextFromGC\^(\^GC gc\^);
XCreateGC can generate BadAlloc , BadDrawable , BadFont , BadMatch , BadPixmap , and BadValue errors.
The XCopyGC function copies the specified components from the source GC to the destination GC. The source and destination GCs must have the same root and depth, or a BadMatch error results. The valuemask specifies which component to copy, as for XCreateGC .
XCopyGC can generate BadAlloc , BadGC , and BadMatch errors.
The XChangeGC function changes the components specified by valuemask for the specified GC. The values argument contains the values to be set. The values and restrictions are the same as for XCreateGC . Changing the clip-mask overrides any previous XSetClipRectangles request on the context. Changing the dash-offset or dash-list overrides any previous XSetDashes request on the context. The order in which components are verified and altered is server dependent. If an error is generated, a subset of the components may have been altered.
XChangeGC can generate BadAlloc , BadFont , BadGC , BadMatch , BadPixmap , and BadValue errors.
The XGetGCValues function returns the components specified by valuemask for the specified GC. If the valuemask contains a valid set of GC mask bits
n ( GCFunction , GCPlaneMask , GCForeground , GCBackground , GCLineWidth , GCLineStyle , GCCapStyle , GCJoinStyle , GCFillStyle , GCFillRule , GCTile , GCStipple , GCTileStipXOrigin , GCTileStipYOrigin , GCFont , GCSubwindowMode , GCGraphicsExposures , GCClipXOrigin , GCCLipYOrigin , GCDashOffset , or GCArcMode ) and no error occurs, XGetGCValues sets the requested components in values_return and returns a nonzero status. Otherwise, it returns a zero status. Note that the clip-mask and dash-list (represented by the GCClipMask and GCDashList bits, respectively, in the valuemask) cannot be requested. Also note that an invalid resource ID (with one or more of the three most significant bits set to 1) will be returned for GCFont , GCTile , and GCStipple if the component has never been explicitly set by the client.
The XFreeGC function destroys the specified GC as well as all the associated storage.
XFreeGC can generate a BadGC error.
/* GC attribute value mask bits */
| #define | ||||||||||||||||||||
| GCFunction T} T{
(1L<<0)
T}
#define T{
GCPlaneMask T} T{
(1L<<1)
T}
#define T{
GCForeground T} T{
(1L<<2)
T}
#define T{
GCBackground T} T{
(1L<<3)
T}
#define T{
GCLineWidth T} T{
(1L<<4)
T}
#define T{
GCLineStyle T} T{
(1L<<5)
T}
#define T{
GCCapStyle T} T{
(1L<<6)
T}
#define T{
GCJoinStyle T} T{
(1L<<7)
T}
#define T{
GCFillStyle T} T{
(1L<<8)
T}
#define T{
GCFillRule T} T{
(1L<<9)
T}
#define T{
GCTile T} T{
(1L<<10)
T}
#define T{
GCStipple T} T{
(1L<<11)
T}
#define T{
GCTileStipXOrigin T} T{
(1L<<12)
T}
#define T{
GCTileStipYOrigin T} T{
(1L<<13)
T}
#define T{
GCFont T} T{
(1L<<14)
T}
#define T{
GCSubwindowMode T} T{
(1L<<15)
T}
#define T{
GCGraphicsExposures T} T{
(1L<<16)
T}
#define T{
GCClipXOrigin T} T{
(1L<<17)
T}
#define T{
GCClipYOrigin T} T{
(1L<<18)
T}
#define T{
GCClipMask T} T{
(1L<<19)
T}
#define T{
GCDashOffset T} T{
(1L<<20)
T}
#define T{
GCDashList T} T{
(1L<<21)
T}
#define T{
GCArcMode T} T{
(1L<<22)
T}
.TE
N "XGCValues" "" "@DEF@" .EX /* Values */ typedef struct { int function; /* logical operation */ unsigned long plane_mask; /* plane mask */ unsigned long foreground; /* foreground pixel */ unsigned long background; /* background pixel */ int line_width; /* line width (in pixels) */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled FillOpaqueStippled*/ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stippling */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures; /* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int dash_offset; /* patterned/dashed line information */ char dashes; } XGCValues;
The function attributes of a GC are used when you update a section of
a drawable (the destination) with bits from somewhere else (the source).
The function in a GC defines how the new destination bits are to be
computed from the source bits and the old destination bits.
GXcopy is typically the most useful because it will work on a color display,
but special applications may use other functions,
particularly in concert with particular planes of a color display.
The 16 GC functions, defined in
.hN X11/X.h ,
are:
are listed in Table 5-1 along with the
|