Skip to content

Commit

Permalink
MODIFIED: simplified palette generation code + added several missing …
Browse files Browse the repository at this point in the history
…derived palettes + legacy names/renames
  • Loading branch information
jkriege2 committed Sep 19, 2023
1 parent 134739c commit 08cc844
Show file tree
Hide file tree
Showing 65 changed files with 334 additions and 1,142 deletions.
Binary file modified doc/images/palettes/palette_AFMhot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_BBlRdYe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_BWprint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_BlGnRd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_BlGnYe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_BlMaYe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_BlYe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_BrGr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_GnRdVi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_GrBr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_HSV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_Matlab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_OrPu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_RYGB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_RdGnBu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_ViRdGn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_YeBl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_YeMaBl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/palettes/palette_YeRdBlB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_bluered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_bluewhitered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_invAFMhot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/palettes/palette_invBWprint.png
Binary file modified doc/images/palettes/palette_invHSV.png
Binary file modified doc/images/palettes/palette_invMatlab.png
Binary file modified doc/images/palettes/palette_invRYGB.png
Binary file added doc/images/palettes/palette_invautumn.png
Binary file modified doc/images/palettes/palette_invblue.png
Binary file added doc/images/palettes/palette_invbone.png
Binary file added doc/images/palettes/palette_invcool.png
Binary file added doc/images/palettes/palette_invcopper.png
Binary file modified doc/images/palettes/palette_invcyan.png
Binary file modified doc/images/palettes/palette_invgray.png
Binary file modified doc/images/palettes/palette_invgreen.png
Binary file modified doc/images/palettes/palette_invmagenta.png
Binary file modified doc/images/palettes/palette_invocean.png
Binary file modified doc/images/palettes/palette_invrainbow.png
Binary file modified doc/images/palettes/palette_invred.png
Binary file added doc/images/palettes/palette_invseismic.png
Binary file added doc/images/palettes/palette_invterrain.png
Binary file modified doc/images/palettes/palette_invtrafficlight.png
Binary file modified doc/images/palettes/palette_invyellow.png
Binary file modified doc/images/palettes/palette_ocean.png
Binary file modified doc/images/palettes/palette_rainbow.png
Binary file modified doc/images/palettes/palette_red.png
Binary file modified doc/images/palettes/palette_redwhiteblue.png
Binary file added doc/images/palettes/palette_stepsBlGnYe.png
Binary file added doc/images/palettes/palette_stepsBrGr.png
Binary file added doc/images/palettes/palette_stepsGrBr.png
Binary file added doc/images/palettes/palette_stepsOrPu.png
Binary file added doc/images/palettes/palette_stepsinvseismic.png
Binary file added doc/images/palettes/palette_stepsinvterrain.png
Binary file added doc/images/palettes/palette_stepsseismic.png
Binary file added doc/images/palettes/palette_stepsterrain.png
Binary file modified doc/images/palettes/palette_trafficlight.png
Binary file modified doc/images/palettes/palette_whitecyan.png
Binary file modified doc/images/palettes/palette_whitemagenta.png
Binary file modified doc/images/palettes/palette_whiteyellow.png
Binary file modified doc/images/palettes/palette_yellowmagenta.png
1,392 changes: 256 additions & 1,136 deletions lib/jkqtcommon/jkqtpbasicimagetools.cpp

Large diffs are not rendered by default.

74 changes: 68 additions & 6 deletions lib/jkqtcommon/jkqtpbasicimagetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,21 @@ enum JKQTPMathImageColorPalette {
JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image html palettes/palette_invtrafficlight.png */

JKQTPMathImageBone, /*!< \image html palettes/palette_bone.png */
JKQTPMathImageINVERTED_Bone, /*!< \image html palettes/palette_invbone.png */
JKQTPMathImageCool, /*!< \image html palettes/palette_cool.png */
JKQTPMathImageINVERTED_Cool, /*!< \image html palettes/palette_invcool.png */
JKQTPMathImageCopper, /*!< \image html palettes/palette_copper.png */
JKQTPMathImageINVERTED_Copper, /*!< \image html palettes/palette_invcopper.png */
JKQTPMathImageAutumn, /*!< \image html palettes/palette_autumn.png */
JKQTPMathImageINVERTED_Autumn, /*!< \image html palettes/palette_invautumn.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_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
\see from https://github.com/BIDS/colormap/blob/master/colormaps.py */
Expand Down Expand Up @@ -233,25 +241,37 @@ enum JKQTPMathImageColorPalette {
JKQTPMathImageREDWHITEBLUE, /*!< \image html palettes/palette_redwhiteblue.png */

JKQTPMathImageBLACKBLUEREDYELLOW, /*!< \image html palettes/palette_BBlRdYe.png */
JKQTPMathImageYELLOWREDBLUEBLACK, /*!< \image html palettes/palette_YeRdBlB.png */
JKQTPMathImageGREENREDVIOLET, /*!< \image html palettes/palette_GnRdVi.png */
JKQTPMathImageVIOLETREDGREEN, /*!< \image html palettes/palette_ViRdGn.png */
JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE, /*!< \image html palettes/palette_BWprint.png */
JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK, /*!< \image html palettes/palette_invBWprint.png */
JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrBG.png */
JKQTPMathImageBrownGreen=JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrBG.png */
JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrGr.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 */
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 */
JKQTPMathImageGreenBlue=JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */
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 */
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 */
JKQTPMathImageOR_PU_STEP, /*!< \image html palettes/palette_stepsOrPu.png */
JKQTPMathImageGN_BU_STEP, /*!< \image html palettes/palette_stepsGnBl.png */
JKQTPMathImageBU_GN_STEP, /*!< \image html palettes/palette_stepsBlGn.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 */
Expand Down Expand Up @@ -577,6 +597,8 @@ struct JKQTPImageTools {
QString name;
/** \brief name for the LUT (localized, human-readable) */
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
Expand Down Expand Up @@ -1102,6 +1124,27 @@ class JKQTCOMMON_LIB_EXPORT JKQTPPaletteList: public QList<QPair<double, QRgb> >
#endif
template <class T>
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>
inline JKQTPPaletteList(InputIterator first, InputIterator last): ListType(first, last) {};
inline JKQTPPaletteList(ListType &&other):ListType(std::forward<ListType>(other)) {};
Expand Down Expand Up @@ -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);

/*! \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
\ingroup jkqtplotter_imagelots_tools_LUTS
Expand Down
10 changes: 10 additions & 0 deletions lib/jkqtcommon/jkqtpmathtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/*! \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

0 comments on commit 08cc844

Please sign in to comment.