1Tk_GetColormap(3)            Tk Library Procedures           Tk_GetColormap(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_GetColormap, Tk_FreeColormap - allocate and free colormaps
9

SYNOPSIS

11       #include <tk.h>
12
13       Colormap
14       Tk_GetColormap(interp, tkwin, string)
15
16       Tk_FreeColormap(display, colormap)
17

ARGUMENTS

19       Tcl_Interp *interp    (in)      Interpreter to use for error reporting.
20
21       Tk_Window  tkwin      (in)      Token for window in which colormap will
22                                       be used.
23
24       CONST char *string    (in)      Selects a colormap:  either new or  the
25                                       name  of  a window with the same screen
26                                       and visual as tkwin.
27
28       Display    *display   (in)      Display for which  colormap  was  allo‐
29                                       cated.
30
31       Colormap   colormap   (in)      Colormap   to  free;   must  have  been
32                                       returned by a previous call to  Tk_Get‐
33                                       Colormap or Tk_GetVisual.
34_________________________________________________________________
35
36

DESCRIPTION

38       These  procedures are used to manage colormaps.  Tk_GetColormap returns
39       a colormap suitable for use in tkwin.  If its string  argument  is  new
40       then  a  new colormap is created;  otherwise string must be the name of
41       another window with the same screen and visual as tkwin, and  the  col‐
42       ormap  from  that window is returned.  If string doesn't make sense, or
43       if it refers to a window on a different screen from  tkwin  or  with  a
44       different  visual  than  tkwin,  then  Tk_GetColormap  returns None and
45       leaves an error message in interp->result.
46
47       Tk_FreeColormap should be called when a colormap returned by Tk_GetCol‐
48       ormap  is  no  longer  needed.  Tk maintains a reference count for each
49       colormap returned by Tk_GetColormap, so there should eventually be  one
50       call  to  Tk_FreeColormap for each call to Tk_GetColormap.  When a col‐
51       ormap's reference count becomes zero, Tk releases the X colormap.
52
53       Tk_GetVisual and Tk_GetColormap work together, in that a  new  colormap
54       created  by  Tk_GetVisual may later be returned by Tk_GetColormap.  The
55       reference counting mechanism for colormaps includes both procedures, so
56       callers  of  Tk_GetVisual must also call Tk_FreeColormap to release the
57       colormap.  If Tk_GetColormap is called with a string value of new  then
58       the  resulting  colormap  will never be returned by Tk_GetVisual;  how‐
59       ever, it can be used in other windows by  calling  Tk_GetColormap  with
60       the original window's name as string.
61
62

KEYWORDS

64       colormap
65
66
67
68Tk                                    4.0                    Tk_GetColormap(3)
Impressum