[comp.windows.x] 256 color colormaps in X

alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) (02/02/90)

Is it possible in X to display an image with 256 distinct colors on 
a color Sun console as it is under SunView?  The XView documentation
suggests that it is, but the O'Reilly book (and people in the past)
suggest that it is not.  Any actual experience out there?

-- Alan				# "But seriously, what could go wrong?"
   ..!cit-vax!elroy!alan
   alan@elroy.jpl.nasa.gov

doleh@math-cs.kent.EDU (Yaser Doleh) (02/02/90)

	        If your display support 256 colors then X can do it.
We displayed images on an HP9000/300 workstation using X with full
256 colors. We used xgif program.

devin@boulder.Colorado.EDU (Devin Hooker) (02/02/90)

In article <1990Feb2.001652.935@elroy.jpl.nasa.gov> alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) writes:
!Is it possible in X to display an image with 256 distinct colors on 
!a color Sun console as it is under SunView?  The XView documentation
!suggests that it is, but the O'Reilly book (and people in the past)
!suggest that it is not.  Any actual experience out there?
!
!-- Alan				# "But seriously, what could go wrong?"
!   ..!cit-vax!elroy!alan
!   alan@elroy.jpl.nasa.gov

	I think so.  My Sun (3/260 running R4) supports it with no problem.
The stupid VAXstation won't.  (I need pixel 255 and I can't have it.  Waah.)
The DECstation on the other hand will.  Check the visual info returned from 
the server.  That should tell you.
			-Devin

hvr@kimba.Sun.COM (Heather Rose) (02/09/90)

In article <1990Feb2.001652.935@elroy.jpl.nasa.gov> alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) writes:
>Is it possible in X to display an image with 256 distinct colors on 
>a color Sun console as it is under SunView?  The XView documentation
>suggests that it is, but the O'Reilly book (and people in the past)
>suggest that it is not.  Any actual experience out there?

XView provides whatever your X11 server provides.  In XView, you may choose
to create a colormap with Xlib calls, or you may choose to create one with
the XView colormap interface.  

What the XView colormap interface provides:

simplified interface for X11 GC's.  In 1.0 and 1.0.1 the interface looks
very much like the one supplied in SunView.  With the next major release of
the toolkit (due out sometime summer 90), we'll make colormaps into XView 
opaque objects.  Thus, the functions xv_get(), xv_set(), etc. will work
for colormaps just as they do for other objects.

colormap sharing within an application.  Basically, you give a colormap a 
name and all windows use the same named colormap.  

static or dynamic colormaps.  When creating a static colormap in XView, it
will allocate (if it needs to allocate) the server's colormap colorcells as 
sharable.  It's easiest to think of this as the closest matching color to 
the one you've asked for.  When you paint a pixel in that colormap value, 
you expect that that pixel will continue to be that color while your 
application has its colormap installed.  If you decide to change the value
of a static colormap entry, this means to find another sharable cell in the
server's colormap with the closest matching color.  So let's say, we change
the static red to a static blue.  This means that the red pixel value you 
have painted in your application is no longer valid, and you will get a 
repaint event so you may re-paint the red pixels with the new color value for
blue.

The XView dynamic colormap will allocate unsharable cells in your server
colormap.  So, when you paint a pixel in a particular color, you have no
guarentee that that pixel will remain to be the same color.  When you change
a colormap entry from red to blue, you will not recieve a repaint event, and
all previously red pixels will become blue.  The dynamic colormap is useful
for colormap annimation.

virtual colormap entries.  When you create a colormap of size N in XView,
you specify painting in the relative address from 0 to N-1.

Regards,

Heather