Colormap to a label - Motif

This is a discussion on Colormap to a label - Motif ; All right, so I somehow managed to solve my previous issue (still not entirely sure how), but now I'm having the problem that the colors aren't showing up accurately. Red is red, and yellow is yellow, but most greys are ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Colormap to a label

  1. Colormap to a label

    All right, so I somehow managed to solve my previous issue (still not
    entirely sure how), but now I'm having the problem that the colors
    aren't showing up accurately. Red is red, and yellow is yellow, but
    most greys are turning up blueish, and vice-versa. So I searched
    through some documentation on this, and came up with the XmNcolormap
    resource, which I set to a Colormap data. Now when I run the program
    and load the image, I get a BadMatch (invalid parameter attributes)
    error.

    Can anyone help with this issue?


  2. Re: Colormap to a label

    eric.c.ramsdell@lmco.com wrote in news:1112307193.202950.147620
    @l41g2000cwc.googlegroups.com:
    > So I searched
    > through some documentation on this, and came up with the XmNcolormap
    > resource, which I set to a Colormap data. Now when I run the program
    > and load the image, I get a BadMatch (invalid parameter attributes)
    > error.


    The label widget does not have a colormap resource, so whatever you are
    setting is getting ignored. You can set the colormap on the shell containing
    the label. Or you can write your own label widget that accepts the colormap
    (and deals with various visual type and color resources correctly).

    Ken Lee, http://www.rahul.net/kenton/

  3. Re: Colormap to a label

    Well, it doesn't seem to matter which widget I apply the colormap
    resource to, I still get the same error. Of course, the documentation
    I have seems to indicate that even the label widget inherits this
    particular resource from Core, so maybe I'm going about this the wrong
    way. The widget hierarchy goes topLevel -> mainWindow-> form ->
    scrolledWindow -> label.

    I'm sorry to push for more help on this, but I seem to have exhausted
    all of my other resources on this issue.


  4. Re: Colormap to a label

    eric.c.ramsdell@lmco.com wrote:
    > Well, it doesn't seem to matter which widget I apply the colormap
    > resource to, I still get the same error. Of course, the documentation
    > I have seems to indicate that even the label widget inherits this
    > particular resource from Core, so maybe I'm going about this the wrong
    > way. The widget hierarchy goes topLevel -> mainWindow-> form ->
    > scrolledWindow -> label.


    Dont mixup class inheritance, and widget parenthood.

    Anyway, 'man Core' says:

    XmNcolormap
    Specifies the colormap that is used for
    conversions to the type Pixel for this widget instance. When this
    resource is
    changed, previously generated pixel values are not
    affected, but newly generated values are in the new colormap. For shells
    without parents, the default is the default colormap
    of the widget's screen. Otherwise, the default is copied from the par*
    ent.

    It does not say it will install the colormap on the widget's window. I
    think you have to call XInstallColormap and XSetWindowColormap yourself.

    Beware: many X servers have a small (often 1) number of hardware
    colormaps. Which means that only 1 can be active at a given time. Which
    means *all* windows will use the same colormap as the one for the window
    currently having focus. If that one is not 'natural' (eg is grayscale)
    *all* windows will be recolored (e.g. become grayscale too, and in
    unintended ways). This is known as 'colormap flashing', and has
    discouraged many from using colormaps. Which is why I wrote "I think"
    above...

    >
    > I'm sorry to push for more help on this, but I seem to have exhausted
    > all of my other resources on this issue.
    >



    --
    Michel Bardiaux
    Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
    Tel : +32 2 790.29.41

  5. Re: Colormap to a label

    Yes, I'd read about colormap flashing, which is one reason why I waited
    for so long to try this particular solution. Especially since I am
    attempting to display screenshots made with xwd via another program on
    the same machine, I thought the default colormap would display the
    proper colors, though it doesn't seem to be.

    I will try the XInstallColormap / XSetWindowColormap as you suggested,
    however.


+ Reply to Thread