home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / 21645 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.9 KB  |  43 lines

  1. Newsgroups: comp.windows.x
  2. 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
  3. From: gregc@eagle.fsl.noaa.gov (Greg Compestine)
  4. Subject: Re: How do I compute 24 bit TrueColor pixel value from RGB color?
  5. Message-ID: <gregc.728148734@eagle.fsl.noaa.gov>
  6. Sender: news@fsl.noaa.gov (USENET News System)
  7. Organization: Forecast Systems Lab, NOAA - Boulder CO, USA
  8. References: <1993Jan26.203113.8117@doug.cae.wisc.edu>
  9. Date: Wed, 27 Jan 1993 15:32:14 GMT
  10. Lines: 31
  11.  
  12. In comp.windows.x you write:
  13.     ...
  14. >    A few years ago I had brief access to a 24 bit DECstation 5000/200
  15. >PXG turbo that I remember used:
  16.  
  17. >   pixel_value = (red << 16) | (green << 8) | blue;
  18.  
  19. >Today, I was able finally to use another 24 bit machine again (an Iris!) for
  20. >a few minutes and it used:
  21. >   pixel_value = (blue << 16) | (green << 8) | red;
  22.  
  23. >So I believe the pixel value computation for a TrueColor visual is server
  24. >dependent.  I have written several X graphics programs (x3d, xdart) and
  25. >am  now finishing up work on a new renderer with my friend Abe.   I want to
  26. >improve the portability of my code and have it work on all 24 bit servers,
  27. >so I will appreciate any suggestions on determining how to perform the
  28. >correct pixel value computation.
  29.  
  30.     ...
  31.  
  32.     Take a look at Section 7.5.1 in O'Reilly, Vol. 1.  It discusses members
  33. of the XVisualInfo structure, red_mask, green_mask and blue_mask, that 
  34. determine which bits in a pixel value are used by which color component.
  35. The trick then is deciphering this information into the starting bit
  36. and bit range to get all the shifts and masks you want.  
  37.  
  38.  
  39.                          %\%\%\%\%\%\%\%
  40. gerG                        | Gee, I hope I'm not saying "OOPs!" |
  41.                             |     at the end of this project.    |
  42.