From: Arjen M. <arj...@wl...> - 2004-05-17 06:47:21
|
susto susto wrote: > > Hello everyone!!! > > I have been working with plplot to get some plots. I > need to get those plots in black and white. I have > used the code you can find in the documentation: > > PLFLT i[2], r[2], g[2], b[2]; > > i[0] = 0.0; > i[1] = 1.0; > r[0] = 0.0; > r[1] = 1.0; > g[0] = 0.0; > g[1] = 1.0; > b[0] = 0.0; > b[1] = 1.0; > > pls->scmap1l(1, 2, i, r, g, b, NULL); > > This work perfectly to the xwin driver and I get the > plot I want, but when I use the ps driver I get also a > black and white plot but the colors are interchange. I > mean if you have a dark gray in xwin you get a clear > one in ps. > > Does somebody know which could be the reason??? I > execute the same code with both so I do not know why > it works like that. > > Thanks in advanced > > Susto > The PS driver is a bit simple-minded: it knows about black and white and nothing in between! I have encountered that problem myself and have patched it like this: case PLSTATE_COLOR0: /* fallthrough */ case PLSTATE_COLOR1: if (pls->color) { PLFLT r = ((PLFLT) pls->curcolor.r) / 255.0; PLFLT g = ((PLFLT) pls->curcolor.g) / 255.0; PLFLT b = ((PLFLT) pls->curcolor.b) / 255.0; fprintf(OF, " S\n%.4f %.4f %.4f C", r, g, b); } else { PLFLT r = ((PLFLT) pls->curcolor.r) / 255.0; PLFLT g = ((PLFLT) pls->curcolor.g) / 255.0; PLFLT b = ((PLFLT) pls->curcolor.b) / 255.0; fprintf(OF, " S\n%.4f G", (r+g+b)/3.0); } break; } in plD_state_ps() in ps.c Regards, Arjen |