GetGC.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" Copyright (c) 1990 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: GetGC.3,v 1.2 1998/09/14 18:22:49 stanton Exp $
- '"
- .so man.macros
- .TH Tk_GetGC 3 "" Tk "Tk Library Procedures"
- .BS
- .SH NAME
- Tk_GetGC, Tk_FreeGC - maintain database of read-only graphics contexts
- .SH SYNOPSIS
- .nf
- fB#include <tk.h>fR
- .sp
- GC
- fBTk_GetGCfR(fItkwin, valueMask, valuePtrfR)
- .sp
- fBTk_FreeGC(fIdisplay, gcfR)
- .SH ARGUMENTS
- .AS "unsigned long" valueMask
- .AP Tk_Window tkwin in
- Token for window in which the graphics context will be used.
- .AP "unsigned long" valueMask in
- Mask of bits (such as fBGCForegroundfR or fBGCStipplefR)
- indicating which fields of fI*valuePtrfR are valid.
- .AP XGCValues *valuePtr in
- Pointer to structure describing the desired values for the
- graphics context.
- .AP Display *display in
- Display for which fIgcfR was allocated.
- .AP GC gc in
- X identifier for graphics context that is no longer needed.
- Must have been allocated by fBTk_GetGCfR.
- .BE
- .SH DESCRIPTION
- .PP
- fBTk_GetGCfR and fBTk_FreeGCfR manage a collection of graphics contexts
- being used by an application. The procedures allow graphics contexts to be
- shared, thereby avoiding the server overhead that would be incurred
- if a separate GC were created for each use. fBTk_GetGCfR takes arguments
- describing the desired graphics context and returns an X identifier
- for a GC that fits the description. The graphics context that is returned
- will have default values in all of the fields not specified explicitly
- by fIvalueMaskfR and fIvaluePtrfR.
- .PP
- fBTk_GetGCfR maintains a
- database of all the graphics contexts it has created. Whenever possible,
- a call to fBTk_GetGCfR will
- return an existing graphics context rather than creating a new one. This
- approach can substantially reduce server overhead, so fBTk_GetGCfR
- should generally be used in preference to the Xlib procedure
- fBXCreateGCfR, which creates a new graphics context on each call.
- .PP
- Since the return values of fBTk_GetGCfR
- are shared, callers should never modify the graphics contexts
- returned by fBTk_GetGCfR.
- If a graphics context must be modified dynamically, then it should be
- created by calling fBXCreateGCfR instead of fBTk_GetGCfR.
- .PP
- When a graphics context
- is no longer needed, fBTk_FreeGCfR should be called to release it.
- There should be exactly one call to fBTk_FreeGCfR for
- each call to fBTk_GetGCfR.
- When a graphics context is no longer in use anywhere (i.e. it has
- been freed as many times as it has been gotten) fBTk_FreeGCfR
- will release it to the X server and delete it from the database.
- .SH KEYWORDS
- graphics context