Tcl8.6/Tk8.6 Documentation > Tk C API, version 8.6.8 > GetClrmap
Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API
- Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap — allocate and free colormaps
- #include <tk.h>
- Tk_GetColormap(interp, tkwin, string)
- Tk_PreserveColormap(display, colormap)
- Tk_FreeColormap(display, colormap)
Tk_GetColormap(interp, tkwin, string)
- Tcl_Interp *interp (in)
- Interpreter to use for error reporting.
- Tk_Window tkwin (in)
- Token for window in which colormap will be used.
- const char *string (in)
- Selects a colormap: either new or the name of a window with the same screen and visual as tkwin.
- Display *display (in)
- Display for which colormap was allocated.
- Colormap colormap (in)
- Colormap to free or preserve; must have been returned by a previous call to Tk_GetColormap or Tk_GetVisual.
Tk_PreserveColormap increases the internal reference count for a colormap previously returned by Tk_GetColormap, which allows the colormap to be stored in several locations without knowing which order they will be released.
Tk_FreeColormap should be called when a colormap returned by Tk_GetColormap is no longer needed. Tk maintains a reference count for each colormap returned by Tk_GetColormap, so there should eventually be one call to Tk_FreeColormap for each call to Tk_GetColormap and each call to Tk_PreserveColormap. When a colormap's reference count becomes zero, Tk releases the X colormap.
Tk_GetVisual and Tk_GetColormap work together, in that a new colormap created by Tk_GetVisual may later be returned by Tk_GetColormap. The reference counting mechanism for colormaps includes both procedures, so callers of Tk_GetVisual must also call Tk_FreeColormap to release the colormap. If Tk_GetColormap is called with a string value of new then the resulting colormap will never be returned by Tk_GetVisual; however, it can be used in other windows by calling Tk_GetColormap with the original window's name as string.colormap, visual
Copyright © 1994-1996 Sun Microsystems, Inc.