# HG changeset patch # User jwe # Date 1189670655 0 # Node ID c78e454ab5998bf094cf4adf9ba9b87368e15a65 # Parent 29fa8673d8d14d42dd9f7a9d97383bb466d05a54 [project @ 2007-09-13 08:04:15 by jwe] diff -r 29fa8673d8d1 -r c78e454ab599 src/graphics.h.in --- a/src/graphics.h.in Thu Sep 13 07:36:52 2007 +0000 +++ b/src/graphics.h.in Thu Sep 13 08:04:15 2007 +0000 @@ -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 ();