[gtk-list] Re: Palette Management -Reply



  
  Thanks for the response.  My problem was solved when I
  set GdkColor::pixel to zero before calling gdk_color_alloc.
  I thought that by setting the pixel member to some value
  I could control the index at which the color was assigned.
  I was neglecting the fact that the returned GdkColor::pixel
  is modified to contain the actual color mapped and the 
  palette index where it resides.  You can imagine what my
  bitmaps looked like.

  Thanks,
  Sean
    
  

>>> Joe Pfeiffer <pfeiffer@cs.nmsu.edu> 12/02/98 02:38pm >>>
	 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


****************************************************************
			Please Note
The information in this E-mail message is legally privileged
and confidential information intended only for the use of the
individual(s) named above. If you, the reader of this message,
are not the intended recipient, you are hereby notified that 
you should not further disseminate, distribute, or forward this
E-mail message. If you have received this E-mail in error,
please notify the sender. Thank you
*****************************************************************



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]