Path: utzoo!attcan!uunet!samsung!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!dreams!rbogen From: rbogen@dreams.EBay.Sun.COM (Richard A. Bogen) Newsgroups: comp.windows.news Subject: Colormap Manipulation Message-ID: <2833@dreams.EBay.Sun.COM> Date: 3 Aug 90 17:32:04 GMT Organization: Sun Microsystems, Inc. Mt. View, Ca. Lines: 29 % 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