Need example C code that uses 24bit DirectColor under Xlib

Need example C code that uses 24bit DirectColor under Xlib

Post by Bruce Kelley Hort » Wed, 09 Mar 1994 09:05:58

  Does anyone have a C example of using 24 bit DirectColor in Xlib?  
I have read the O'Reilly books (Vol 1&2) but can't get any code
to work.  I have no problem with 8 bit color.  I posted this question to, but received no answers.

  The ideal example would be written in C and would not use XMotif or
XIntrinsics.  Specifically, I would like example code that shows me how
to correctly select a 24bit DirectColor Visual, create a color map
(if necessary), select a 24bit color in RGB space, draw a line,
and clean up.

 Please send responses via E-Mail.  I'll summarize and post.

Bruce Horton        |
Litton Data Systems |   I don't always agree with my own opinion.


1. Wanted: Example code using DirectColor 24 bit Visual

I am having trouble with a current project that requires the use of a
24 bit directcolor visual under X windows.  Everytime I do a XCreateWindow,
I get a XBadMatch error, which I cannot figure out the cause of. (gosh,
leave that preposition dangling).

The steps I need to do is:

        1.  Use XMatchVisual to decide if a 24 bit visual is available
            (it is not my default visual)
        2.  Use XCreateWindow to create a window.
        3.  Create an XImage to be used with the window.

If anyone has a simple program or program fragment that you know works, then
please send it to me.  I am also open to any hints on how to proceed, as
I am strictly a novice X programmer.

If it helps, I have tested this on an HP9000 300 series, which supports

Thanks in advance.

2. Still on 16 bit grayscale

3. Anyone using 24bit DirectColor visuals?

4. 3D ARK's "Post & Win" Promotion! Cool PRIZES! More...

5. Need code examples using GLAUX


7. 24bit Color Xlib Question

8. I need asm code to mix two 24bit colors additivly

9. Example of PHIGS compliant PEXlib code using linux?

10. Using XStoreColor in DirectColor Mode

11. Xlib Graphics Examples and Game now available

12. I need Auto code for CS for max R2