Mercurial > hg > octave-nkf
changeset 6893:c78e454ab599
[project @ 2007-09-13 08:04:15 by jwe]
author | jwe |
---|---|
date | Thu, 13 Sep 2007 08:04:15 +0000 |
parents | 29fa8673d8d1 |
children | 0a71f51ae624 |
files | src/graphics.h.in |
diffstat | 1 files changed, 32 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -289,10 +289,40 @@ { if (cmap.is_empty ()) { - cmap = Matrix (64, 3); + cmap = Matrix (64, 3, 0.0); for (octave_idx_type i = 0; i < 64; i++) - cmap(i,0) = cmap(i,1) = cmap(i,2) = i / 64.0; + { + // This is the jet colormap. It would be nice to be able + // to feval the jet function but since there is a static + // property object that includes a colormap_property + // object, we need to initialize this before main is even + // called, so calling an interpreted function is not + // possible. + + double x = i / 63.0; + + if (x >= 3.0/8.0 && x < 5.0/8.0) + cmap(i,0) = 4.0 * x - 3.0/2.0; + else if (x >= 5.0/8.0 && x < 7.0/8.0) + cmap(i,0) = 1.0; + else if (x >= 7.0/8.0) + cmap(i,0) = -4.0 * x + 9.0/2.0; + + if (x >= 1.0/8.0 && x < 3.0/8.0) + cmap(i,1) = 4.0 * x - 1.0/2.0; + else if (x >= 3.0/8.0 && x < 5.0/8.0) + cmap(i,1) = 1.0; + else if (x >= 5.0/8.0 && x < 7.0/8.0) + cmap(i,1) = -4.0 * x + 7.0/2.0; + + if (x < 1/8) + cmap(i,2) = 4.0 * x + 1.0/2.0; + else if (x >= 1.0/8.0 && x < 3.0/8.0) + cmap(i,2) = 1.0; + else if (x >= 3.0/8.0 && x < 5.0/8.0) + cmap(i,2) = -4.0 * x + 5.0/2.0; + } } validate ();