XCreateGC(3X11)
Name
XCreateGC, XCopyGC, XChangeGC, XFreeGC, XGContextFromGC − create or free graphics contexts
Syntax
GC XCreateGC(display, d, valuemask, values)
Display *display;
Drawable d;
unsigned long valuemask;
XGCValues *values;
XCopyGC(display, src, valuemask, dest)
Display *display;
GC src, dest;
unsigned long valuemask;
XChangeGC(display, gc, valuemask, values)
Display *display;
GC gc;
unsigned long valuemask;
XGCValues *values;
XFreeGC(display, gc)
Display *display;
GC gc;
GContext XGContextFromGC(gc)
GC gc;
Arguments
dSpecifies the drawable.
destSpecifies the destination GC.
displaySpecifies the connection to the X server.
gcSpecifies the GC.
srcSpecifies the components of the source GC.
valuemaskSpecifies which components in the GC are to be set, copied, or changed . This argument is the bitwise inclusive OR of one or more of the valid GC component mask bits.
valuesSpecifies any values as specified by the valuemask.
Description
The XCreateGC function creates a graphics context and returns a GC. The GC can be used with any destination drawable having the same root and depth as the specified drawable. Use with other drawables results in a BadMatch error.
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 XFreeGC function destroys the specified GC as well as all the associated storage.
XFreeGC can generate a BadGC error.
Diagnostics
BadAlloc The server failed to allocate the requested resource or server memory.
BadDrawable
A value for a Drawable argument does not name a defined Window or Pixmap.
BadFont A value for a Font or GContext argument does not name a defined Font.
BadGC A value for a GContext argument does not name a defined GContext.
BadMatch An InputOnly window is used as a Drawable.
BadMatch Some argument or pair of arguments has the correct type and range but fails to match in some other way required by the request.
BadPixmap
A value for a Pixmap argument does not name a defined Pixmap.
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument’s type is accepted. Any argument defined as a set of alternatives can generate this error.
See Also
XQueryBestSize(3X11), XSetArcMode(3X11), XSetClipOrigin(3X11), XSetFillStyle(3X11), XSetFont(3X11), XSetLineAttributes(3X11), XSetState(3X11), XSetTile(3X11)
Guide to the Xlib Library