92 lines
3.6 KiB
Groff
92 lines
3.6 KiB
Groff
'\"
|
|
'\" Copyright (c) 1990 The Regents of the University of California.
|
|
'\" All rights reserved.
|
|
'\"
|
|
'\" Permission is hereby granted, without written agreement and without
|
|
'\" license or royalty fees, to use, copy, modify, and distribute this
|
|
'\" documentation for any purpose, provided that the above copyright
|
|
'\" notice and the following two paragraphs appear in all copies.
|
|
'\"
|
|
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
|
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
|
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
'\"
|
|
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
|
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
|
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
'\"
|
|
'\" $Header: /user6/ouster/wish/man/RCS/GetGC.3,v 1.6 93/04/30 11:41:39 ouster Exp $ SPRITE (Berkeley)
|
|
'\"
|
|
.so man.macros
|
|
.HS Tk_GetGC tkc
|
|
.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_GetGC\fR(\fItkwin, valueMask, valuePtr\fR)
|
|
.sp
|
|
.VS
|
|
.VE
|
|
\fBTk_FreeGC(\fIdisplay, gc\fR)
|
|
.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 \fBGCForeground\fR or \fBGCStipple\fR)
|
|
indicating which fields of \fI*valuePtr\fR are valid.
|
|
.AP XGCValues *valuePtr in
|
|
Pointer to structure describing the desired values for the
|
|
graphics context.
|
|
.AP Display *display in
|
|
Display for which \fIgc\fR was allocated.
|
|
.VS
|
|
.VE
|
|
.AP GC gc in
|
|
X identifier for graphics context that is no longer needed.
|
|
Must have been allocated by \fBTk_GetGC\fR.
|
|
.BE
|
|
|
|
.SH DESCRIPTION
|
|
.PP
|
|
\fBTk_GetGC\fR and \fBTk_FreeGC\fR 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_GetGC\fR 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 \fIvalueMask\fR and \fIvaluePtr\fR.
|
|
.PP
|
|
\fBTk_GetGC\fR maintains a
|
|
database of all the graphics contexts it has created. Whenever possible,
|
|
a call to \fBTk_GetGC\fR will
|
|
return an existing graphics context rather than creating a new one. This
|
|
approach can substantially reduce server overhead, so \fBTk_GetGC\fR
|
|
should generally be used in preference to the Xlib procedure
|
|
\fBXCreateGC\fR, which creates a new graphics context on each call.
|
|
.PP
|
|
Since the return values of \fBTk_GetGC\fR
|
|
are shared, callers should never modify the graphics contexts
|
|
returned by \fBTk_GetGC\fR.
|
|
If a graphics context must be modified dynamically, then it should be
|
|
created by calling \fBXCreateGC\fR instead of \fBTk_GetGC\fR.
|
|
.PP
|
|
When a graphics context
|
|
is no longer needed, \fBTk_FreeGC\fR should be called to release it.
|
|
There should be exactly one call to \fBTk_FreeGC\fR for
|
|
each call to \fBTk_GetGC\fR.
|
|
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_FreeGC\fR
|
|
will release it to the X server and delete it from the database.
|
|
|
|
.SH KEYWORDS
|
|
graphics context
|