Debian Codegraph @

pod/pTk/GetClrmap.pod

raw
1 # Copyright (c) 1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk_GetColormap, Tk_FreeColormap - allocate and free colormaps
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 Colormap
19 B<Tk_GetColormap(>I<interp, tkwin, string>B<)>
20
21 B<Tk_FreeColormap(>I<display, colormap>B<)>
22
23 =head1 ARGUMENTS
24
25 =over 4
26
27 =item Tcl_Interp *interp (in)
28
29 Interpreter to use for error reporting.
30
31 =item Tk_Window tkwin (in)
32
33 Token for window in which colormap will be used.
34
35 =item char *string (in)
36
37 Selects a colormap: either B<new> or the name of a window
38 with the same screen and visual as I<tkwin>.
39
40 =item Display *display (in)
41
42 Display for which I<colormap> was allocated.
43
44 =item Colormap colormap (in)
45
46 Colormap to free; must have been returned by a previous
47 call to B<Tk_GetColormap> or B<Tk_GetVisual>.
48
49 =back
50
51 =head1 DESCRIPTION
52
53 These procedures are used to manage colormaps.
54 B<Tk_GetColormap> returns a colormap suitable for use in I<tkwin>.
55 If its I<string> argument is B<new> then a new colormap is
56 created; otherwise I<string> must be the name of another window
57 with the same screen and visual as I<tkwin>, and the colormap from that
58 window is returned.
59 If I<string> doesn't make sense, or if it refers to a window on
60 a different screen from I<tkwin> or with
61 a different visual than I<tkwin>, then B<Tk_GetColormap> returns
62 B<None> and leaves an error message in I<interp-E<gt>result>.
63
64 B<Tk_FreeColormap> should be called when a colormap returned by
65 B<Tk_GetColormap> is no longer needed.
66 Tk maintains a reference count for each colormap returned by
67 B<Tk_GetColormap>, so there should eventually be one call to
68 B<Tk_FreeColormap> for each call to B<Tk_GetColormap>.
69 When a colormap's reference count becomes zero, Tk releases the
70 X colormap.
71
72 B<Tk_GetVisual> and B<Tk_GetColormap> work together, in that
73 a new colormap created by B<Tk_GetVisual> may later be returned
74 by B<Tk_GetColormap>.
75 The reference counting mechanism for colormaps includes both procedures,
76 so callers of B<Tk_GetVisual> must also call B<Tk_FreeColormap>
77 to release the colormap.
78 If B<Tk_GetColormap> is called with a I<string> value of
79 B<new> then the resulting colormap will never
80 be returned by B<Tk_GetVisual>; however, it can be used in other
81 windows by calling B<Tk_GetColormap> with the original window's
82 name as I<string>.
83
84 =head1 KEYWORDS
85
86 colormap