MODIFIED: simplified palette generation code + added several missing derived palettes + legacy names/renames

This commit is contained in:
jkriege2 2023-09-19 14:38:01 +02:00
parent 134739c5a5
commit 08cc844343
65 changed files with 392 additions and 1200 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 157 B

File diff suppressed because it is too large Load Diff

View File

@ -112,13 +112,21 @@ enum JKQTPMathImageColorPalette {
JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image html palettes/palette_invtrafficlight.png */ JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image html palettes/palette_invtrafficlight.png */
JKQTPMathImageBone, /*!< \image html palettes/palette_bone.png */ JKQTPMathImageBone, /*!< \image html palettes/palette_bone.png */
JKQTPMathImageINVERTED_Bone, /*!< \image html palettes/palette_invbone.png */
JKQTPMathImageCool, /*!< \image html palettes/palette_cool.png */ JKQTPMathImageCool, /*!< \image html palettes/palette_cool.png */
JKQTPMathImageINVERTED_Cool, /*!< \image html palettes/palette_invcool.png */
JKQTPMathImageCopper, /*!< \image html palettes/palette_copper.png */ JKQTPMathImageCopper, /*!< \image html palettes/palette_copper.png */
JKQTPMathImageINVERTED_Copper, /*!< \image html palettes/palette_invcopper.png */
JKQTPMathImageAutumn, /*!< \image html palettes/palette_autumn.png */ JKQTPMathImageAutumn, /*!< \image html palettes/palette_autumn.png */
JKQTPMathImageINVERTED_Autumn, /*!< \image html palettes/palette_invautumn.png */
JKQTPMathImageSeismic, /*!< \image html palettes/palette_seismic.png */ JKQTPMathImageSeismic, /*!< \image html palettes/palette_seismic.png */
JKQTPMathImageSeismic_STEP, /*!< \image html palettes/palette_seismic_step.png */ JKQTPMathImageSeismic_STEP, /*!< \image html palettes/palette_stepsseismic.png */
JKQTPMathImageINVERTED_Seismic, /*!< \image html palettes/palette_invseismic.png */
JKQTPMathImageINVERTED_Seismic_STEP, /*!< \image html palettes/palette_stepsinvseismic.png */
JKQTPMathImageTerrain, /*!< \image html palettes/palette_terrain.png */ JKQTPMathImageTerrain, /*!< \image html palettes/palette_terrain.png */
JKQTPMathImageTerrain_STEP, /*!< \image html palettes/palette_terrain_step.png */ JKQTPMathImageTerrain_STEP, /*!< \image html palettes/palette_stepsterrain.png */
JKQTPMathImageINVERTED_Terrain, /*!< \image html palettes/palette_invterrain.png */
JKQTPMathImageINVERTED_Terrain_STEP, /*!< \image html palettes/palette_stepsterrain.png */
JKQTPMathImageViridis, /*!< \image html palettes/palette_viridis.png JKQTPMathImageViridis, /*!< \image html palettes/palette_viridis.png
\see from https://github.com/BIDS/colormap/blob/master/colormaps.py */ \see from https://github.com/BIDS/colormap/blob/master/colormaps.py */
@ -233,25 +241,37 @@ enum JKQTPMathImageColorPalette {
JKQTPMathImageREDWHITEBLUE, /*!< \image html palettes/palette_redwhiteblue.png */ JKQTPMathImageREDWHITEBLUE, /*!< \image html palettes/palette_redwhiteblue.png */
JKQTPMathImageBLACKBLUEREDYELLOW, /*!< \image html palettes/palette_BBlRdYe.png */ JKQTPMathImageBLACKBLUEREDYELLOW, /*!< \image html palettes/palette_BBlRdYe.png */
JKQTPMathImageYELLOWREDBLUEBLACK, /*!< \image html palettes/palette_YeRdBlB.png */
JKQTPMathImageGREENREDVIOLET, /*!< \image html palettes/palette_GnRdVi.png */ JKQTPMathImageGREENREDVIOLET, /*!< \image html palettes/palette_GnRdVi.png */
JKQTPMathImageVIOLETREDGREEN, /*!< \image html palettes/palette_ViRdGn.png */
JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE, /*!< \image html palettes/palette_BWprint.png */ JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE, /*!< \image html palettes/palette_BWprint.png */
JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK, /*!< \image html palettes/palette_invBWprint.png */ JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK, /*!< \image html palettes/palette_invBWprint.png */
JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrBG.png */ JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrGr.png */
JKQTPMathImageBrownGreen=JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrBG.png */ JKQTPMathImageBrownGreen=JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrGr.png */
JKQTPMathImageGR_BR, /*!< \image html palettes/palette_GrBr.png */
JKQTPMathImageGreenBrown=JKQTPMathImageGR_BR, /*!< \image html palettes/palette_GrBr.png */
JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */ JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */
JKQTPMathImageOrangeWhitePurple=JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */ JKQTPMathImagePurpleWhiteOrange=JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */
JKQTPMathImageOR_PU, /*!< \image html palettes/palette_OrPu.png */
JKQTPMathImageOrangeWhitePurple=JKQTPMathImageOR_PU, /*!< \image html palettes/palette_OrPu.png */
JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */ JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */
JKQTPMathImageGreenBlue=JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */ JKQTPMathImageGreenBlue=JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */
JKQTPMathImageBU_GN, /*!< \image html palettes/palette_bluegreen.png */ JKQTPMathImageBU_GN, /*!< \image html palettes/palette_bluegreen.png */
JKQTPMathImageBlueGreen=JKQTPMathImageBU_GN, /*!< \image html palettes/palette_bluegreen.png */ JKQTPMathImageBlueGreen=JKQTPMathImageBU_GN, /*!< \image html palettes/palette_bluegreen.png */
JKQTPMathImageYL_GN_BU, /*!< \image html palettes/palette_YeGnBu.png */ JKQTPMathImageYL_GN_BU, /*!< \image html palettes/palette_YeGnBu.png */
JKQTPMathImageYellowGreenBlue=JKQTPMathImageYL_GN_BU, /*!< \image html palettes/palette_YeGnBu.png */ JKQTPMathImageYellowGreenBlue=JKQTPMathImageYL_GN_BU, /*!< \image html palettes/palette_YeGnBu.png */
JKQTPMathImageBU_GN_YL, /*!< \image html palettes/palette_BuGnYe.png */
JKQTPMathImageBU_GN_YE=JKQTPMathImageBU_GN_YL, /*!< \image html palettes/palette_BuGnYe.png */
JKQTPMathImageBlueGreenYellow=JKQTPMathImageBU_GN_YE, /*!< \image html palettes/palette_BuGnYe.png */
JKQTPMathImageBR_GR_STEP, /*!< \image html palettes/palette_stepsBrBG.png */ JKQTPMathImageBR_GR_STEP, /*!< \image html palettes/palette_stepsBrGr.png */
JKQTPMathImageGR_BR_STEP, /*!< \image html palettes/palette_stepsGrBr.png */
JKQTPMathImagePU_OR_STEP, /*!< \image html palettes/palette_stepsPuOr.png */ JKQTPMathImagePU_OR_STEP, /*!< \image html palettes/palette_stepsPuOr.png */
JKQTPMathImageOR_PU_STEP, /*!< \image html palettes/palette_stepsOrPu.png */
JKQTPMathImageGN_BU_STEP, /*!< \image html palettes/palette_stepsGnBl.png */ JKQTPMathImageGN_BU_STEP, /*!< \image html palettes/palette_stepsGnBl.png */
JKQTPMathImageBU_GN_STEP, /*!< \image html palettes/palette_stepsBlGn.png */ JKQTPMathImageBU_GN_STEP, /*!< \image html palettes/palette_stepsBlGn.png */
JKQTPMathImageYL_GN_BU_STEP, /*!< \image html palettes/palette_stepsYeGnBu.png */ JKQTPMathImageYL_GN_BU_STEP, /*!< \image html palettes/palette_stepsYeGnBu.png */
JKQTPMathImageBU_GN_YL_STEP, /*!< \image html palettes/palette_stepsBuGnYe.png */
JKQTPMathImageCYANWHITE, /*!< \image html palettes/palette_cyanwhite.png */ JKQTPMathImageCYANWHITE, /*!< \image html palettes/palette_cyanwhite.png */
@ -577,6 +597,8 @@ struct JKQTPImageTools {
QString name; QString name;
/** \brief name for the LUT (localized, human-readable) */ /** \brief name for the LUT (localized, human-readable) */
QString nameT; QString nameT;
/** \brief legacy (formerly used, but deprecated) name(s) for the LUT (machine-readable) */
QList<QString> legacyNames;
}; };
/*! \brief internal global storage object for lookup-tables /*! \brief internal global storage object for lookup-tables
@ -1102,6 +1124,27 @@ public:
#endif #endif
template <class T> template <class T>
inline JKQTPPaletteList(std::initializer_list<QPair<double, QRgb>> args): ListType(args) {}; inline JKQTPPaletteList(std::initializer_list<QPair<double, QRgb>> args): ListType(args) {};
inline JKQTPPaletteList(std::initializer_list<QRgb> args):
ListType()
{
for(const auto& v: args) {
push_back(v);
}
};
inline JKQTPPaletteList(std::initializer_list<QColor> args):
ListType()
{
for(const auto& v: args) {
push_back(v);
}
};
inline JKQTPPaletteList(std::initializer_list<QPair<double, QColor>> args):
ListType()
{
for(const auto& v: args) {
push_back(v.first, v.second);
}
};
template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true> template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
inline JKQTPPaletteList(InputIterator first, InputIterator last): ListType(first, last) {}; inline JKQTPPaletteList(InputIterator first, InputIterator last): ListType(first, last) {};
inline JKQTPPaletteList(ListType &&other):ListType(std::forward<ListType>(other)) {}; inline JKQTPPaletteList(ListType &&other):ListType(std::forward<ListType>(other)) {};
@ -1281,6 +1324,25 @@ JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInter
*/ */
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const QMap<double, QRgb>& items, int lut_size=JKQTPImageTools::LUTSIZE); JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const QMap<double, QRgb>& items, int lut_size=JKQTPImageTools::LUTSIZE);
/*! \brief Builds a LUT by evaluating \a palFunc(v) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations
\ingroup jkqtplotter_imagelots_tools_LUTS
*/
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<QRgb(float)>& palFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
/*! \brief Builds a LUT by evaluating the triple RGB = ( \a rFunc(v) , \a gFunc(v) , \a bFunc(v) ) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations
\ingroup jkqtplotter_imagelots_tools_LUTS
\note Each function should return a value between 0 and 1. If the values are larger, the are clipped to this range!
*/
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<float(float)>& rFunc, const std::function<float(float)>& gFunc, const std::function<float(float)>& bFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
/*! \brief Builds a LUT by evaluating the quadruple RGBA = ( \a rFunc(v) , \a gFunc(v) , \a bFunc(v) ) for \c v in the range \a vMin ... \a vMax at \a lut_size equally distributed locations.
\ingroup jkqtplotter_imagelots_tools_LUTS
\note Each function should return a value between 0 and 1. If the values are larger, the are clipped to this range!
*/
JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const std::function<float(float)>& rFunc, const std::function<float(float)>& gFunc, const std::function<float(float)>& bFunc, const std::function<float(float)>& aFunc, int lut_size=JKQTPImageTools::LUTSIZE, float vMin=0.0, float vMax=1.0);
/*! \brief takes an existing JKQTPImageTools::LUTType and subsamples \a lut_size elements from it /*! \brief takes an existing JKQTPImageTools::LUTType and subsamples \a lut_size elements from it
\ingroup jkqtplotter_imagelots_tools_LUTS \ingroup jkqtplotter_imagelots_tools_LUTS

View File

@ -539,4 +539,14 @@ JKQTCOMMON_LIB_EXPORT uint64_t jkqtp_gcd(uint64_t a, uint64_t b);
*/ */
JKQTCOMMON_LIB_EXPORT void jkqtp_estimateFraction(double input, int &sign, uint64_t &intpart, uint64_t& num, uint64_t& denom, unsigned int precision=9); JKQTCOMMON_LIB_EXPORT void jkqtp_estimateFraction(double input, int &sign, uint64_t &intpart, uint64_t& num, uint64_t& denom, unsigned int precision=9);
/*! \brief returns the reversed containter \a l
\ingroup jkqtptools_math_basic
*/
template <class T>
inline T jkqtp_reversed(const T& l) {
return T(l.rbegin(), l.rend());
}
#endif // jkqtpmathtools_H_INCLUDED #endif // jkqtpmathtools_H_INCLUDED