u-mlinds%sunset.utah.edu@wasatch.utah.edu (Mark Lindsey) (05/24/89)
As a programmer new to X and X Toolkit, I have a question. I am using X11R3. What is the accepted way to render graphics into a widget? Should I create my own widget to handle the graphics or can I grab the window of a generic Core widget, and render into the window? I have an application that uses 20x18 bitmaps, from 400 to 4000 of them. So, I assume I need to use XCopyPlane or XCopyArea. Any hints will be greatly appreciated. I want the result to be managed by a Viewport widget. Another question. How do I determine if a machine is monochrome or color? I thought I could determine it by examining the depth of an open screen. But it always returns 8, even on a monochrome machine. What am I missing? Any help will be greatly appreciated!! Mark ====================================================== Mark L. Lindsey u-mlinds@ug.utah.edu 374 E 1550 S University of Utah Orem, UT 84058 801-225-0948 Salt Lake City, UT ======================================================
stroyan@hpfcdc.HP.COM (Mike Stroyan) (05/25/89)
> Another question. How do I determine if a machine is monochrome or color? > I thought I could determine it by examining the depth of an open screen. But > it always returns 8, even on a monochrome machine. What am I missing? > > Mark L. Lindsey You are probably missing release 6.5 of the HP X11 server. :-) Release 6.2 of X11 on HP 300s reported depth 8 on monochrome displays, reflecting the byte-per-pixel layout of the framebuffer. The depth is reported as the number of significant bits per pixel in release 6.5 of X11. A common way to get around it is to check DisplayCells() for more than two cells. The best way to check for a monochrome "machine" is to examine the visual class of the window you are rendering to. A server may support several visuals for a single screen. You can find out what visuals are available by using XGetVisualInfo. You can find the visual of a window by calling XGetWindowAttributes. The possible visual classes are StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, and DirectColor. The StaticGray and GrayScale classes are monochrome. The Xlib documentation includes a description of the properties of each visual class. Mike Stroyan, stroyan@hpfcla.hp.com
andrew@comp.vuw.ac.nz (Andrew Vignaux) (06/05/89)
In article <6910009@hpfcdc.HP.COM> stroyan@hpfcdc.HP.COM (Mike Stroyan) writes: >In article <1901@wasatch.utah.edu> (Mark L. Lindsey) wrote: >> Another question. How do I determine if a machine is monochrome or color? >> I thought I could determine it by examining the depth of an open screen. But >> it always returns 8, even on a monochrome machine. What am I missing? > >You are probably missing release 6.5 of the HP X11 server. :-) Will the MIT server be updated to report the significant bits per pixel? >A common way to get around it is to check DisplayCells() for more >than two cells. Even this is not guaranteed to get a nice result. A HP 98788A/98548A reports a 4 cell colormap on our modified MIT server. This means that "vital" programs like xconq and xcalc start using lots of colors which all get mapped to the same shade. I guess they should check for the visual class as well. Andrew -- Domain address: andrew@comp.vuw.ac.nz Path address: ...!uunet!vuwcomp!andrew