[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DirectColor on linux



		Hi,

	I'm just having the same problem as you : using an IDL program with a
solid use of graphics under Linux. I've been using IDL a lot under
HP/UX, and now I would like to use the programs I've written under
Linux. Note that I am not a Linux nor an X-Windows specialist.
Nevertheless, here are the fact I've been collecting :

	You say that you are using direct color with xfree86 : that makes me
wondering, since XFRee86 only supports TrueColor mode in 16 and 32 bpp
(see the excerpt from the XF86Config man page at the end of this email).
DirectColor is *not* supported in these modes. Which practically means
that you cannot modify the color table, since TrueColor mode has
read-only color tables (ie loadct, tvlct and any procedure trying to
change are useless).(see IDL Documentation "The X Windows Device")

	It would be interesting to know which visual modes are supported by
your computer : use "xdpyinfo" in a shell, the visual modes will be
listed. If it is the same as on my Linux computer under 32 (and 24)
bpp, it will give :

	  number of visuals:    1
	  default visual id:  0x22
	  visual:
	    visual id:    0x22
	    class:    TrueColor
	    depth:    24 planes
	    available colormap entries:    256 per subfield
	    red, green, blue masks:    0xff0000, 0xff00, 0xff
	    significant bits in color specification:    8 bits

	As far as you don't have DirectColor or PseudoColor modes available,
you cannot modify the color table. The only way to have control over the
color table using XFree is then to switch back to using 8 bpp mode, for
which the PseudoColor visual mode is implemented.
	My programs work exactly the same under HP/UX and Linux using this 8
bpp mode. Of course, if you want to use a full private color table,
color tables will switch when the mouse goes over IDL graphics windows,
which is annoying...

	
	CONCLUSION : IMHO, it looks like DirectColor is *not possible* under
Linux with Xfree86 in 24,and 32 bpp (IDL does not work in 16bpp). Color
Table manipulation is thus only possible in 8bpp visual mode (a real
shame considering today's video cards...). There seems to be 3 ways out
of this problem :
	1) easiest, cheapest : use 8bpp mode
	2) harder : change the IDL program for a specific support of TrueColor
mode (ie you have to change the way you write colors when you *create*
the graphics, I haven't much experimented in that...)
	3) expensive : buy a commercial X-Windows driver that supports
DirectColor in 24 or 32 bpp.

	The problem comes from the absence of DirectColor visual mode support
in XFree86. Maybe this will be added in XFree v4 ? 
	

	Hope that helps... If you have any more information, please inform me !
I have the same problem and am annoyed at the idea of changing my
programs using "device,get_visual_name=t" and "if t eq 'TrueColor'
then...". Particularly, if you find a commercial, not over-expensive
X-Windows driver, that would be interesting...


			Vincent FAVRE-NICOLIN


Tom Holub wrote:
> One of the professors I support has a procedure he's using on Solaris
> with IDL that he wants to move over to a linux machine.  However,
> there appears to be some fundamental differences in the way Solaris
> handles colors, and the procedure isn't working.
> 
> Basically, what the procedure does is use direct color to change the
> color table, thereby changing the colors of the images in window 0.
> This is useful in astronomy because it allows you to highlight different
> parts of the spectrum.  So if you diddle the red from 255 down to 0,
> all the red will be drained out of the image.  I've seen this work
> on a Solaris machine.  I am trying to do it on a Linux machine with
> a Diamond Viper 770 (32MB) video card.
> 
> The problem is, it doesn't work.  I can set device,direct=24 under
> XFree86 or Accelerated X, and IDL reports that it's using direct color,
> but running the diddle procedure (attached below) doesn't change the
> colors in window 0.
> 
> I don't really understand the issues involved; is it something IDL needs
> to support, or the X server, or the video card?  Is it possible to do
> this with IDL on Linux at all?
>  -Tom

********************Detail of "man
XF86Config"******************************

  Visual "visual-name"
                   This  optional  entry  sets the default root visual
type.  This may also 
		   be specified fromthe command line (see Xserver(1)).  The visual
types
		   available  for  8bpp  X  servers  are
                   (default is PseudoColor):

                    StaticGray
                    GrayScale
                    StaticColor
                    PseudoColor
                    TrueColor
                    DirectColor

                   The visual type available for the 16bpp and 32bpp X
servers is TrueColor.

                   The visual type available for the 1bpp X server is
StaticGray.

                   The visual types available for the 4bpp X server are
(default is
		   StaticColor):

                    StaticGray
                    GrayScale
                    StaticColor
                    PseudoColor
******************** "man XF86Config" ******************************