[10605] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Palette Management

daemon@ATHENA.MIT.EDU (Joe Pfeiffer)
Wed Dec 2 14:38:51 1998

Date: Wed, 2 Dec 1998 12:35:23 -0700
From: Joe Pfeiffer <pfeiffer@cs.nmsu.edu>
To: gtk-list@redhat.com
In-reply-to: <s665218a.072@US.FORTIS.COM> (message from Sean Kessler on Wed,
	02 Dec 1998 07:28:26 -0600)
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

	 My question is... How does Linux, or rather X Windows under 
   Linux, manage the system palette?  Is it a similar process where
   the system wants to have specific colors mapped into the palette
   at all times?  
	 The question stems from an observation that if I attempt to display
   a 256 color bitmap, I do not get all of the colors in the palette.  

There is no system palette.  If you install a custom colormap for your
application, you get all 256 (if you have eight bit pixels) entries;
if you use the default colormap, you get all that's left over after
everybody else has used the default colormap for whatever they want.
What's probably happened in the case you're describing is that the
application doesn't install its own colormap.

An application of mine starts by looking to see if there are enough
colors in the default colormap to use it; if there are, it does, if
there aren't it creates its own colormap.  There is a race condition
here (somebody else could grab up all the colors in between my
checking and allocating all the colors I need), but that hasn't been a
problem in practice.  When I create my own colormap, I copy the first
40 colors or so from the old map into the new one, so the background
image and the window decorations don't go nuts when I move the cursor
into my window.
-- 
Joseph J. Pfeiffer, Jr., Ph.D.       Phone -- (505) 646-1605
Department of Computer Science       FAX   -- (505) 646-1002
New Mexico State University          http://www.cs.nmsu.edu/~pfeiffer

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post