xtgetgc(3) [hpux man page]
XtGetGC() XtGetGC() Name XtGetGC - obtain a read-only, sharable GC. Synopsis GC XtGetGC(object, value_mask, values) Widget object; XtGCMask value_mask; XGCValues *values; Inputs object Specifies the object with which the GC is to be associated; may be of class Object or any subclass thereof. value_mask Specifies which fields of the GC are to be filled in with widget data. values Specifies the actual values for this GC. Returns A read-only GC with fields as specified in value_mask and values. Description XtGetGC() returns a sharable, read-only GC with values as specified in values for each bit set in value_mask. The GC is valid for the screen and depth of object, or the nearest widget ancestor if object is not a subclass of Core. XtGetGC() shares only GCs in which all values in the GC are the same. In particular, it does not use the value_mask provided to determine which fields of the GC a widget considers relevant. value_mask is used only to tell the server which fields should be filled in with wid- get data and which it should fill in with default values. Usage The Intrinsics provide a mechanism whereby widgets can share a graphics context (GC), reducing the number of GCs created and thereby improving server performance. The mechanism is a simple caching scheme, and all GCs obtained by means of this mechanism must be treated as read-only. If a GC with modifiable fields is needed, in Release 4 or previous releases the Xlib XCreateGC() function must be used. In Release 5, XtAllocateGC() allows a widget to allocate a shared GC with modifiable fields. Generally only widgets will need to allocate GCs, though some applications may also want to do so. When done with a shared GC, free it with XtReleaseGC(). Structures The XtGCMask type is defined as follows: typedef unsigned long XtGCMask; /* Mask of values that are used by widget*/ Each of the symbols in the table below sets a single bit in an XtGCMask. The value_mask, argument is formed by combining these symbols with the bitwise OR operator ( ): GCArcMode GCFillRule GCLineWidth GCBackground GCFillStyle GCPlaneMask GCCapStyle GCFont GCStipple GCClipMask GCForeground GCSubwindowMode GCClipXOrigin GCFunction GCTile GCClipYOrigin GCGraphicsExposures GCTileStipXOrigin GCDashList GCJoinStyle GCTileStipYOrigin GCDashOffset GCLineStyle The XGCValues structure contains the GC fields: 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; /* 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 int ts_y_origin; * stipple operations */ Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* 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; See Also XtAllocateGC(1), XtReleaseGC(1). Xt - Graphics Context XtGetGC()
Check Out this Related Man Page
XChangeGC() XChangeGC() Name XChangeGC - change the components of a given graphics context. Synopsis XChangeGC(display, gc, valuemask, values) Display *display; GC gc; unsigned long valuemask; XGCValues *values; Arguments display Specifies a connection to an X server; returned from XOpenDisplay(). gc Specifies the graphics context. valuemask Specifies the components in the graphics context that you want to change. This argument is the bitwise OR of one or more of the GC component masks. values Specifies a pointer to the XGCValues structure. Description XChangeGC() changes any or all of the components of a GC. The valuemask specifies which components are to be changed; it is made by com- bining any number of the mask symbols listed in the Structures section using bitwise OR ( ). The values structure contains the values to be set. These two arguments operate just like they do in XCreateGC(). Changing the clip_mask overrides any previous XSetClipRectangles() request for this GC. Changing the dash_offset or dashes overrides any previous XSetDashes() request on this GC. Since consecutive changes to the same GC are buffered, there is no performance advantage to using this routine over the routines that set individual members of the GC. Even if an error occurs, a subset of the components may have already been altered. The order in which components are altered and verified is server-dependent. For more information, see Volume One, Chapter 5, The Graphics Context, and Chapter 6, Drawing Graphics and Text. Structures 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; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ 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; /* generate events on XCopy, Area, XCopyPlane*/ 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 BadFont BadGC BadMatch BadPixmap BadValue See Also XDefaultGC(), XCopyGC(), XCreateGC(), XFreeGC(), XGContextFromGC(), XGetGCValues(), XSetArcMode(), XSetBackground(), XSetClipMask(), XSet- ClipOrigin(), XSetClipRectangles(), XSetDashes(), XSetFillRule(), XSetFillStyle(), XSetForeground(), XSetFunction(), XSetGraphicsExpo- sures(), XSetLineAttributes(), XSetPlaneMask(), XSetRegion(), XSetState(), XSetStipple(), XSetSubwindowMode(), XSetTSOrigin(). Xlib - Graphics Context XChangeGC()