XCopyGC()XCopyGC()NameXCopyGC – copy a graphics context.
Synopsis
XCopyGC(display, src, valuemask, dest)
Display *display;
GC src;
unsigned long valuemask;
GC dest;
Arguments
display Specifies a connection to an X server; returned from
XOpenDisplay().
src Specifies the components of the source graphics context.
valuemask Specifies the components in the source GC structure to be
copied into the destination GC. valuemask is made by combin‐
ing any number of the mask symbols listed in the Structures
section using bitwise OR ( ).
dest Specifies the destination graphics context.
DescriptionXCopyGC() copies the selected elements of one graphics context to
another. The source and destination GC's must have the same root and
depth. XCopyGC() requires that both GC's exist before the call is
made. See Volume One, Chapter 5, The Graphics Context, for a descrip‐
tion of the graphics context.
Structures
The GC structure contains the following elements:
/*
* Data structure for setting graphics context.
*/
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 */
int line_style; /* Solid, OnOffDash, DoubleDash */
int cap_style; /* NotLast, Butt, Round, Projecting */
int join_style; /* Miter, Round, Bevel */
int fill_style; /* Solid, Tiled, Stippled */
int fill_rule; /* EvenOdd, Winding */
int arc_mode; /* PieSlice */
Pixmap tile; /* tile pixmap for tiling operations */
Pixmap stipple; /* stipple 1 plane pixmap for stipping */
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;
#define GCFunction (1L<<0)
#define GCPlaneMask (1L<<1)
#define GCForeground (1L<<2)
#define GCBackground (1L<<3)
#define GCLineWidth (1L<<4)
#define GCLineStyle (1L<<5)
#define GCCapStyle (1L<<6)
#define GCJoinStyle (1L<<7)
#define GCFillStyle (1L<<8)
#define GCFillRule (1L<<9)
#define GCTile (1L<<10)
#define GCStipple (1L<<11)
#define GCTileStipXOrigin (1L<<12)
#define GCTileStipYOrigin (1L<<13)
#define GCFont (1L<<14)
#define GCSubwindowMode (1L<<15)
#define GCGraphicsExposures (1L<<16)
#define GCClipXOrigin (1L<<17)
#define GCClipYOrigin (1L<<18)
#define GCClipMask (1L<<19)
#define GCDashOffset (1L<<20)
#define GCDashList (1L<<21)
#define GCArcMode (1L<<22)
Errors
BadAlloc
BadGC
BadMatch src and dest do not have the same root and depth.
See AlsoXDefaultGC(), XChangeGC(), XCreateGC(), XFreeGC(), XGContextFromGC(),
XGetGCValues(), XSetArcMode(), XSetBackground(), XSetClipMask(), XSet‐
ClipOrigin(), XSetClipRectangles(), XSetDashes(), XSetFillRule(), XSet‐
FillStyle(), XSetForeground(), XSetFunction(), XSetGraphicsExposures(),
XSetLineAttributes(), XSetPlaneMask(), XSetState(), XSetStipple(),
XSetSubwindowMode(), XSetTSOrigin().
Xlib - Graphics Context XCopyGC()