[comp.windows.x] visual classes

aob@beta.gov (Alexander O. Brown) (06/26/91)

How common are systems that only support TrueColor or StaticColor?

Also, DirectColor is supposed to support PseudoColor.  How
would I change the visual from Direct to Pseudo?  Or is there
always a Pseudo visual avaiable if the default is Direct?  Or
do I simply just "simulate" Pseudo with code?

Thanks,
Alex Brown
aob@lanl.gov

rthomson@mesa.dsd.es.com (Rich Thomson) (06/27/91)

In article <26521@beta.gov>
	aob@beta.gov (Alexander O. Brown) writes:
>How common are systems that only support TrueColor or StaticColor?

Our current server supports 8-bit PseudoColor, 24-bit TrueColor and
24-bit DirectColor.

>Also, DirectColor is supposed to support PseudoColor.

I'm not sure what you mean by this statement.  DirectColor is more
powerful than PseudoColor in that one can simulate PC with DC.

>How would I change the visual from Direct to Pseudo?

You can't change a visual.  Visuals are static entities supported by
the server.  Although I am not 100% sure, I don't think you can change
the visual class of a window.  Visuals are used to specify attributes
of a window when it is created.

>Or is there always a Pseudo visual avaiable if the default is Direct?

There is no guarantee of this.

>Or do I simply just "simulate" Pseudo with code?

This is what I would imagine.


More and more high-performance workstations are supporting access to
the hardware capabilities through X with a variety of visual types
("tools not rules").  It is best to make absolutely *NO* assumptions
about visual classes.  Use XMatchVisualInfo and its ilk to find out
what list of visuals are supported on the server.  Printing out a
message like "This program requires a PseudoColor/DirectColor/StaticColor
visual with a colormap of at least 8 entries." and then exiting is
much more graceful than "Segmentation fault (core dumped)".

I have seen much too much of the latter for programs that assume that
the rest of the X world is just like their 8-bit pseudocolor
workstation.  The main reason we implemented a virtual screen with a
8-bit PC root window was to facilitate dumb applications that insist
on using the same visual as the root window, or expect that everyone
has 8-bit PC visuals.

Although TrueColor and DirectColor visuals are inherintly more
powerful than PC visuals (with the possible exception of some colormap
cycling effects), almost nobody understands how to use them.

There is a tutorial in the R4 source tree on how to use visuals, but
it seems that most people are unaware of it.  It seems like there is a
need for a more widely distributed (and updated) tutorial on how to
use visuals and how to select which visual you need.

						    -- Rich
-- 
  ``Read my MIPS -- no new VAXes!!'' -- George Bush after sniffing freon
	    Disclaimer: I speak for myself, except as noted.
UUCP: ...!uunet!dsd.es.com!rthomson		Rich Thomson
Internet: rthomson@dsd.es.com			PEXt Programmer

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (06/27/91)

> How common are systems that only support TrueColor or StaticColor?

I don't know.  Mouse-X on the color NeXTs will be a TrueColor-only
server unless and until someone tells me where to find documentation on
how to change the colormap, if this is in fact possible.  But aside
from that I've never seen one.  (For that matter, I've never actually
*seen* a color NeXT :-)

> Also, DirectColor is supposed to support PseudoColor.

It is?  Where did you find that tidbit?

> How would I change the visual from Direct to Pseudo?  Or is there
> always a Pseudo visual avaiable if the default is Direct?  Or do I
> simply just "simulate" Pseudo with code?

It is certainly possible to simulate PseudoColor with DirectColor; look
up what XAllocColorCells does for a DirectColor visual.  (It amounts to
taking one cell from each of the three colormaps and considering them
as forming one cell in the pseudo-PseudoColor colormap.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

stripes@eng.umd.edu (Joshua Osborne) (06/29/91)

In article <26521@beta.gov> aob@beta.gov (Alexander O. Brown) writes:
>How common are systems that only support TrueColor or StaticColor?

I imagine DirectColor is going to be more common, we have gooten good
at 8bit color, but "Visulation" (sorry 'bout the poor spelling) needs
more colors to work well.  I know you can have a >8bit PsudoColor, but
deep displays are normally DirectColor (or TrueColor).

TrueColor is only really going to be on 24bit deep displays (other displays
offen emulate them); how common do you think they will be?

I don't see any reason why StaticColor (only) systems would become more common.
They are rare now.

>Also, DirectColor is supposed to support PseudoColor.  How
>would I change the visual from Direct to Pseudo?

You don't, and it can't allways "support" it.  (i.e. if your DirectColor
was 6bit/4bit/4bit (I think the RS/6000 has a display like this) then you
only get 16 writable cells, you can't support a PsudoColor with more then
16 cells without a lot of tricks.

>                                                  Or is there
>always a Pseudo visual avaiable if the default is Direct?

This is not true.  And even if it was currently true, it doesn't mean it will
stay that way.

>                                                          Or
>do I simply just "simulate" Pseudo with code?

It isn't simple, but if you need writeable colorcells and you need to run on
all color systems, you will need to "simulate" writeable cells.
-- 
           stripes@eng.umd.edu          "Security for Unix is like
      Josh_Osborne@Real_World,The          Multitasking for MS-DOS"
      "The dyslexic porgramer"                  - Kevin Lockwood
"CNN is the only nuclear capable news network..."
    - lbruck@eng.umd.edu (Lewis Bruck)

andy@research.canon.oz.au (Andy Newman) (06/30/91)

In article <1991Jun28.202530.15560@eng.umd.edu> stripes@eng.umd.edu (Joshua Osborne) writes:
>TrueColor is only really going to be on 24bit deep displays (other displays
>offen emulate them); how common do you think they will be?

And a 24 bit display with colour maps in its RAMDACs (like most displays
that use Brooktree RAMDACS) can do DirectColor.
-- 
Andy Newman (andy@research.canon.oz.au)
" Well you can't have everything. Where would you put it? " - Steven Wright