HighMap library (C++)
Loading...
Searching...
No Matches
colormaps.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
15#pragma once
16#include <map>
17#include <string>
18#include <vector>
19
20namespace hmap
21{
22
95
112static std::map<Cmap, std::string> cmap_as_string = {
113 {BONE, "bone"},
114 {GRAY, "gray"},
115 {HOT, "hot"},
116 {INFERNO, "inferno"},
117 {JET, "jet"},
118 {MAGMA, "magma"},
119 {NIPY_SPECTRAL, "nipy_spectral"},
120 {SEISMIC, "seismic"},
121 {TERRAIN, "terrain"},
122 {TURBO, "turbo"},
123 {VIRIDIS, "viridis"},
124 {WHITE_UNIFORM, "white_uniform"}};
125
126#define CMAP_BONE \
127 { \
128 {0.000f, 0.000f, 0.000f}, {0.058f, 0.058f, 0.081f}, \
129 {0.117f, 0.117f, 0.162f}, {0.175f, 0.175f, 0.243f}, \
130 {0.233f, 0.233f, 0.325f}, {0.292f, 0.292f, 0.406f}, \
131 {0.350f, 0.361f, 0.475f}, {0.408f, 0.442f, 0.533f}, \
132 {0.467f, 0.522f, 0.592f}, {0.525f, 0.602f, 0.650f}, \
133 {0.583f, 0.682f, 0.708f}, {0.642f, 0.762f, 0.767f}, \
134 {0.727f, 0.825f, 0.825f}, {0.818f, 0.883f, 0.883f}, \
135 {0.909f, 0.942f, 0.942f}, {1.000f, 1.000f, 1.000f}, \
136 }
137
138#define CMAP_GRAY \
139 { \
140 {0.000f, 0.000f, 0.000f}, {0.067f, 0.067f, 0.067f}, \
141 {0.133f, 0.133f, 0.133f}, {0.200f, 0.200f, 0.200f}, \
142 {0.267f, 0.267f, 0.267f}, {0.333f, 0.333f, 0.333f}, \
143 {0.400f, 0.400f, 0.400f}, {0.467f, 0.467f, 0.467f}, \
144 {0.533f, 0.533f, 0.533f}, {0.600f, 0.600f, 0.600f}, \
145 {0.667f, 0.667f, 0.667f}, {0.733f, 0.733f, 0.733f}, \
146 {0.800f, 0.800f, 0.800f}, {0.867f, 0.867f, 0.867f}, \
147 {0.933f, 0.933f, 0.933f}, {1.000f, 1.000f, 1.000f}, \
148 }
149
150#define CMAP_HOT \
151 { \
152 {0.042f, 0.000f, 0.000f}, {0.217f, 0.000f, 0.000f}, \
153 {0.392f, 0.000f, 0.000f}, {0.567f, 0.000f, 0.000f}, \
154 {0.742f, 0.000f, 0.000f}, {0.917f, 0.000f, 0.000f}, \
155 {1.000f, 0.092f, 0.000f}, {1.000f, 0.267f, 0.000f}, \
156 {1.000f, 0.442f, 0.000f}, {1.000f, 0.617f, 0.000f}, \
157 {1.000f, 0.792f, 0.000f}, {1.000f, 0.967f, 0.000f}, \
158 {1.000f, 1.000f, 0.212f}, {1.000f, 1.000f, 0.475f}, \
159 {1.000f, 1.000f, 0.737f}, {1.000f, 1.000f, 1.000f}, \
160 }
161
162#define CMAP_INFERNO \
163 { \
164 {0.001f, 0.000f, 0.014f}, {0.047f, 0.030f, 0.150f}, \
165 {0.142f, 0.046f, 0.309f}, {0.258f, 0.039f, 0.406f}, \
166 {0.367f, 0.072f, 0.432f}, {0.472f, 0.111f, 0.428f}, \
167 {0.578f, 0.148f, 0.404f}, {0.683f, 0.190f, 0.361f}, \
168 {0.781f, 0.243f, 0.300f}, {0.865f, 0.317f, 0.226f}, \
169 {0.930f, 0.411f, 0.145f}, {0.971f, 0.523f, 0.058f}, \
170 {0.988f, 0.645f, 0.040f}, {0.979f, 0.775f, 0.176f}, \
171 {0.950f, 0.903f, 0.380f}, {0.988f, 0.998f, 0.645f}, \
172 }
173
174#define CMAP_JET \
175 { \
176 {0.000f, 0.000f, 0.500f}, {0.000f, 0.000f, 0.803f}, \
177 {0.000f, 0.033f, 1.000f}, {0.000f, 0.300f, 1.000f}, \
178 {0.000f, 0.567f, 1.000f}, {0.000f, 0.833f, 1.000f}, \
179 {0.161f, 1.000f, 0.806f}, {0.376f, 1.000f, 0.591f}, \
180 {0.591f, 1.000f, 0.376f}, {0.806f, 1.000f, 0.161f}, \
181 {1.000f, 0.901f, 0.000f}, {1.000f, 0.654f, 0.000f}, \
182 {1.000f, 0.407f, 0.000f}, {1.000f, 0.160f, 0.000f}, \
183 {0.803f, 0.000f, 0.000f}, {0.500f, 0.000f, 0.000f}, \
184 }
185
186#define CMAP_MAGMA \
187 { \
188 {0.001f, 0.000f, 0.014f}, {0.044f, 0.034f, 0.142f}, \
189 {0.124f, 0.067f, 0.296f}, {0.232f, 0.060f, 0.438f}, \
190 {0.341f, 0.081f, 0.493f}, {0.445f, 0.123f, 0.507f}, \
191 {0.550f, 0.161f, 0.506f}, {0.658f, 0.196f, 0.490f}, \
192 {0.767f, 0.234f, 0.458f}, {0.869f, 0.288f, 0.409f}, \
193 {0.944f, 0.378f, 0.365f}, {0.981f, 0.498f, 0.370f}, \
194 {0.995f, 0.624f, 0.427f}, {0.997f, 0.748f, 0.517f}, \
195 {0.993f, 0.870f, 0.626f}, {0.987f, 0.991f, 0.750f}, \
196 }
197
198#define CMAP_NIPY_SPECTRAL \
199 { \
200 {0.000f, 0.000f, 0.000f}, {0.489f, 0.000f, 0.556f}, \
201 {0.178f, 0.000f, 0.644f}, {0.000f, 0.000f, 0.867f}, \
202 {0.000f, 0.511f, 0.867f}, {0.000f, 0.644f, 0.733f}, \
203 {0.000f, 0.667f, 0.533f}, {0.000f, 0.644f, 0.000f}, \
204 {0.000f, 0.822f, 0.000f}, {0.000f, 1.000f, 0.000f}, \
205 {0.800f, 0.978f, 0.000f}, {0.978f, 0.844f, 0.000f}, \
206 {1.000f, 0.600f, 0.000f}, {0.956f, 0.000f, 0.000f}, \
207 {0.822f, 0.000f, 0.000f}, {0.800f, 0.800f, 0.800f}, \
208 }
209
210#define CMAP_SEISMIC \
211 { \
212 {0.000f, 0.000f, 0.300f}, {0.000f, 0.000f, 0.487f}, \
213 {0.000f, 0.000f, 0.673f}, {0.000f, 0.000f, 0.860f}, \
214 {0.067f, 0.067f, 1.000f}, {0.333f, 0.333f, 1.000f}, \
215 {0.600f, 0.600f, 1.000f}, {0.867f, 0.867f, 1.000f}, \
216 {1.000f, 0.867f, 0.867f}, {1.000f, 0.600f, 0.600f}, \
217 {1.000f, 0.333f, 0.333f}, {1.000f, 0.067f, 0.067f}, \
218 {0.900f, 0.000f, 0.000f}, {0.767f, 0.000f, 0.000f}, \
219 {0.633f, 0.000f, 0.000f}, {0.500f, 0.000f, 0.000f}, \
220 }
221
222#define CMAP_TERRAIN \
223 { \
224 {0.200f, 0.200f, 0.600f}, {0.111f, 0.378f, 0.778f}, \
225 {0.022f, 0.556f, 0.956f}, {0.000f, 0.700f, 0.700f}, \
226 {0.067f, 0.813f, 0.413f}, {0.333f, 0.867f, 0.467f}, \
227 {0.600f, 0.920f, 0.520f}, {0.867f, 0.973f, 0.573f}, \
228 {0.933f, 0.915f, 0.564f}, {0.800f, 0.744f, 0.492f}, \
229 {0.667f, 0.573f, 0.420f}, {0.533f, 0.403f, 0.348f}, \
230 {0.600f, 0.488f, 0.464f}, {0.733f, 0.659f, 0.643f}, \
231 {0.867f, 0.829f, 0.821f}, {1.000f, 1.000f, 1.000f}, \
232 }
233
234#define CMAP_TURBO \
235 { \
236 {0.190f, 0.072f, 0.232f}, {0.267f, 0.328f, 0.764f}, \
237 {0.266f, 0.560f, 0.996f}, {0.127f, 0.780f, 0.876f}, \
238 {0.163f, 0.936f, 0.631f}, {0.489f, 0.998f, 0.338f}, \
239 {0.756f, 0.951f, 0.203f}, {0.945f, 0.796f, 0.228f}, \
240 {0.994f, 0.564f, 0.159f}, {0.916f, 0.305f, 0.051f}, \
241 {0.746f, 0.131f, 0.009f}, {0.480f, 0.016f, 0.011f}, \
242 }
243
244#define CMAP_VIRIDIS \
245 { \
246 {0.267f, 0.005f, 0.329f}, {0.283f, 0.100f, 0.422f}, \
247 {0.277f, 0.185f, 0.490f}, {0.254f, 0.265f, 0.530f}, \
248 {0.222f, 0.339f, 0.549f}, {0.191f, 0.407f, 0.556f}, \
249 {0.164f, 0.471f, 0.558f}, {0.139f, 0.534f, 0.555f}, \
250 {0.121f, 0.596f, 0.544f}, {0.135f, 0.659f, 0.518f}, \
251 {0.208f, 0.719f, 0.473f}, {0.328f, 0.774f, 0.407f}, \
252 {0.478f, 0.821f, 0.318f}, {0.647f, 0.858f, 0.210f}, \
253 {0.825f, 0.885f, 0.106f}, {0.993f, 0.906f, 0.144f}, \
254 }
255
256#define CMAP_WHITE_UNIFORM \
257 { \
258 {1.000f, 1.000f, 1.000f}, {1.000f, 1.000f, 1.000f}, \
259 }
260
261std::vector<std::vector<float>> get_colormap_data(int cmap);
262
263} // namespace hmap
Definition algebra.hpp:28
Cmap
Enumeration for different colormap types.
Definition colormaps.hpp:81
@ VIRIDIS
Definition colormaps.hpp:92
@ GRAY
Definition colormaps.hpp:83
@ HOT
Definition colormaps.hpp:84
@ SEISMIC
Definition colormaps.hpp:89
@ WHITE_UNIFORM
Definition colormaps.hpp:93
@ BONE
Definition colormaps.hpp:82
@ TURBO
Definition colormaps.hpp:91
@ JET
Definition colormaps.hpp:86
@ TERRAIN
Definition colormaps.hpp:90
@ MAGMA
Definition colormaps.hpp:87
@ NIPY_SPECTRAL
Definition colormaps.hpp:88
@ INFERNO
Definition colormaps.hpp:85
std::vector< std::vector< float > > get_colormap_data(int cmap)
Definition get_colormap_data.cpp:11