home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!pmafire!mica.inel.gov!ux1!news.byu.edu!eff!sol.ctr.columbia.edu!usc!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!sgigate!sgi!fido!zola!tweezers!portuesi
- From: portuesi@tweezers.esd.sgi.com (Michael Portuesi)
- Subject: Re: Port mapcolor() to regular Xlib??
- Message-ID: <semnh18@zola.esd.sgi.com>
- Sender: news@zola.esd.sgi.com (Net News)
- Organization: Silicon Graphics, Inc. Mountain View, CA
- References: <1992Nov15.033646.2844@socrates.umd.edu>
- Date: Mon, 16 Nov 92 18:58:41 GMT
- Lines: 53
-
-
- In article <1992Nov15.033646.2844@socrates.umd.edu>, wu@socrates.umd.edu writes:
- > Hello netters:
- >
- > I am trying to port mapcolor() function in GL to X. Is there
- > any way to specify a index into a color map to load a color into the
- > color cell using Xlib calls?
- >
- > Current colormap in application program: 12 planes
- >
- > 0-255 - regular colormap
- > 256-511 - gray scale
- > 512-767 - red
- > 768-1023 - blue
- > etc
-
- Yes, there is, though it's not as simple as it is in GL.
- (The benefit is that it is much more powerful). GL has
- a very simple colomap model with one colormap for all of
- the GL windows on the display.
-
- Xlib allows you to either allocate entries in the default
- color map provided for your window. Or, you can allocate
- an entirely new colormap just for your window.
-
- You can allocate cells in the current color map either
- as read-only (meaning no other program using the same
- color map can change them), or as read-write (meaning you
- own the colormap entry as with read-only, but you can
- change the contents). Take a look at XAllocColor() and
- XAllocColorCells() calls to do each of these operations,
- respectively. To change an entry(ies) in a color map
- once you've allocated them, see XStoreColor() and
- XStoreColors().
-
- Given the application you've described, you may just
- want to ask the X server for a color map private to your
- application window. To do this, take a look at the
- XCreateColorMap() and XSetWindowColorMap() calls in
- Xlib.
-
- Full information about these calls can be found in
- "The X Window System" by Schiefler and Gettys. This
- is the authoritative reference to the X Window
- System. Like any reference, it's not long on tutorial
- information, but it does tell you everything you need
- to know, and it is authoritative. For explanations,
- you can read the chapter on color management
- (chapter 7 in my copy) contained in the O'Reilly
- "Xlib Programming Manual," Vol. 1, by Adrian Nye.
-
- --
- Michael Portuesi Silicon Graphics, Inc. portuesi@sgi.com
-