2
'\" Copyright (c) 1994 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8
'\" RCS: @(#) $Id: GetClrmap.3,v 1.2 1998/09/14 18:22:48 stanton Exp $
11
.TH Tk_GetColormap 3 4.0 Tk "Tk Library Procedures"
14
Tk_GetColormap, Tk_FreeColormap \- allocate and free colormaps
20
\fBTk_GetColormap(\fIinterp, tkwin, string\fB)\fR
22
\fBTk_FreeColormap(\fIdisplay, colormap\fB)\fR
24
.AS "Colormap" colormap
25
.AP Tcl_Interp *interp in
26
Interpreter to use for error reporting.
27
.AP Tk_Window tkwin in
28
Token for window in which colormap will be used.
30
Selects a colormap: either \fBnew\fR or the name of a window
31
with the same screen and visual as \fItkwin\fR.
32
.AP Display *display in
33
Display for which \fIcolormap\fR was allocated.
34
.AP Colormap colormap in
35
Colormap to free; must have been returned by a previous
36
call to \fBTk_GetColormap\fR or \fBTk_GetVisual\fR.
41
These procedures are used to manage colormaps.
42
\fBTk_GetColormap\fR returns a colormap suitable for use in \fItkwin\fR.
43
If its \fIstring\fR argument is \fBnew\fR then a new colormap is
44
created; otherwise \fIstring\fR must be the name of another window
45
with the same screen and visual as \fItkwin\fR, and the colormap from that
47
If \fIstring\fR doesn't make sense, or if it refers to a window on
48
a different screen from \fItkwin\fR or with
49
a different visual than \fItkwin\fR, then \fBTk_GetColormap\fR returns
50
\fBNone\fR and leaves an error message in \fIinterp->result\fR.
52
\fBTk_FreeColormap\fR should be called when a colormap returned by
53
\fBTk_GetColormap\fR is no longer needed.
54
Tk maintains a reference count for each colormap returned by
55
\fBTk_GetColormap\fR, so there should eventually be one call to
56
\fBTk_FreeColormap\fR for each call to \fBTk_GetColormap\fR.
57
When a colormap's reference count becomes zero, Tk releases the
60
\fBTk_GetVisual\fR and \fBTk_GetColormap\fR work together, in that
61
a new colormap created by \fBTk_GetVisual\fR may later be returned
62
by \fBTk_GetColormap\fR.
63
The reference counting mechanism for colormaps includes both procedures,
64
so callers of \fBTk_GetVisual\fR must also call \fBTk_FreeColormap\fR
65
to release the colormap.
66
If \fBTk_GetColormap\fR is called with a \fIstring\fR value of
67
\fBnew\fR then the resulting colormap will never
68
be returned by \fBTk_GetVisual\fR; however, it can be used in other
69
windows by calling \fBTk_GetColormap\fR with the original window's