Add isoluminant color maps.
authorMartin Lambers <marlam@marlam.de>
Mon, 8 Feb 2016 14:14:48 +0000 (15:14 +0100)
committerMartin Lambers <marlam@marlam.de>
Mon, 8 Feb 2016 14:14:48 +0000 (15:14 +0100)
cmdline.cpp
colormap.cpp
colormap.hpp
colormapwidgets.cpp
colormapwidgets.hpp
gui.cpp
gui.hpp
screenshot.png

index 7eef62f..736000c 100644 (file)
@@ -34,12 +34,15 @@ extern int optind;
 #include "colormap.hpp"
 
 enum type {
-    brewer_sequential = 0,
-    brewer_diverging = 1,
-    brewer_qualitative = 2,
-    cubehelix = 3,
-    morelanddiverging = 4,
-    mcnamessequential = 5
+    brewer_seq = 0,
+    brewer_div = 1,
+    brewer_qual = 2,
+    isolum_seq = 3,
+    isolum_div = 4,
+    isolum_qual = 5,
+    cubehelix = 6,
+    moreland = 7,
+    mcnames = 8
 };
 
 int main(int argc, char* argv[])
@@ -54,6 +57,7 @@ int main(int argc, char* argv[])
     float saturation = -1.0f;
     float brightness = -1.0f;
     float warmth = -1.0f;
+    float luminance = -1.0f;
     float rotations = NAN;
     float gamma = -1.0f;
     bool have_color0 = false;
@@ -72,6 +76,7 @@ int main(int argc, char* argv[])
         { "saturation", required_argument, 0, 's' },
         { "brightness", required_argument, 0, 'b' },
         { "warmth",     required_argument, 0, 'w' },
+        { "luminance",  required_argument, 0, 'l' },
         { "rotations",  required_argument, 0, 'r' },
         { "gamma",      required_argument, 0, 'g' },
         { "color0",     required_argument, 0, 'A' },
@@ -81,7 +86,7 @@ int main(int argc, char* argv[])
     };
 
     for (;;) {
-        int c = getopt_long(argc, argv, "vHt:n:h:d:c:s:b:w:r:g:A:O:p:", options, NULL);
+        int c = getopt_long(argc, argv, "vHt:n:h:d:c:s:b:w:l:r:g:A:O:p:", options, NULL);
         if (c == -1)
             break;
         switch (c) {
@@ -92,12 +97,15 @@ int main(int argc, char* argv[])
             print_help = true;
             break;
         case 't':
-            type = (strcmp(optarg, "brewer-sequential") == 0 ? brewer_sequential
-                    : strcmp(optarg, "brewer-diverging") == 0 ? brewer_diverging
-                    : strcmp(optarg, "brewer-qualitative") == 0 ? brewer_qualitative
+            type = (strcmp(optarg, "brewer-sequential") == 0 ? brewer_seq
+                    : strcmp(optarg, "brewer-diverging") == 0 ? brewer_div
+                    : strcmp(optarg, "brewer-qualitative") == 0 ? brewer_qual
+                    : strcmp(optarg, "isoluminant-sequential") == 0 ? isolum_seq
+                    : strcmp(optarg, "isoluminant-divergent") == 0 ? isolum_div
+                    : strcmp(optarg, "isoluminant-qualitative") == 0 ? isolum_qual
                     : strcmp(optarg, "cubehelix") == 0 ? cubehelix
-                    : strcmp(optarg, "morelanddiverging") == 0 ? morelanddiverging
-                    : strcmp(optarg, "mcnamessequential") == 0 ? mcnamessequential
+                    : strcmp(optarg, "moreland") == 0 ? moreland
+                    : strcmp(optarg, "mcnames") == 0 ? mcnames
                     : -2);
             break;
         case 'n':
@@ -121,6 +129,9 @@ int main(int argc, char* argv[])
         case 'w':
             warmth = atof(optarg);
             break;
+        case 'l':
+            luminance = atof(optarg);
+            break;
         case 'r':
             rotations = atof(optarg);
             break;
@@ -155,29 +166,37 @@ int main(int argc, char* argv[])
     if (print_help) {
         printf("Usage: %s\n"
                 "  Common options, required for all types:\n"
-                "    -n|--n=N                      Set number of colors in the map\n"
+                "    -n|--n=N                         Set number of colors in the map\n"
                 "  Brewer-like color maps:\n"
-                "    -t|--type=brewer-sequential   Generate a sequential color map\n"
-                "    -t|--type=brewer-diverging    Generate a diverging color map\n"
-                "    -t|--type=brewer-qualitative  Generate a qualitative color map\n"
-                "    [-h|--hue=H]                  Set default hue in [0,360] degrees\n"
-                "    [-c|--contrast=C]             Set contrast in [0,1]\n"
-                "    [-s|--saturation=S]           Set saturation in [0,1]\n"
-                "    [-b|--brightness=B]           Set brightness in [0,1]\n"
-                "    [-w|--warmth=W]               Set warmth in [0,1] for seq. and div. maps\n"
-                "    [-d|--divergence=D]           Set divergence for div. and qual. maps\n"
+                "    -t|--type=brewer-sequential       Generate a sequential color map\n"
+                "    -t|--type=brewer-diverging        Generate a diverging color map\n"
+                "    -t|--type=brewer-qualitative      Generate a qualitative color map\n"
+                "    [-h|--hue=H]                      Set default hue in [0,360] degrees\n"
+                "    [-c|--contrast=C]                 Set contrast in [0,1]\n"
+                "    [-s|--saturation=S]               Set saturation in [0,1]\n"
+                "    [-b|--brightness=B]               Set brightness in [0,1]\n"
+                "    [-w|--warmth=W]                   Set warmth in [0,1] for seq. and div. maps\n"
+                "    [-d|--divergence=D]               Set divergence in deg. for div. and qual. maps\n"
+                "  Isoluminant color maps:\n"
+                "    -t|--type=isoluminant-sequential  Generate a sequential color map\n"
+                "    -t|--type=isoluminant-diverging   Generate a diverging color map\n"
+                "    -t|--type=isoluminant-qualitative Generate a qualitative color map\n"
+                "    [-l|--luminance=L]                Set luminance in [0,1]\n"
+                "    [-s|--saturation=S]               Set saturation in [0,1]\n"
+                "    [-h|--hue=H]                      Set default hue in [0,360] degrees\n"
+                "    [-d|--divergence=D]               Set divergence in deg. for div. and qual. maps\n"
                 "  CubeHelix color maps:\n"
-                "    -t|--type=cubehelix           Generate a CubeHelix color map\n"
-                "    [-r|--rotations=R]            Set number of rotations, in (-infty,infty)\n"
-                "    [-s|--saturation=S]           Set saturation, in [0,1]\n"
-                "    [-g|--gamma=G]                Set gamma correction, in (0,infty)\n"
+                "    -t|--type=cubehelix               Generate a CubeHelix color map\n"
+                "    [-r|--rotations=R]                Set number of rotations, in (-infty,infty)\n"
+                "    [-s|--saturation=S]               Set saturation, in [0,1]\n"
+                "    [-g|--gamma=G]                    Set gamma correction, in (0,infty)\n"
                 "  Moreland diverging color maps:\n"
-                "    -t|--type=morelanddiverging   Generate a Moreland diverging color map\n"
-                "    [-A|--color0=sr,sg,sb         Set the first color as sRGB values in [0,255]\n"
-                "    [-O|--color1=sr,sg,sb         Set the last color as sRGB values in [0,255]\n"
+                "    -t|--type=moreland                Generate a Moreland diverging color map\n"
+                "    [-A|--color0=sr,sg,sb             Set the first color as sRGB values in [0,255]\n"
+                "    [-O|--color1=sr,sg,sb             Set the last color as sRGB values in [0,255]\n"
                 "  McNames sequential color maps:\n"
-                "    -t|--type=mcnamessequential   Generate a McNames sequential color map\n"
-                "    [-p|--periods=p]              Set the number of periods in (0, infty)\n"
+                "    -t|--type=mcnames                 Generate a McNames sequential color map\n"
+                "    [-p|--periods=P]                  Set the number of periods in (0, infty)\n"
                 "Generates a color map and prints it to standard output as sRGB triplets.\n"
                 "Report bugs to <martin.lambers@uni-siegen.de>.\n", argv[0]);
         return 0;
@@ -192,54 +211,78 @@ int main(int argc, char* argv[])
         return 1;
     }
     if (hue < 0.0f) {
-        if (type == brewer_sequential)
+        if (type == brewer_seq)
             hue = ColorMap::BrewerSequentialDefaultHue;
-        else if (type == brewer_diverging)
+        else if (type == brewer_div)
             hue = ColorMap::BrewerDivergingDefaultHue;
-        else if (type == brewer_qualitative)
+        else if (type == brewer_qual)
             hue = ColorMap::BrewerQualitativeDefaultHue;
+        else if (type == isolum_seq)
+            hue = ColorMap::IsoluminantSequentialDefaultHue;
+        else if (type == isolum_div)
+            hue = ColorMap::IsoluminantDivergingDefaultHue;
+        else if (type == isolum_qual)
+            hue = ColorMap::IsoluminantQualitativeDefaultHue;
         else if (type == cubehelix)
             hue = ColorMap::CubeHelixDefaultHue;
     }
     if (divergence < 0.0f) {
-        if (type == brewer_diverging)
+        if (type == brewer_div)
             divergence = ColorMap::BrewerDivergingDefaultDivergence;
-        else if (type == brewer_qualitative)
+        else if (type == brewer_qual)
             divergence = ColorMap::BrewerQualitativeDefaultDivergence;
+        else if (type == isolum_div)
+            divergence = ColorMap::IsoluminantDivergingDefaultDivergence;
+        else if (type == isolum_qual)
+            divergence = ColorMap::IsoluminantQualitativeDefaultDivergence;
     }
     if (contrast < 0.0f) {
-        if (type == brewer_sequential)
+        if (type == brewer_seq)
             contrast = (n <= 9 ? ColorMap::BrewerSequentialDefaultContrastForSmallN(n)
                     : ColorMap::BrewerSequentialDefaultContrast);
-        else if (type == brewer_diverging)
+        else if (type == brewer_div)
             contrast = (n <= 9 ? ColorMap::BrewerDivergingDefaultContrastForSmallN(n)
                     : ColorMap::BrewerDivergingDefaultContrast);
-        else if (type == brewer_qualitative)
+        else if (type == brewer_qual)
             contrast = ColorMap::BrewerQualitativeDefaultContrast;
     }
     if (saturation < 0.0f) {
-        if (type == brewer_sequential)
+        if (type == brewer_seq)
             saturation = ColorMap::BrewerSequentialDefaultSaturation;
-        else if (type == brewer_diverging)
+        else if (type == brewer_div)
             saturation = ColorMap::BrewerDivergingDefaultSaturation;
-        else if (type == brewer_qualitative)
+        else if (type == brewer_qual)
             saturation = ColorMap::BrewerQualitativeDefaultSaturation;
+        else if (type == isolum_seq)
+            saturation = ColorMap::IsoluminantSequentialDefaultSaturation;
+        else if (type == isolum_div)
+            saturation = ColorMap::IsoluminantDivergingDefaultSaturation;
+        else if (type == isolum_qual)
+            saturation = ColorMap::IsoluminantQualitativeDefaultSaturation;
         else if (type == cubehelix)
             saturation = ColorMap::CubeHelixDefaultSaturation;
     }
     if (brightness < 0.0f) {
-        if (type == brewer_sequential)
+        if (type == brewer_seq)
             brightness = ColorMap::BrewerSequentialDefaultBrightness;
-        else if (type == brewer_diverging)
+        else if (type == brewer_div)
             brightness = ColorMap::BrewerDivergingDefaultBrightness;
-        else if (type == brewer_qualitative)
+        else if (type == brewer_qual)
             brightness = ColorMap::BrewerQualitativeDefaultBrightness;
     }
     if (warmth < 0.0f) {
-        if (type == brewer_sequential)
-            brightness = ColorMap::BrewerSequentialDefaultWarmth;
-        else if (type == brewer_diverging)
-            brightness = ColorMap::BrewerDivergingDefaultWarmth;
+        if (type == brewer_seq)
+            warmth = ColorMap::BrewerSequentialDefaultWarmth;
+        else if (type == brewer_div)
+            warmth = ColorMap::BrewerDivergingDefaultWarmth;
+    }
+    if (luminance < 0.0f) {
+        if (type == isolum_seq)
+            luminance = ColorMap::IsoluminantSequentialDefaultLuminance;
+        else if (type == isolum_div)
+            luminance = ColorMap::IsoluminantDivergingDefaultLuminance;
+        else if (type == isolum_qual)
+            luminance = ColorMap::IsoluminantQualitativeDefaultLuminance;
     }
     if (std::isnan(rotations)) {
         if (type == cubehelix)
@@ -250,45 +293,54 @@ int main(int argc, char* argv[])
             gamma = ColorMap::CubeHelixDefaultGamma;
     }
     if (!have_color0) {
-        if (type == morelanddiverging) {
-            color0[0] = ColorMap::MorelandDivergingDefaultR0;
-            color0[1] = ColorMap::MorelandDivergingDefaultG0;
-            color0[2] = ColorMap::MorelandDivergingDefaultB0;
+        if (type == moreland) {
+            color0[0] = ColorMap::MorelandDefaultR0;
+            color0[1] = ColorMap::MorelandDefaultG0;
+            color0[2] = ColorMap::MorelandDefaultB0;
         }
     }
     if (!have_color1) {
-        if (type == morelanddiverging) {
-            color1[0] = ColorMap::MorelandDivergingDefaultR1;
-            color1[1] = ColorMap::MorelandDivergingDefaultG1;
-            color1[2] = ColorMap::MorelandDivergingDefaultB1;
+        if (type == moreland) {
+            color1[0] = ColorMap::MorelandDefaultR1;
+            color1[1] = ColorMap::MorelandDefaultG1;
+            color1[2] = ColorMap::MorelandDefaultB1;
         }
     }
     if (std::isnan(periods)) {
-        if (type == mcnamessequential)
-            periods = ColorMap::McNamesSequentialDefaultPeriods;
+        if (type == mcnames)
+            periods = ColorMap::McNamesDefaultPeriods;
     }
 
     std::vector<unsigned char> colormap(3 * n);
     switch (type) {
-    case brewer_sequential:
+    case brewer_seq:
         ColorMap::BrewerSequential(n, &(colormap[0]), hue, contrast, saturation, brightness, warmth);
         break;
-    case brewer_diverging:
+    case brewer_div:
         ColorMap::BrewerDiverging(n, &(colormap[0]), hue, divergence, contrast, saturation, brightness, warmth);
         break;
-    case brewer_qualitative:
+    case brewer_qual:
         ColorMap::BrewerQualitative(n, &(colormap[0]), hue, divergence, contrast, saturation, brightness);
         break;
+    case isolum_seq:
+        ColorMap::IsoluminantSequential(n, &(colormap[0]), luminance, saturation, hue);
+        break;
+    case isolum_div:
+        ColorMap::IsoluminantDiverging(n, &(colormap[0]), luminance, saturation, hue, divergence);
+        break;
+    case isolum_qual:
+        ColorMap::IsoluminantQualitative(n, &(colormap[0]), luminance, saturation, hue, divergence);
+        break;
     case cubehelix:
         ColorMap::CubeHelix(n, &(colormap[0]), hue, rotations, saturation, gamma);
         break;
-    case morelanddiverging:
-        ColorMap::MorelandDiverging(n, &(colormap[0]),
+    case moreland:
+        ColorMap::Moreland(n, &(colormap[0]),
                 color0[0], color0[1], color0[2],
                 color1[0], color1[1], color1[2]);
         break;
-    case mcnamessequential:
-        ColorMap::McNamesSequential(n, &(colormap[0]), periods);
+    case mcnames:
+        ColorMap::McNames(n, &(colormap[0]), periods);
         break;
     }
 
index 5f5c829..8eb65eb 100644 (file)
@@ -540,6 +540,62 @@ void BrewerQualitative(int n, unsigned char* colormap, float hue, float divergen
     }
 }
 
+/* Isoluminant */
+
+static void lch_to_colormap(float l, float c, float h,
+        int i, unsigned char* colormap)
+{
+    float u, v;
+    lch_to_luv(c, h, &u, &v);
+    float x, y, z;
+    luv_to_xyz(l, u, v, &x, &y, &z);
+    float r, g, b;
+    xyz_to_rgb(x, y, z, &r, &g, &b);
+    float sr, sg, sb;
+    rgb_to_srgb(r, g, b, &sr, &sg, &sb);
+    colormap[3 * i + 0] = float_to_uchar(sr);
+    colormap[3 * i + 1] = float_to_uchar(sg);
+    colormap[3 * i + 2] = float_to_uchar(sb);
+}
+
+void IsoluminantSequential(int n, unsigned char* colormap,
+        float luminance, float saturation, float hue)
+{
+    const float l = luminance * 100.0f;
+    const float h = hue;
+    for (int i = 0; i < n; i++) {
+        float t = i / (n - 1.0f);
+        float s = saturation * 5.0f * (1.0f - t);
+        float c = lch_chroma(l, s);
+        lch_to_colormap(l, c, h, i, colormap);
+    }
+}
+
+void IsoluminantDiverging(int n, unsigned char* colormap,
+        float luminance, float saturation, float hue, float divergence)
+{
+    const float l = luminance * 100.0f;
+    for (int i = 0; i < n; i++) {
+        float t = i / (n - 1.0f);
+        float s = saturation * 5.0f * (t <= 0.5f ? 2.0f * (0.5f - t) : 2.0f * (t - 0.5f));
+        float c = lch_chroma(l, s);
+        float h = (t <= 0.5f ? hue : hue + divergence);
+        lch_to_colormap(l, c, h, i, colormap);
+    }
+}
+
+void IsoluminantQualitative(int n, unsigned char* colormap,
+        float luminance, float saturation, float hue, float divergence)
+{
+    const float l = luminance * 100.0f;
+    const float c = lch_chroma(l, saturation * 5.0f);
+    for (int i = 0; i < n; i++) {
+        float t = i / (n - 1.0f);
+        float h = hue + t * divergence;
+        lch_to_colormap(l, c, h, i, colormap);
+    }
+}
+
 /* CubeHelix */
 
 int CubeHelix(int n, unsigned char* colormap, float hue,
@@ -587,7 +643,7 @@ int CubeHelix(int n, unsigned char* colormap, float hue,
     return clippings;
 }
 
-/* MorelandDiverging */
+/* Moreland */
 
 static void lab_to_msh(float l, float a, float b, float* m, float* s, float* h)
 {
@@ -643,7 +699,7 @@ static float adjust_hue(float m, float s, float h, float unsaturated_m)
     }
 }
 
-void MorelandDiverging(int n, unsigned char* colormap,
+void Moreland(int n, unsigned char* colormap,
         unsigned char sr0, unsigned char sg0, unsigned char sb0,
         unsigned char sr1, unsigned char sg1, unsigned char sb1)
 {
@@ -716,7 +772,7 @@ static float windowfunc(float t)
 #endif
 }
 
-void McNamesSequential(int n, unsigned char* colormap, float periods)
+void McNames(int n, unsigned char* colormap, float periods)
 {
     static const float sqrt3 = std::sqrt(3.0f);
     static const float a12 = std::asin(1.0f / sqrt3);
index 7ab52f8..48953f7 100644 (file)
@@ -101,6 +101,50 @@ void BrewerQualitative(int n, unsigned char* colormap,
         float brightness = BrewerQualitativeDefaultBrightness);
 
 /*
+ * Isoluminant color maps.
+ *
+ * These are useful for coloring surfaces because their constant luminance
+ * allows non-interfering combination with shading.
+ */
+
+// Create a sequential isoluminant color map with n colors.
+
+const float IsoluminantSequentialDefaultLuminance = 0.5f;
+const float IsoluminantSequentialDefaultSaturation = 0.5f;
+const float IsoluminantSequentialDefaultHue = 0.0f;
+
+void IsoluminantSequential(int n, unsigned char* colormap,
+        float luminance = IsoluminantSequentialDefaultLuminance,
+        float saturation = IsoluminantSequentialDefaultSaturation,
+        float hue = IsoluminantSequentialDefaultHue);
+
+// Create a diverging isoluminant color map with n colors.
+
+const float IsoluminantDivergingDefaultLuminance = 0.5f;
+const float IsoluminantDivergingDefaultSaturation = 0.5f;
+const float IsoluminantDivergingDefaultHue = 0.0f;
+const float IsoluminantDivergingDefaultDivergence = 4.18879020479f; // 2/3 * 2PI
+
+void IsoluminantDiverging(int n, unsigned char* colormap,
+        float luminance = IsoluminantDivergingDefaultLuminance,
+        float saturation = IsoluminantDivergingDefaultSaturation,
+        float hue = IsoluminantDivergingDefaultHue,
+        float divergence = IsoluminantDivergingDefaultDivergence);
+
+// Create a qualitative isoluminant color map with n colors.
+
+const float IsoluminantQualitativeDefaultLuminance = 0.5f;
+const float IsoluminantQualitativeDefaultSaturation = 0.35f;
+const float IsoluminantQualitativeDefaultHue = 0.0f;
+const float IsoluminantQualitativeDefaultDivergence = 4.18879020479f; // 2/3 * 2PI
+
+void IsoluminantQualitative(int n, unsigned char* colormap,
+        float luminance = IsoluminantQualitativeDefaultLuminance,
+        float saturation = IsoluminantQualitativeDefaultSaturation,
+        float hue = IsoluminantQualitativeDefaultHue,
+        float divergence = IsoluminantQualitativeDefaultDivergence);
+
+/*
  * CubeHelix color maps, as described in
  * Green, D. A., 2011, A colour scheme for the display of astronomical intensity
  * images, Bulletin of the Astronomical Society of India, 39, 289.
@@ -125,42 +169,44 @@ int CubeHelix(int n, unsigned char* colormap,
         float gamma = CubeHelixDefaultGamma);
 
 /*
- * MorelandDiverging color maps, as described in
+ * Moreland color maps, as described in
  * K. Moreland, Diverging Color Maps for Scientific Visualization, Proc. Int.
  * Symp. Visual Computing, December 2009, DOI 10.1007/978-3-642-10520-3_9.
  */
 
-// Create a MorelandDiverging colormap with n colors. Specify the two endpoints
+// Create a Moreland colormap with n colors. Specify the two endpoints
 // of the colormap as sRGB colors; all intermediate colors will be generated.
-const unsigned char MorelandDivergingDefaultR0 = 180;
-const unsigned char MorelandDivergingDefaultG0 = 4;
-const unsigned char MorelandDivergingDefaultB0 = 38;
-const unsigned char MorelandDivergingDefaultR1 = 59;
-const unsigned char MorelandDivergingDefaultG1 = 76;
-const unsigned char MorelandDivergingDefaultB1 = 192;
-
-void MorelandDiverging(int n, unsigned char* colormap,
-        unsigned char sr0 = MorelandDivergingDefaultR0,
-        unsigned char sg0 = MorelandDivergingDefaultG0,
-        unsigned char sb0 = MorelandDivergingDefaultB0,
-        unsigned char sr1 = MorelandDivergingDefaultR1,
-        unsigned char sg1 = MorelandDivergingDefaultG1,
-        unsigned char sb1 = MorelandDivergingDefaultB1);
+
+const unsigned char MorelandDefaultR0 = 180;
+const unsigned char MorelandDefaultG0 = 4;
+const unsigned char MorelandDefaultB0 = 38;
+const unsigned char MorelandDefaultR1 = 59;
+const unsigned char MorelandDefaultG1 = 76;
+const unsigned char MorelandDefaultB1 = 192;
+
+void Moreland(int n, unsigned char* colormap,
+        unsigned char sr0 = MorelandDefaultR0,
+        unsigned char sg0 = MorelandDefaultG0,
+        unsigned char sb0 = MorelandDefaultB0,
+        unsigned char sr1 = MorelandDefaultR1,
+        unsigned char sg1 = MorelandDefaultG1,
+        unsigned char sb1 = MorelandDefaultB1);
 
 /*
- * McNamesSequential color maps, as described in
+ * McNames color maps, as described in
  * J. McNames, An Effective Color Scale for Simultaneous Color and Gray-Scale Publications,
  * IEEE Signal Processing Magazine 23(1), January 2006, DOI 10.1109/MSP.2006.1593340.
  *
  * Note: Use CubeHelix instead! The McNames color maps are perceptually not linear in luminance!
  */
 
-// Create a McNamesSequential colormap with n colors. Specify the number of
+// Create a McNames colormap with n colors. Specify the number of
 // periods.
-const float McNamesSequentialDefaultPeriods = 2.0f;
 
-void McNamesSequential(int n, unsigned char* colormap,
-        float periods = McNamesSequentialDefaultPeriods);
+const float McNamesDefaultPeriods = 2.0f;
+
+void McNames(int n, unsigned char* colormap,
+        float periods = McNamesDefaultPeriods);
 
 }
 
index 3514997..bd3339a 100644 (file)
@@ -43,6 +43,8 @@ static QString brewerlike_reference = QString("Relevant paper: "
         "<a href=\"http://dx.doi.org/10.1111/j.1467-8659.2008.01203.x\">Generating Color Palettes using Intuitive Parameters</a>, "
         "Computer Graphics Forum 27(3), May 2008.");
 
+static QString isoluminant_reference = QString("");
+
 static QString cubehelix_reference = QString("Relevant paper: "
         "D. A. Green, "
         "<a href=\"http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/\">A colour scheme for the display of astronomical intensity</a>, "
@@ -290,6 +292,8 @@ void ColorMapBrewerSequentialWidget::update()
         emit colorMapChanged();
 }
 
+/* ColorMapBrewerDivergingWidget */
+
 ColorMapBrewerDivergingWidget::ColorMapBrewerDivergingWidget() :
     _update_lock(false)
 {
@@ -360,7 +364,7 @@ ColorMapBrewerDivergingWidget::~ColorMapBrewerDivergingWidget()
 void ColorMapBrewerDivergingWidget::reset()
 {
     _update_lock = true;
-    _n_spinbox->setValue(256);
+    _n_spinbox->setValue(257);
     _hue_changer->setValue(qRadiansToDegrees(ColorMap::BrewerDivergingDefaultHue));
     _divergence_changer->setValue(qRadiansToDegrees(ColorMap::BrewerDivergingDefaultDivergence));
     _warmth_changer->setValue(ColorMap::BrewerDivergingDefaultWarmth);
@@ -404,6 +408,8 @@ void ColorMapBrewerDivergingWidget::update()
         emit colorMapChanged();
 }
 
+/* ColorMapBrewerQualitativeWidget */
+
 ColorMapBrewerQualitativeWidget::ColorMapBrewerQualitativeWidget() :
     _update_lock(false)
 {
@@ -476,7 +482,7 @@ ColorMapBrewerQualitativeWidget::~ColorMapBrewerQualitativeWidget()
 void ColorMapBrewerQualitativeWidget::reset()
 {
     _update_lock = true;
-    _n_spinbox->setValue(256);
+    _n_spinbox->setValue(9);
     _hue_changer->setValue(qRadiansToDegrees(ColorMap::BrewerQualitativeDefaultHue));
     _divergence_changer->setValue(qRadiansToDegrees(ColorMap::BrewerQualitativeDefaultDivergence));
     _contrast_changer->setValue(ColorMap::BrewerQualitativeDefaultContrast);
@@ -518,6 +524,299 @@ void ColorMapBrewerQualitativeWidget::update()
         emit colorMapChanged();
 }
 
+/* ColorMapIsoluminantSequentialWidget */
+
+ColorMapIsoluminantSequentialWidget::ColorMapIsoluminantSequentialWidget() :
+    _update_lock(false)
+{
+    QGridLayout *layout = new QGridLayout;
+
+    QLabel* n_label = new QLabel("Colors:");
+    layout->addWidget(n_label, 1, 0);
+    _n_spinbox = new QSpinBox();
+    _n_spinbox->setRange(2, 1024);
+    _n_spinbox->setSingleStep(1);
+    layout->addWidget(_n_spinbox, 1, 1, 1, 3);
+
+    QLabel* luminance_label = new QLabel("Luminance:");
+    layout->addWidget(luminance_label, 2, 0);
+    _luminance_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_luminance_changer->slider, 2, 1, 1, 2);
+    layout->addWidget(_luminance_changer->spinbox, 2, 3);
+
+    QLabel* saturation_label = new QLabel("Saturation:");
+    layout->addWidget(saturation_label, 3, 0);
+    _saturation_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_saturation_changer->slider, 3, 1, 1, 2);
+    layout->addWidget(_saturation_changer->spinbox, 3, 3);
+
+    QLabel* hue_label = new QLabel("Hue:");
+    layout->addWidget(hue_label, 4, 0);
+    _hue_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(_hue_changer->slider, 4, 1, 1, 2);
+    layout->addWidget(_hue_changer->spinbox, 4, 3);
+
+    QLabel* divergence_label = new QLabel("Divergence:");
+    layout->addWidget(divergence_label, 5, 0);
+    ColorMapCombinedSliderSpinBox* divergence_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(divergence_changer->slider, 5, 1, 1, 2);
+    layout->addWidget(divergence_changer->spinbox, 5, 3);
+    hideWidgetButPreserveSize(divergence_label);
+    hideWidgetButPreserveSize(divergence_changer->slider);
+    hideWidgetButPreserveSize(divergence_changer->spinbox);
+
+    layout->setColumnStretch(1, 1);
+    layout->addItem(new QSpacerItem(0, 0), 6, 0, 1, 4);
+    layout->setRowStretch(6, 1);
+    setLayout(layout);
+
+    connect(_n_spinbox, SIGNAL(valueChanged(int)), this, SLOT(update()));
+    connect(_luminance_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_saturation_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_hue_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    reset();
+}
+
+ColorMapIsoluminantSequentialWidget::~ColorMapIsoluminantSequentialWidget()
+{
+}
+
+void ColorMapIsoluminantSequentialWidget::reset()
+{
+    _update_lock = true;
+    _n_spinbox->setValue(256);
+    _luminance_changer->setValue(ColorMap::IsoluminantSequentialDefaultLuminance);
+    _saturation_changer->setValue(ColorMap::IsoluminantSequentialDefaultSaturation);
+    _hue_changer->setValue(qRadiansToDegrees(ColorMap::IsoluminantSequentialDefaultHue));
+    _update_lock = false;
+    update();
+}
+
+QVector<QColor> ColorMapIsoluminantSequentialWidget::colorMap() const
+{
+    int n;
+    float l, s, h;
+    parameters(n, l, s, h);
+    QVector<unsigned char> colormap(3 * n);
+    ColorMap::IsoluminantSequential(n, colormap.data(), l, s, h);
+    return toQColor(colormap);
+}
+
+QString ColorMapIsoluminantSequentialWidget::reference() const
+{
+    return isoluminant_reference;
+}
+
+void ColorMapIsoluminantSequentialWidget::parameters(int& n, float& luminance, float& saturation, float& hue) const
+{
+    n = _n_spinbox->value();
+    luminance = _luminance_changer->value();
+    saturation = _saturation_changer->value();
+    hue = qDegreesToRadians(_hue_changer->value());
+}
+
+void ColorMapIsoluminantSequentialWidget::update()
+{
+    if (!_update_lock)
+        emit colorMapChanged();
+}
+
+/* ColorMapIsoluminantDivergingWidget */
+
+ColorMapIsoluminantDivergingWidget::ColorMapIsoluminantDivergingWidget() :
+    _update_lock(false)
+{
+    QGridLayout *layout = new QGridLayout;
+
+    QLabel* n_label = new QLabel("Colors:");
+    layout->addWidget(n_label, 1, 0);
+    _n_spinbox = new QSpinBox();
+    _n_spinbox->setRange(2, 1024);
+    _n_spinbox->setSingleStep(1);
+    layout->addWidget(_n_spinbox, 1, 1, 1, 3);
+
+    QLabel* luminance_label = new QLabel("Luminance:");
+    layout->addWidget(luminance_label, 2, 0);
+    _luminance_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_luminance_changer->slider, 2, 1, 1, 2);
+    layout->addWidget(_luminance_changer->spinbox, 2, 3);
+
+    QLabel* saturation_label = new QLabel("Saturation:");
+    layout->addWidget(saturation_label, 3, 0);
+    _saturation_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_saturation_changer->slider, 3, 1, 1, 2);
+    layout->addWidget(_saturation_changer->spinbox, 3, 3);
+
+    QLabel* hue_label = new QLabel("Hue:");
+    layout->addWidget(hue_label, 4, 0);
+    _hue_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(_hue_changer->slider, 4, 1, 1, 2);
+    layout->addWidget(_hue_changer->spinbox, 4, 3);
+
+    QLabel* divergence_label = new QLabel("Divergence:");
+    layout->addWidget(divergence_label, 5, 0);
+    _divergence_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(_divergence_changer->slider, 5, 1, 1, 2);
+    layout->addWidget(_divergence_changer->spinbox, 5, 3);
+
+    layout->setColumnStretch(1, 1);
+    layout->addItem(new QSpacerItem(0, 0), 6, 0, 1, 4);
+    layout->setRowStretch(6, 1);
+    setLayout(layout);
+
+    connect(_n_spinbox, SIGNAL(valueChanged(int)), this, SLOT(update()));
+    connect(_luminance_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_saturation_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_hue_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_divergence_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    reset();
+}
+
+ColorMapIsoluminantDivergingWidget::~ColorMapIsoluminantDivergingWidget()
+{
+}
+
+void ColorMapIsoluminantDivergingWidget::reset()
+{
+    _update_lock = true;
+    _n_spinbox->setValue(257);
+    _luminance_changer->setValue(ColorMap::IsoluminantDivergingDefaultLuminance);
+    _saturation_changer->setValue(ColorMap::IsoluminantDivergingDefaultSaturation);
+    _hue_changer->setValue(qRadiansToDegrees(ColorMap::IsoluminantDivergingDefaultHue));
+    _divergence_changer->setValue(qRadiansToDegrees(ColorMap::IsoluminantDivergingDefaultDivergence));
+    _update_lock = false;
+    update();
+}
+
+QVector<QColor> ColorMapIsoluminantDivergingWidget::colorMap() const
+{
+    int n;
+    float l, s, h, d;
+    parameters(n, l, s, h, d);
+    QVector<unsigned char> colormap(3 * n);
+    ColorMap::IsoluminantDiverging(n, colormap.data(), l, s, h, d);
+    return toQColor(colormap);
+}
+
+QString ColorMapIsoluminantDivergingWidget::reference() const
+{
+    return isoluminant_reference;
+}
+
+void ColorMapIsoluminantDivergingWidget::parameters(int& n, float& luminance, float& saturation, float& hue, float& divergence) const
+{
+    n = _n_spinbox->value();
+    luminance = _luminance_changer->value();
+    saturation = _saturation_changer->value();
+    hue = qDegreesToRadians(_hue_changer->value());
+    divergence = qDegreesToRadians(_divergence_changer->value());
+}
+
+void ColorMapIsoluminantDivergingWidget::update()
+{
+    if (!_update_lock)
+        emit colorMapChanged();
+}
+
+/* ColorMapIsoluminantQualitativeWidget */
+
+ColorMapIsoluminantQualitativeWidget::ColorMapIsoluminantQualitativeWidget() :
+    _update_lock(false)
+{
+    QGridLayout *layout = new QGridLayout;
+
+    QLabel* n_label = new QLabel("Colors:");
+    layout->addWidget(n_label, 1, 0);
+    _n_spinbox = new QSpinBox();
+    _n_spinbox->setRange(2, 1024);
+    _n_spinbox->setSingleStep(1);
+    layout->addWidget(_n_spinbox, 1, 1, 1, 3);
+
+    QLabel* luminance_label = new QLabel("Luminance:");
+    layout->addWidget(luminance_label, 2, 0);
+    _luminance_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_luminance_changer->slider, 2, 1, 1, 2);
+    layout->addWidget(_luminance_changer->spinbox, 2, 3);
+
+    QLabel* saturation_label = new QLabel("Saturation:");
+    layout->addWidget(saturation_label, 3, 0);
+    _saturation_changer = new ColorMapCombinedSliderSpinBox(0, 1, 0.01f);
+    layout->addWidget(_saturation_changer->slider, 3, 1, 1, 2);
+    layout->addWidget(_saturation_changer->spinbox, 3, 3);
+
+    QLabel* hue_label = new QLabel("Hue:");
+    layout->addWidget(hue_label, 4, 0);
+    _hue_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(_hue_changer->slider, 4, 1, 1, 2);
+    layout->addWidget(_hue_changer->spinbox, 4, 3);
+
+    QLabel* divergence_label = new QLabel("Divergence:");
+    layout->addWidget(divergence_label, 5, 0);
+    _divergence_changer = new ColorMapCombinedSliderSpinBox(0, 360, 1);
+    layout->addWidget(_divergence_changer->slider, 5, 1, 1, 2);
+    layout->addWidget(_divergence_changer->spinbox, 5, 3);
+
+    layout->setColumnStretch(1, 1);
+    layout->addItem(new QSpacerItem(0, 0), 6, 0, 1, 4);
+    layout->setRowStretch(6, 1);
+    setLayout(layout);
+
+    connect(_n_spinbox, SIGNAL(valueChanged(int)), this, SLOT(update()));
+    connect(_luminance_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_saturation_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_hue_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    connect(_divergence_changer, SIGNAL(valueChanged(float)), this, SLOT(update()));
+    reset();
+}
+
+ColorMapIsoluminantQualitativeWidget::~ColorMapIsoluminantQualitativeWidget()
+{
+}
+
+void ColorMapIsoluminantQualitativeWidget::reset()
+{
+    _update_lock = true;
+    _n_spinbox->setValue(9);
+    _luminance_changer->setValue(ColorMap::IsoluminantQualitativeDefaultLuminance);
+    _saturation_changer->setValue(ColorMap::IsoluminantQualitativeDefaultSaturation);
+    _hue_changer->setValue(qRadiansToDegrees(ColorMap::IsoluminantQualitativeDefaultHue));
+    _divergence_changer->setValue(qRadiansToDegrees(ColorMap::IsoluminantQualitativeDefaultDivergence));
+    _update_lock = false;
+    update();
+}
+
+QVector<QColor> ColorMapIsoluminantQualitativeWidget::colorMap() const
+{
+    int n;
+    float l, s, h, d;
+    parameters(n, l, s, h, d);
+    QVector<unsigned char> colormap(3 * n);
+    ColorMap::IsoluminantQualitative(n, colormap.data(), l, s, h, d);
+    return toQColor(colormap);
+}
+
+QString ColorMapIsoluminantQualitativeWidget::reference() const
+{
+    return isoluminant_reference;
+}
+
+void ColorMapIsoluminantQualitativeWidget::parameters(int& n, float& luminance, float& saturation, float& hue, float& divergence) const
+{
+    n = _n_spinbox->value();
+    luminance = _luminance_changer->value();
+    saturation = _saturation_changer->value();
+    hue = qDegreesToRadians(_hue_changer->value());
+    divergence = qDegreesToRadians(_divergence_changer->value());
+}
+
+void ColorMapIsoluminantQualitativeWidget::update()
+{
+    if (!_update_lock)
+        emit colorMapChanged();
+}
+
+/* ColorMapCubeHelixWidget */
+
 ColorMapCubeHelixWidget::ColorMapCubeHelixWidget() :
     _update_lock(false)
 {
@@ -614,7 +913,9 @@ void ColorMapCubeHelixWidget::update()
         emit colorMapChanged();
 }
 
-ColorMapMorelandDivergingWidget::ColorMapMorelandDivergingWidget() :
+/* ColorMapMorelandWidget */
+
+ColorMapMorelandWidget::ColorMapMorelandWidget() :
     _update_lock(false)
 {
     QGridLayout *layout = new QGridLayout;
@@ -647,7 +948,7 @@ ColorMapMorelandDivergingWidget::ColorMapMorelandDivergingWidget() :
     reset();
 }
 
-ColorMapMorelandDivergingWidget::~ColorMapMorelandDivergingWidget()
+ColorMapMorelandWidget::~ColorMapMorelandWidget()
 {
 }
 
@@ -663,7 +964,7 @@ static QColor getButtonColor(QPushButton* button)
     return button->icon().pixmap(1, 1).toImage().pixel(0, 0);
 }
 
-void ColorMapMorelandDivergingWidget::chooseColor0()
+void ColorMapMorelandWidget::chooseColor0()
 {
     QColor c = QColorDialog::getColor(getButtonColor(_color0_button), this);
     if (c.isValid()) {
@@ -672,7 +973,7 @@ void ColorMapMorelandDivergingWidget::chooseColor0()
     }
 }
 
-void ColorMapMorelandDivergingWidget::chooseColor1()
+void ColorMapMorelandWidget::chooseColor1()
 {
     QColor c = QColorDialog::getColor(getButtonColor(_color1_button), this);
     if (c.isValid()) {
@@ -681,38 +982,38 @@ void ColorMapMorelandDivergingWidget::chooseColor1()
     }
 }
 
-void ColorMapMorelandDivergingWidget::reset()
+void ColorMapMorelandWidget::reset()
 {
     _update_lock = true;
-    _n_spinbox->setValue(256);
+    _n_spinbox->setValue(257);
     setButtonColor(_color0_button, QColor(
-                ColorMap::MorelandDivergingDefaultR0,
-                ColorMap::MorelandDivergingDefaultG0,
-                ColorMap::MorelandDivergingDefaultB0));
+                ColorMap::MorelandDefaultR0,
+                ColorMap::MorelandDefaultG0,
+                ColorMap::MorelandDefaultB0));
     setButtonColor(_color1_button, QColor(
-                ColorMap::MorelandDivergingDefaultR1,
-                ColorMap::MorelandDivergingDefaultG1,
-                ColorMap::MorelandDivergingDefaultB1));
+                ColorMap::MorelandDefaultR1,
+                ColorMap::MorelandDefaultG1,
+                ColorMap::MorelandDefaultB1));
     _update_lock = false;
     update();
 }
 
-QVector<QColor> ColorMapMorelandDivergingWidget::colorMap() const
+QVector<QColor> ColorMapMorelandWidget::colorMap() const
 {
     int n;
     unsigned char r0, g0, b0, r1, g1, b1;
     parameters(n, r0, g0, b0, r1, g1, b1);
     QVector<unsigned char> colormap(3 * n);
-    ColorMap::MorelandDiverging(n, colormap.data(), r0, g0, b0, r1, g1, b1);
+    ColorMap::Moreland(n, colormap.data(), r0, g0, b0, r1, g1, b1);
     return toQColor(colormap);
 }
 
-QString ColorMapMorelandDivergingWidget::reference() const
+QString ColorMapMorelandWidget::reference() const
 {
     return moreland_reference;
 }
 
-void ColorMapMorelandDivergingWidget::parameters(int& n,
+void ColorMapMorelandWidget::parameters(int& n,
         unsigned char& r0, unsigned char& g0, unsigned char& b0,
         unsigned char& r1, unsigned char& g1, unsigned char& b1) const
 {
@@ -727,13 +1028,15 @@ void ColorMapMorelandDivergingWidget::parameters(int& n,
     b1 = c1.blue();
 }
 
-void ColorMapMorelandDivergingWidget::update()
+void ColorMapMorelandWidget::update()
 {
     if (!_update_lock)
         emit colorMapChanged();
 }
 
-ColorMapMcNamesSequentialWidget::ColorMapMcNamesSequentialWidget() :
+/* ColorMapMcNamesWidget */
+
+ColorMapMcNamesWidget::ColorMapMcNamesWidget() :
     _update_lock(false)
 {
     QGridLayout *layout = new QGridLayout;
@@ -761,41 +1064,41 @@ ColorMapMcNamesSequentialWidget::ColorMapMcNamesSequentialWidget() :
     reset();
 }
 
-ColorMapMcNamesSequentialWidget::~ColorMapMcNamesSequentialWidget()
+ColorMapMcNamesWidget::~ColorMapMcNamesWidget()
 {
 }
 
-void ColorMapMcNamesSequentialWidget::reset()
+void ColorMapMcNamesWidget::reset()
 {
     _update_lock = true;
     _n_spinbox->setValue(256);
-    _periods_changer->setValue(ColorMap::McNamesSequentialDefaultPeriods);
+    _periods_changer->setValue(ColorMap::McNamesDefaultPeriods);
     _update_lock = false;
     update();
 }
 
-QVector<QColor> ColorMapMcNamesSequentialWidget::colorMap() const
+QVector<QColor> ColorMapMcNamesWidget::colorMap() const
 {
     int n;
     float p;
     parameters(n, p);
     QVector<unsigned char> colormap(3 * n);
-    ColorMap::McNamesSequential(n, colormap.data(), p);
+    ColorMap::McNames(n, colormap.data(), p);
     return toQColor(colormap);
 }
 
-QString ColorMapMcNamesSequentialWidget::reference() const
+QString ColorMapMcNamesWidget::reference() const
 {
     return mcnames_references;
 }
 
-void ColorMapMcNamesSequentialWidget::parameters(int& n, float& p) const
+void ColorMapMcNamesWidget::parameters(int& n, float& p) const
 {
     n = _n_spinbox->value();
     p = _periods_changer->value();
 }
 
-void ColorMapMcNamesSequentialWidget::update()
+void ColorMapMcNamesWidget::update()
 {
     if (!_update_lock)
         emit colorMapChanged();
index b2516d6..c2b67ac 100644 (file)
@@ -160,6 +160,74 @@ public:
             float& contrast, float& saturation, float& brightness) const;
 };
 
+class ColorMapIsoluminantSequentialWidget : public ColorMapWidget
+{
+Q_OBJECT
+private:
+    bool _update_lock;
+    QSpinBox* _n_spinbox;
+    ColorMapCombinedSliderSpinBox* _luminance_changer;
+    ColorMapCombinedSliderSpinBox* _saturation_changer;
+    ColorMapCombinedSliderSpinBox* _hue_changer;
+private slots:
+    void update();
+
+public:
+    ColorMapIsoluminantSequentialWidget();
+    ~ColorMapIsoluminantSequentialWidget();
+
+    void reset() override;
+    QVector<QColor> colorMap() const override;
+    QString reference() const override;
+    void parameters(int& n, float& luminance, float& saturation, float& hue) const;
+};
+
+class ColorMapIsoluminantDivergingWidget : public ColorMapWidget
+{
+Q_OBJECT
+private:
+    bool _update_lock;
+    QSpinBox* _n_spinbox;
+    ColorMapCombinedSliderSpinBox* _luminance_changer;
+    ColorMapCombinedSliderSpinBox* _saturation_changer;
+    ColorMapCombinedSliderSpinBox* _hue_changer;
+    ColorMapCombinedSliderSpinBox* _divergence_changer;
+private slots:
+    void update();
+
+public:
+    ColorMapIsoluminantDivergingWidget();
+    ~ColorMapIsoluminantDivergingWidget();
+
+    void reset() override;
+    QVector<QColor> colorMap() const override;
+    QString reference() const override;
+    void parameters(int& n, float& luminance, float& saturation, float& hue, float& divergence) const;
+};
+
+class ColorMapIsoluminantQualitativeWidget : public ColorMapWidget
+{
+Q_OBJECT
+private:
+    bool _update_lock;
+    QSpinBox* _n_spinbox;
+    ColorMapCombinedSliderSpinBox* _luminance_changer;
+    ColorMapCombinedSliderSpinBox* _saturation_changer;
+    ColorMapCombinedSliderSpinBox* _hue_changer;
+    ColorMapCombinedSliderSpinBox* _divergence_changer;
+private slots:
+    void update();
+
+public:
+    ColorMapIsoluminantQualitativeWidget();
+    ~ColorMapIsoluminantQualitativeWidget();
+
+    void reset() override;
+    QVector<QColor> colorMap() const override;
+    QString reference() const override;
+    void parameters(int& n, float& luminance, float& saturation, float& hue, float& divergence) const;
+};
+
 class ColorMapCubeHelixWidget : public ColorMapWidget
 {
 Q_OBJECT
@@ -184,7 +252,7 @@ public:
             float& saturation, float& gamma) const;
 };
 
-class ColorMapMorelandDivergingWidget : public ColorMapWidget
+class ColorMapMorelandWidget : public ColorMapWidget
 {
 Q_OBJECT
 private:
@@ -198,8 +266,8 @@ private slots:
     void update();
 
 public:
-    ColorMapMorelandDivergingWidget();
-    ~ColorMapMorelandDivergingWidget();
+    ColorMapMorelandWidget();
+    ~ColorMapMorelandWidget();
 
     void reset() override;
     QVector<QColor> colorMap() const override;
@@ -209,7 +277,7 @@ public:
             unsigned char& r1, unsigned char& g1, unsigned char& b1) const;
 };
 
-class ColorMapMcNamesSequentialWidget : public ColorMapWidget
+class ColorMapMcNamesWidget : public ColorMapWidget
 {
 Q_OBJECT
 private:
@@ -220,8 +288,8 @@ private slots:
     void update();
 
 public:
-    ColorMapMcNamesSequentialWidget();
-    ~ColorMapMcNamesSequentialWidget();
+    ColorMapMcNamesWidget();
+    ~ColorMapMcNamesWidget();
 
     void reset() override;
     QVector<QColor> colorMap() const override;
diff --git a/gui.cpp b/gui.cpp
index 33e75f2..62def2a 100644 (file)
--- a/gui.cpp
+++ b/gui.cpp
@@ -46,15 +46,21 @@ GUI::GUI()
     _brewerseq_widget = new ColorMapBrewerSequentialWidget;
     _brewerdiv_widget = new ColorMapBrewerDivergingWidget;
     _brewerqual_widget = new ColorMapBrewerQualitativeWidget;
+    _isolumseq_widget = new ColorMapIsoluminantSequentialWidget;
+    _isolumdiv_widget = new ColorMapIsoluminantDivergingWidget;
+    _isolumqual_widget = new ColorMapIsoluminantQualitativeWidget;
     _cubehelix_widget = new ColorMapCubeHelixWidget;
-    _morelanddiv_widget = new ColorMapMorelandDivergingWidget;
-    _mcnamesseq_widget = new ColorMapMcNamesSequentialWidget;
+    _moreland_widget = new ColorMapMorelandWidget;
+    _mcnames_widget = new ColorMapMcNamesWidget;
     connect(_brewerseq_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
     connect(_brewerdiv_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
     connect(_brewerqual_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
+    connect(_isolumseq_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
+    connect(_isolumdiv_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
+    connect(_isolumqual_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
     connect(_cubehelix_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
-    connect(_morelanddiv_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
-    connect(_mcnamesseq_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
+    connect(_moreland_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
+    connect(_mcnames_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
 
     QWidget *widget = new QWidget;
     widget->setMinimumWidth(384 * qApp->devicePixelRatio());
@@ -63,17 +69,20 @@ GUI::GUI()
     _category_widget = new QTabWidget();
     _category_seq_widget = new QTabWidget();
     _category_seq_widget->addTab(_brewerseq_widget, "Brewer-like");
+    _category_seq_widget->addTab(_isolumseq_widget, "Isoluminant");
     _category_seq_widget->addTab(_cubehelix_widget, "CubeHelix");
-    //_category_seq_widget->addTab(_mcnamesseq_widget, "McNames");
+    //_category_seq_widget->addTab(_mcnames_widget, "McNames");
     connect(_category_seq_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
     _category_widget->addTab(_category_seq_widget, "Sequential");
     _category_div_widget = new QTabWidget();
     _category_div_widget->addTab(_brewerdiv_widget, "Brewer-like");
-    _category_div_widget->addTab(_morelanddiv_widget, "Moreland");
+    _category_div_widget->addTab(_isolumdiv_widget, "Isoluminant");
+    _category_div_widget->addTab(_moreland_widget, "Moreland");
     connect(_category_div_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
     _category_widget->addTab(_category_div_widget, "Diverging");
     _category_qual_widget = new QTabWidget();
     _category_qual_widget->addTab(_brewerqual_widget, "Brewer-like");
+    _category_qual_widget->addTab(_isolumqual_widget, "Isoluminant");
     connect(_category_qual_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
     _category_widget->addTab(_category_qual_widget, "Qualitative");
     connect(_category_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
diff --git a/gui.hpp b/gui.hpp
index 15afc05..a6eeb44 100644 (file)
--- a/gui.hpp
+++ b/gui.hpp
@@ -30,9 +30,12 @@ class ColorMapWidget;
 class ColorMapBrewerSequentialWidget;
 class ColorMapBrewerDivergingWidget;
 class ColorMapBrewerQualitativeWidget;
+class ColorMapIsoluminantSequentialWidget;
+class ColorMapIsoluminantDivergingWidget;
+class ColorMapIsoluminantQualitativeWidget;
 class ColorMapCubeHelixWidget;
-class ColorMapMorelandDivergingWidget;
-class ColorMapMcNamesSequentialWidget;
+class ColorMapMorelandWidget;
+class ColorMapMcNamesWidget;
 class QTabWidget;
 class QLabel;
 
@@ -49,9 +52,12 @@ private:
     ColorMapBrewerSequentialWidget* _brewerseq_widget;
     ColorMapBrewerDivergingWidget* _brewerdiv_widget;
     ColorMapBrewerQualitativeWidget* _brewerqual_widget;
+    ColorMapIsoluminantSequentialWidget* _isolumseq_widget;
+    ColorMapIsoluminantDivergingWidget* _isolumdiv_widget;
+    ColorMapIsoluminantQualitativeWidget* _isolumqual_widget;
     ColorMapCubeHelixWidget* _cubehelix_widget;
-    ColorMapMorelandDivergingWidget* _morelanddiv_widget;
-    ColorMapMcNamesSequentialWidget* _mcnamesseq_widget;
+    ColorMapMorelandWidget* _moreland_widget;
+    ColorMapMcNamesWidget* _mcnames_widget;
     QTabWidget* _category_widget;
     QTabWidget* _category_seq_widget;
     QTabWidget* _category_div_widget;
index 533378e..78ef651 100644 (file)
Binary files a/screenshot.png and b/screenshot.png differ