diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-10-20 21:58:13 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-10-20 21:58:13 +0300 |
| commit | a568a2bbf457283717440ecf8711e87db7a4201e (patch) | |
| tree | cf491c9d08b7355d241b0e79a5f3de9a2dc80eb3 /src | |
| parent | d445fd00976fa3ce7ce2eda4d18e9b489a78aa67 (diff) | |
Add 'hot' and 'inferno' colormaps.
Make 'inferno' default.
Diffstat (limited to 'src')
| -rw-r--r-- | src/color-map.cpp | 45 | ||||
| -rw-r--r-- | src/color-map.hpp | 24 | ||||
| -rw-r--r-- | src/configuration.cpp | 8 |
3 files changed, 73 insertions, 4 deletions
diff --git a/src/color-map.cpp b/src/color-map.cpp index 7bf7e4e..3b51af1 100644 --- a/src/color-map.cpp +++ b/src/color-map.cpp @@ -20,6 +20,12 @@ ColorMap::Build(ColorMapType type, const sf::Color& bg_color, const sf::Color& c case ColorMapType::kJet: return std::make_unique<JetColorMap>(); + case ColorMapType::kHot: + return std::make_unique<HotColorMap>(); + + case ColorMapType::kInferno: + return std::make_unique<InfernoColorMap>(); + case ColorMapType::kGray: return std::make_unique<TwoColorMap>(sf::Color::Black, sf::Color::White); @@ -150,4 +156,41 @@ JetColorMap::JetColorMap() : InterpolationColorMap( { 0.0f, 1.0f / 9.0f, 23.0f / 63.0f, 13.0f / 21.0f, 47.0f / 63.0f, 55.0 / 63.0, 1.0f } ) { -}
\ No newline at end of file +} + +HotColorMap::HotColorMap() : InterpolationColorMap( + { + sf::Color(0, 0, 0, 255), + sf::Color(255, 0, 0, 255), + sf::Color(255, 255, 0, 255), + sf::Color(255, 255, 255, 255), + }, + { 0.0f, 1.0f / 3.0f, 2.0f / 3.0f, 1.0f } + ) +{ +} + +InfernoColorMap::InfernoColorMap() : InterpolationColorMap( + { + sf::Color(0, 0, 0, 255), + sf::Color(40, 11, 84, 255), + sf::Color(101, 21, 110, 255), + sf::Color(159, 42, 99, 255), + sf::Color(212, 72, 66, 255), + sf::Color(245, 125, 21, 255), + sf::Color(250, 193, 39, 255), + sf::Color(252, 255, 164, 255), + }, + { + 0.0f, + 0.142857142857143f, + 0.285714285714286f, + 0.428571428571429f, + 0.571428571428571f, + 0.714285714285714f, + 0.857142857142857f, + 1.0f + } + ) +{ +} diff --git a/src/color-map.hpp b/src/color-map.hpp index f466923..dd0072d 100644 --- a/src/color-map.hpp +++ b/src/color-map.hpp @@ -19,6 +19,12 @@ enum class ColorMapType { /* MATLAB jet map */ kJet, + /* Hot */ + kHot, + + /* Inferno */ + kInferno, + /* bicolor maps */ kGray, kPurple, @@ -135,4 +141,20 @@ public: JetColorMap(); }; -#endif
\ No newline at end of file +/** + * Hot colormap + */ +class HotColorMap : public InterpolationColorMap { +public: + HotColorMap(); +}; + +/** + * Inferno colormap + */ +class InfernoColorMap: public InterpolationColorMap { +public: + InfernoColorMap(); +}; + +#endif diff --git a/src/configuration.cpp b/src/configuration.cpp index 00e6bdd..7fdcdb5 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -41,7 +41,7 @@ Configuration::Configuration() this->scale_unit_ = "FS"; this->scale_lower_bound_ = -120.0f; this->scale_upper_bound_ = 0.0f; - this->color_map_ = ColorMapType::kJet; + this->color_map_ = ColorMapType::kInferno; this->background_color_ = sf::Color(0, 0, 0); this->foreground_color_ = sf::Color(255, 255, 255); this->has_axes_ = false; @@ -196,7 +196,7 @@ Configuration::Build(int argc, const char **argv) args::ValueFlag<std::string> scale(display_opts, "string", "Display scale (default: dBFS,-120,0)", {'s', "scale"}); args::ValueFlag<std::string> - colormap(display_opts, "string", "Colormap (default: jet)", {'c', "colormap"}); + colormap(display_opts, "string", "Colormap (default: inferno)", {'c', "colormap"}); args::ValueFlag<std::string> bgcolor(display_opts, "string", "Background color (default: 000000)", {"bg-color"}); args::ValueFlag<std::string> @@ -429,6 +429,10 @@ Configuration::Build(int argc, const char **argv) conf.color_map_ = ColorMapType::kGray; } else if (cmap_str == "jet") { conf.color_map_ = ColorMapType::kJet; + } else if (cmap_str == "hot") { + conf.color_map_ = ColorMapType::kHot; + } else if (cmap_str == "inferno") { + conf.color_map_ = ColorMapType::kInferno; } else if (cmap_str == "purple") { conf.color_map_ = ColorMapType::kPurple; } else if (cmap_str == "blue") { |
