static void cmap1_init( int gray ) { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary if ( gray ) { h[0] = 0.0; // hue -- low: red (arbitrary if s=0) h[1] = 0.0; // hue -- high: red (arbitrary if s=0) l[0] = 0.5; // lightness -- low: half-dark l[1] = 1.0; // lightness -- high: light s[0] = 0.0; // minimum saturation s[1] = 0.0; // minimum saturation } else { h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; } plscmap1n( 256 ); c_plscmap1l( 0, 2, i, h, l, s, NULL ); }
void c_plscmap1(PLINT *r, PLINT *g, PLINT *b, PLINT ncol1) { int i; plscmap1n(ncol1); for (i = 0; i < plsc->ncol1; i++) { if ((r[i] < 0 || r[i] > 255) || (g[i] < 0 || g[i] > 255) || (b[i] < 0 || b[i] > 255)) { char buffer[256]; sprintf(buffer, "plscmap1: Invalid RGB color: %d, %d, %d", (int) r[i], (int) g[i], (int) b[i]); plabort(buffer); return; } plsc->cmap1[i].r = r[i]; plsc->cmap1[i].g = g[i]; plsc->cmap1[i].b = b[i]; } if (plsc->level > 0) plP_state(PLSTATE_CMAP1); }
void c_plscmap1l(PLINT itype, PLINT npts, PLFLT *pos, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLINT *rev) { int n; PLFLT h, l, s, r, g, b; if (npts < 2) { plabort("plscmap1l: Must specify at least two control points"); return; } if ( (pos[0] != 0) || (pos[npts-1] != 1)) { plabort("plscmap1l: First, last control points must lie on boundary"); return; } if ( npts > PL_MAX_CMAP1CP ) { plabort("plscmap1l: exceeded maximum number of control points"); return; } /* Allocate if not done yet */ if (plsc->cmap1 == NULL) plscmap1n(0); /* Save control points */ plsc->ncp1 = npts; for (n = 0; n < npts; n++) { if (itype == 0) { h = coord1[n]; l = coord2[n]; s = coord3[n]; } else { r = coord1[n]; g = coord2[n]; b = coord3[n]; c_plrgbhls(r, g, b, &h, &l, &s); } plsc->cmap1cp[n].h = h; plsc->cmap1cp[n].l = l; plsc->cmap1cp[n].s = s; plsc->cmap1cp[n].p = pos[n]; if (rev == NULL) plsc->cmap1cp[n].rev = 0; else plsc->cmap1cp[n].rev = rev[n]; } /* Calculate and set color map */ plcmap1_calc(); }
static void cmap1_init() { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; /* left boundary */ i[1] = 1.0; /* right boundary */ h[0] = 240; /* blue -> green -> yellow -> */ h[1] = 0; /* -> red */ l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; plscmap1n(256); c_plscmap1l(0, 2, i, h, l, s, NULL); }