nanogui@linuxhacker.org

nanogui@linuxhacker.org


Subject: Re: Setting the palette in nano-X
From: George Harvey
Date: Mon, 13 Mar 2000 21:55:45 -0000

On 11-Mar-00, Greg Haerr wrote:


> I can get an X desktop to appear in a nano-X window but
>: the colours are wrong. VNC uses XStoreColor() to set the palette but I
can't
>: find an equivalent function in nano-X, although I can see that
>GdSetPalette()
>: is available in the graphics engine. Have I missed something, and if not,
>how
>: much work would it be to add a function to set the palette?

>This could get somewhat complicated.  One issue is whether VNC
>tries to handle the palette completely, or whether it's just trying to
>suggest colors to the engine.

I think it is requesting the colours it needs to match the original display,
how these are mapped to the target display is down to the viewer
implementation. From previous work with a stand-alone viewer, I got the best
results when I set the display palette to be the same as VNC requested.

>Are you running on a palettized display?  If you're running truecolor,
>it would be easiest to debug at first.  If running truecolor, then your first
>issue may be just mapping the colors from VNC into Nano-X by
>rewriting the color into RGB.  Then, after the colors display properly,
>start writing the code for when the Nano-X server is running in palettized
>mode.

I'm running on a palettized display.

>To accomplish this, I recommend first running with LINK_APP_INTO_SERVER
>set to Y.  This allows you to call the GdXXX functions from the client,
>for the time being.  The problem is, that the Microwindows engine doesn't
have
>virtual palettes, and only tries to manage the palette when images are
>displayed
>with GdDrawImage.  If VNC is going to manage the palette, it can call
>GdSetPalette to set a single entry (gr_nextpalentry can be used to determine
>which is the next available index).  You might also look at the engine
>function
>GdMakePaletteConversionTable for more ideas.  After you get it working,
>then build a GrSetPalette that wraps GdSetPalette, and undo
>LINK_APP_INTO_SERVER.

Hmm, sounds like there is a bit more to this than I thought.


>Why don't you take the first crack at it, and let me know if you need more
>help.

OK, I'll have a go with GdSetPalette and see how far I get.


Thanks,

George


nanogui@linuxhacker.org