Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XOR problem in PEX

0 views
Skip to first unread message

Dinendra Ramachandran

unread,
Jul 12, 1995, 3:00:00 AM7/12/95
to
I have a problem with XORing XColors on PEXColors. I would
appreciate if anyone could send me any type of help to solve this
problem.

Basically, I have a PEX structure network with certain renderer
attributes set. One of the attributes is the PEXRABackground with
a background color of black using a PEXColor structure. When I
render the network to the window and then attempt to draw lines in
XWindows using a GC with the GCFunction set the XOR and the
foreground set to (foreground ^ background), the colors of these
lines is same sort of faint blue and not white as I would expect
it to be.

The same XWindows code works just fine if I do not render the
network at all. My conclusion is that I am missing some step in
PEX to make the PEXColors compatible with XColors in order for
this operation to work correctly.

I would appreciate any help or solution to this problem. Thanks in
advance.

Regards,

Uday Pai
Email : u...@aelags.com

Karl Schultz

unread,
Jul 14, 1995, 3:00:00 AM7/14/95
to
Please use comp.graphics.api.pexlib from now on. This group
goes away shortly.

Most PEX applications create a "ramp" of colors in a colormap
for color quantization purposes. This ramp might take up an
entire colormap, or might take up part of the DefaultColormapOfScreen.

In your case, imagine that the application created a 125-entry (555 ramp)
in the DefaultColormapOfScreen so that the bottom of the map was
at colorcell 100, for example. This means that the pixel (colormap
index) for a PEX Black color is 100 (01100100b). So all the background
pixels drawn by PEX are set to 100, not zero.

When you come along and XOR your foreground color with the background
color, you are XORing with 100, which might be different than you
expect. Certainly the result of fg ^ (bg=100) will be different
than you expect if you thought bg should be 0.

In general, controlling the final output color when using PEX and XOR
is difficult. Most approaches to get better control use color ramps
that use up the entire colormap and thus get completely predictable
results.

Try using a TrueColor visual to accomplish this.

0 new messages