XForms: fl_mapcolor/fl_getmcolor

Dick Middleton (dick@sqf.hp.com)
Tue, 10 Jun 1997 13:00:01 +0100

To subscribers of the xforms list from Dick Middleton <dick@sqf.hp.com> :

> To subscribers of the xforms list from "Dr. T.C. Zhao" <zhao@bragg.phys.uwm.edu> :

> from Dick Middleton <dick@sqf.hp.com> :

> >I find that fl_getmcolor returns values less than those set by fl_mapcolor.
> >e.g. If I set 255, 255, 255 with fl_mapcolor I get 254, 254, 254 back from
> >fl_getmcolor.
> >Is this expected?

> No. I can see this happening if the colormap is full and
> color substitution is used.

FYI, Here's my colour map info.........

256 total color cells
98 free color cells
113 shared read-only color cells
45 private writeable color cells

Here's the output of a program which sets FL_FREE_COL4 using fl_mapcolor to
the value returned from fl_getmcolor 10 times - starting from white.

Red set: 255 get: 254 Green set: 255 get: 254 Blue set: 255 get: 254
Red set: 254 get: 253 Green set: 254 get: 253 Blue set: 254 get: 253
Red set: 253 get: 252 Green set: 253 get: 252 Blue set: 253 get: 252
Red set: 252 get: 251 Green set: 252 get: 251 Blue set: 252 get: 251
Red set: 251 get: 250 Green set: 251 get: 250 Blue set: 251 get: 250
Red set: 250 get: 249 Green set: 250 get: 249 Blue set: 250 get: 249
Red set: 249 get: 248 Green set: 249 get: 248 Blue set: 249 get: 248
Red set: 248 get: 247 Green set: 248 get: 247 Blue set: 248 get: 247
Red set: 247 get: 246 Green set: 247 get: 246 Blue set: 247 get: 246
Red set: 246 get: 245 Green set: 246 get: 245 Blue set: 246 get: 245

At 128,128,128 it starts behaving normally. Wierd eh!

I find it hard to believe this is colour substitution effect - it
seems too systematic to me. Is it X or forms or what? I'm on hp-ux 9.07 on
an s712 with XR5 and xforms 0.86.

Here's the program I used.........

#include <forms.h>
#include <studio.h>

void
main(int argc, char **argv) {
int r = 255, g = 255, b = 255;
int rr, gg, bb;
int ii;

Display *display;

display = fl_initialize(&argc, argv, "XNAME", 0, 0);

for (ii = 0; ii <10; ii++) {

fl_mapcolor(FL_FREE_COL4, r, g, b);

fl_getmcolor(FL_FREE_COL4, &rr, &gg, &bb);

printf("Red set: %d get: %d", r, rr);
printf(" Green set: %d get: %d", g, gg);
printf(" Blue set: %d get: %d\n", b, bb);
r = rr; g = gg; b = bb;
}

}

Dick

--

dick@sqf.hp.com _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/