rbogen@dreams.EBay.Sun.COM (Richard A. Bogen) (08/04/90)
% This example shows how to change a color in the hardware colormap % at a particular pixel index without modifying the other colors % % Richard A. Bogen - Sun Microsystems, Inc. - August 1990 % /zapcolor {% slot color => - 4 dict begin /COLOR exch def /SLOT exch def % Assume pseduocolor is the default for the framebuffer % If not then change this to locate a pseudocolor visual somewhere /cmap framebuffer /Visual get createcolormap def % Load virtual map with existing colors in hardware map % by creating a single segment and copying in current colors /seg cmap 256 0 createcolorsegment def seg {dup /Slot get dup setpixel currentcolor putcolor} forall % Replace desired slot with desired color seg SLOT get SLOT COLOR putcolor % Now install into the hardware % Note: olwm will deinstall when cursor is moved out of current window cmap /Installed true put end} def