home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!gatech!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!csn!qwerty-gw.fsl.noaa.gov!eagle.fsl.noaa.gov!gregc
- From: gregc@eagle.fsl.noaa.gov (Greg Compestine)
- Subject: Re: How do I compute 24 bit TrueColor pixel value from RGB color?
- Message-ID: <gregc.728148734@eagle.fsl.noaa.gov>
- Sender: news@fsl.noaa.gov (USENET News System)
- Organization: Forecast Systems Lab, NOAA - Boulder CO, USA
- References: <1993Jan26.203113.8117@doug.cae.wisc.edu>
- Date: Wed, 27 Jan 1993 15:32:14 GMT
- Lines: 31
-
- In comp.windows.x you write:
- ...
- > A few years ago I had brief access to a 24 bit DECstation 5000/200
- >PXG turbo that I remember used:
-
- > pixel_value = (red << 16) | (green << 8) | blue;
-
- >Today, I was able finally to use another 24 bit machine again (an Iris!) for
- >a few minutes and it used:
- >
- > pixel_value = (blue << 16) | (green << 8) | red;
-
- >So I believe the pixel value computation for a TrueColor visual is server
- >dependent. I have written several X graphics programs (x3d, xdart) and
- >am now finishing up work on a new renderer with my friend Abe. I want to
- >improve the portability of my code and have it work on all 24 bit servers,
- >so I will appreciate any suggestions on determining how to perform the
- >correct pixel value computation.
-
- ...
-
- Take a look at Section 7.5.1 in O'Reilly, Vol. 1. It discusses members
- of the XVisualInfo structure, red_mask, green_mask and blue_mask, that
- determine which bits in a pixel value are used by which color component.
- The trick then is deciphering this information into the starting bit
- and bit range to get all the shifts and masks you want.
-
-
- %\%\%\%\%\%\%\%
- gerG | Gee, I hope I'm not saying "OOPs!" |
- | at the end of this project. |
-