# Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # =head1 NAME Tk_GetColormap, Tk_FreeColormap - allocate and free colormaps =for category C Programming =head1 SYNOPSIS B<#include Etk.hE> Colormap BIB<)> BIB<)> =head1 ARGUMENTS =over 4 =item Tcl_Interp *interp (in) Interpreter to use for error reporting. =item Tk_Window tkwin (in) Token for window in which colormap will be used. =item char *string (in) Selects a colormap: either B or the name of a window with the same screen and visual as I. =item Display *display (in) Display for which I was allocated. =item Colormap colormap (in) Colormap to free; must have been returned by a previous call to B or B. =back =head1 DESCRIPTION These procedures are used to manage colormaps. B returns a colormap suitable for use in I. If its I argument is B then a new colormap is created; otherwise I must be the name of another window with the same screen and visual as I, and the colormap from that window is returned. If I doesn't make sense, or if it refers to a window on a different screen from I or with a different visual than I, then B returns B and leaves an error message in Iresult>. B should be called when a colormap returned by B is no longer needed. Tk maintains a reference count for each colormap returned by B, so there should eventually be one call to B for each call to B. When a colormap's reference count becomes zero, Tk releases the X colormap. B and B work together, in that a new colormap created by B may later be returned by B. The reference counting mechanism for colormaps includes both procedures, so callers of B must also call B to release the colormap. If B is called with a I value of B then the resulting colormap will never be returned by B; however, it can be used in other windows by calling B with the original window's name as I. =head1 KEYWORDS colormap