diff --git a/doc/images/palettes/palette_AFMhot.png b/doc/images/palettes/palette_AFMhot.png index efe1a336509..bdaa575fa02 100644 Binary files a/doc/images/palettes/palette_AFMhot.png and b/doc/images/palettes/palette_AFMhot.png differ diff --git a/doc/images/palettes/palette_BBlRdYe.png b/doc/images/palettes/palette_BBlRdYe.png index 0c16c21d9b9..502404a7774 100644 Binary files a/doc/images/palettes/palette_BBlRdYe.png and b/doc/images/palettes/palette_BBlRdYe.png differ diff --git a/doc/images/palettes/palette_BWprint.png b/doc/images/palettes/palette_BWprint.png index 250f9e72602..8c8d7d3d8f1 100644 Binary files a/doc/images/palettes/palette_BWprint.png and b/doc/images/palettes/palette_BWprint.png differ diff --git a/doc/images/palettes/palette_BlGnRd.png b/doc/images/palettes/palette_BlGnRd.png new file mode 100644 index 00000000000..fb86e0461d5 Binary files /dev/null and b/doc/images/palettes/palette_BlGnRd.png differ diff --git a/doc/images/palettes/palette_BlGnYe.png b/doc/images/palettes/palette_BlGnYe.png new file mode 100644 index 00000000000..620f65807e1 Binary files /dev/null and b/doc/images/palettes/palette_BlGnYe.png differ diff --git a/doc/images/palettes/palette_BlMaYe.png b/doc/images/palettes/palette_BlMaYe.png index 60822868fbe..2a69932d978 100644 Binary files a/doc/images/palettes/palette_BlMaYe.png and b/doc/images/palettes/palette_BlMaYe.png differ diff --git a/doc/images/palettes/palette_BlYe.png b/doc/images/palettes/palette_BlYe.png index ede1d8874dc..0aef6515ec8 100644 Binary files a/doc/images/palettes/palette_BlYe.png and b/doc/images/palettes/palette_BlYe.png differ diff --git a/doc/images/palettes/palette_BrGr.png b/doc/images/palettes/palette_BrGr.png new file mode 100644 index 00000000000..f9fd5fcaafd Binary files /dev/null and b/doc/images/palettes/palette_BrGr.png differ diff --git a/doc/images/palettes/palette_GnRdVi.png b/doc/images/palettes/palette_GnRdVi.png index aded7241507..9cfff89d968 100644 Binary files a/doc/images/palettes/palette_GnRdVi.png and b/doc/images/palettes/palette_GnRdVi.png differ diff --git a/doc/images/palettes/palette_GrBr.png b/doc/images/palettes/palette_GrBr.png new file mode 100644 index 00000000000..e2982de16fa Binary files /dev/null and b/doc/images/palettes/palette_GrBr.png differ diff --git a/doc/images/palettes/palette_HSV.png b/doc/images/palettes/palette_HSV.png index 4a088736497..a7f8ba5fdd3 100644 Binary files a/doc/images/palettes/palette_HSV.png and b/doc/images/palettes/palette_HSV.png differ diff --git a/doc/images/palettes/palette_Matlab.png b/doc/images/palettes/palette_Matlab.png index 5d24f5890e3..52269c7db89 100644 Binary files a/doc/images/palettes/palette_Matlab.png and b/doc/images/palettes/palette_Matlab.png differ diff --git a/doc/images/palettes/palette_OrPu.png b/doc/images/palettes/palette_OrPu.png new file mode 100644 index 00000000000..5439031f95c Binary files /dev/null and b/doc/images/palettes/palette_OrPu.png differ diff --git a/doc/images/palettes/palette_RYGB.png b/doc/images/palettes/palette_RYGB.png index eba0445ac1f..12bfcc01d81 100644 Binary files a/doc/images/palettes/palette_RYGB.png and b/doc/images/palettes/palette_RYGB.png differ diff --git a/doc/images/palettes/palette_RdGnBu.png b/doc/images/palettes/palette_RdGnBu.png new file mode 100644 index 00000000000..417da493d89 Binary files /dev/null and b/doc/images/palettes/palette_RdGnBu.png differ diff --git a/doc/images/palettes/palette_ViRdGn.png b/doc/images/palettes/palette_ViRdGn.png new file mode 100644 index 00000000000..a4b0cd84f86 Binary files /dev/null and b/doc/images/palettes/palette_ViRdGn.png differ diff --git a/doc/images/palettes/palette_YeBl.png b/doc/images/palettes/palette_YeBl.png index 485ef5db4c7..5d289aecdcf 100644 Binary files a/doc/images/palettes/palette_YeBl.png and b/doc/images/palettes/palette_YeBl.png differ diff --git a/doc/images/palettes/palette_YeMaBl.png b/doc/images/palettes/palette_YeMaBl.png index b44e4527603..f0f4c464815 100644 Binary files a/doc/images/palettes/palette_YeMaBl.png and b/doc/images/palettes/palette_YeMaBl.png differ diff --git a/doc/images/palettes/palette_YeRdBlB.png b/doc/images/palettes/palette_YeRdBlB.png new file mode 100644 index 00000000000..79641a2e701 Binary files /dev/null and b/doc/images/palettes/palette_YeRdBlB.png differ diff --git a/doc/images/palettes/palette_blue.png b/doc/images/palettes/palette_blue.png index 3677203a6ec..8ca74d97410 100644 Binary files a/doc/images/palettes/palette_blue.png and b/doc/images/palettes/palette_blue.png differ diff --git a/doc/images/palettes/palette_bluered.png b/doc/images/palettes/palette_bluered.png index a65af8ae077..6871e708270 100644 Binary files a/doc/images/palettes/palette_bluered.png and b/doc/images/palettes/palette_bluered.png differ diff --git a/doc/images/palettes/palette_bluewhitered.png b/doc/images/palettes/palette_bluewhitered.png index d3d36b4e1fd..1b7216cf7d3 100644 Binary files a/doc/images/palettes/palette_bluewhitered.png and b/doc/images/palettes/palette_bluewhitered.png differ diff --git a/doc/images/palettes/palette_gray.png b/doc/images/palettes/palette_gray.png index 3ae55d04602..4c034f6eb0e 100644 Binary files a/doc/images/palettes/palette_gray.png and b/doc/images/palettes/palette_gray.png differ diff --git a/doc/images/palettes/palette_green.png b/doc/images/palettes/palette_green.png index 6f0694e7041..dbb63cf5143 100644 Binary files a/doc/images/palettes/palette_green.png and b/doc/images/palettes/palette_green.png differ diff --git a/doc/images/palettes/palette_invAFMhot.png b/doc/images/palettes/palette_invAFMhot.png index da21532e213..a8ababa4105 100644 Binary files a/doc/images/palettes/palette_invAFMhot.png and b/doc/images/palettes/palette_invAFMhot.png differ diff --git a/doc/images/palettes/palette_invBWprint.png b/doc/images/palettes/palette_invBWprint.png index 92e15428849..fc1081f2ea0 100644 Binary files a/doc/images/palettes/palette_invBWprint.png and b/doc/images/palettes/palette_invBWprint.png differ diff --git a/doc/images/palettes/palette_invHSV.png b/doc/images/palettes/palette_invHSV.png index 1728ab65bc5..b1942ee78f8 100644 Binary files a/doc/images/palettes/palette_invHSV.png and b/doc/images/palettes/palette_invHSV.png differ diff --git a/doc/images/palettes/palette_invMatlab.png b/doc/images/palettes/palette_invMatlab.png index ba087242d22..96317df26a8 100644 Binary files a/doc/images/palettes/palette_invMatlab.png and b/doc/images/palettes/palette_invMatlab.png differ diff --git a/doc/images/palettes/palette_invRYGB.png b/doc/images/palettes/palette_invRYGB.png index 2768424c007..a6c75ceb004 100644 Binary files a/doc/images/palettes/palette_invRYGB.png and b/doc/images/palettes/palette_invRYGB.png differ diff --git a/doc/images/palettes/palette_invautumn.png b/doc/images/palettes/palette_invautumn.png new file mode 100644 index 00000000000..4034d06c9cd Binary files /dev/null and b/doc/images/palettes/palette_invautumn.png differ diff --git a/doc/images/palettes/palette_invblue.png b/doc/images/palettes/palette_invblue.png index 7c47fdc31dd..cc95f966f72 100644 Binary files a/doc/images/palettes/palette_invblue.png and b/doc/images/palettes/palette_invblue.png differ diff --git a/doc/images/palettes/palette_invbone.png b/doc/images/palettes/palette_invbone.png new file mode 100644 index 00000000000..9541bfeb347 Binary files /dev/null and b/doc/images/palettes/palette_invbone.png differ diff --git a/doc/images/palettes/palette_invcool.png b/doc/images/palettes/palette_invcool.png new file mode 100644 index 00000000000..1690ee22aa1 Binary files /dev/null and b/doc/images/palettes/palette_invcool.png differ diff --git a/doc/images/palettes/palette_invcopper.png b/doc/images/palettes/palette_invcopper.png new file mode 100644 index 00000000000..1a08144ca33 Binary files /dev/null and b/doc/images/palettes/palette_invcopper.png differ diff --git a/doc/images/palettes/palette_invcyan.png b/doc/images/palettes/palette_invcyan.png index 6fe33528dbc..0d54ff8a074 100644 Binary files a/doc/images/palettes/palette_invcyan.png and b/doc/images/palettes/palette_invcyan.png differ diff --git a/doc/images/palettes/palette_invgray.png b/doc/images/palettes/palette_invgray.png index b51fdd8ce0f..b5251f4310e 100644 Binary files a/doc/images/palettes/palette_invgray.png and b/doc/images/palettes/palette_invgray.png differ diff --git a/doc/images/palettes/palette_invgreen.png b/doc/images/palettes/palette_invgreen.png index a37ee494b9e..834639309b7 100644 Binary files a/doc/images/palettes/palette_invgreen.png and b/doc/images/palettes/palette_invgreen.png differ diff --git a/doc/images/palettes/palette_invmagenta.png b/doc/images/palettes/palette_invmagenta.png index 47be4b2d255..5da488db5aa 100644 Binary files a/doc/images/palettes/palette_invmagenta.png and b/doc/images/palettes/palette_invmagenta.png differ diff --git a/doc/images/palettes/palette_invocean.png b/doc/images/palettes/palette_invocean.png index 576fed56077..70261c715ad 100644 Binary files a/doc/images/palettes/palette_invocean.png and b/doc/images/palettes/palette_invocean.png differ diff --git a/doc/images/palettes/palette_invrainbow.png b/doc/images/palettes/palette_invrainbow.png index 6c19c617ffb..8f184fcf24f 100644 Binary files a/doc/images/palettes/palette_invrainbow.png and b/doc/images/palettes/palette_invrainbow.png differ diff --git a/doc/images/palettes/palette_invred.png b/doc/images/palettes/palette_invred.png index dd35e7b0d36..ee9dde13c12 100644 Binary files a/doc/images/palettes/palette_invred.png and b/doc/images/palettes/palette_invred.png differ diff --git a/doc/images/palettes/palette_invseismic.png b/doc/images/palettes/palette_invseismic.png new file mode 100644 index 00000000000..ae2afad4f27 Binary files /dev/null and b/doc/images/palettes/palette_invseismic.png differ diff --git a/doc/images/palettes/palette_invterrain.png b/doc/images/palettes/palette_invterrain.png new file mode 100644 index 00000000000..ae1a2f6fb03 Binary files /dev/null and b/doc/images/palettes/palette_invterrain.png differ diff --git a/doc/images/palettes/palette_invtrafficlight.png b/doc/images/palettes/palette_invtrafficlight.png index 5650227d435..1e3068ff5f2 100644 Binary files a/doc/images/palettes/palette_invtrafficlight.png and b/doc/images/palettes/palette_invtrafficlight.png differ diff --git a/doc/images/palettes/palette_invyellow.png b/doc/images/palettes/palette_invyellow.png index 2eab805620d..b54bd23510a 100644 Binary files a/doc/images/palettes/palette_invyellow.png and b/doc/images/palettes/palette_invyellow.png differ diff --git a/doc/images/palettes/palette_ocean.png b/doc/images/palettes/palette_ocean.png index 3521604afea..a1feb01ba69 100644 Binary files a/doc/images/palettes/palette_ocean.png and b/doc/images/palettes/palette_ocean.png differ diff --git a/doc/images/palettes/palette_rainbow.png b/doc/images/palettes/palette_rainbow.png index 7231dbfd984..3b48851836c 100644 Binary files a/doc/images/palettes/palette_rainbow.png and b/doc/images/palettes/palette_rainbow.png differ diff --git a/doc/images/palettes/palette_red.png b/doc/images/palettes/palette_red.png index 702be461dd4..ce5dda95817 100644 Binary files a/doc/images/palettes/palette_red.png and b/doc/images/palettes/palette_red.png differ diff --git a/doc/images/palettes/palette_redwhiteblue.png b/doc/images/palettes/palette_redwhiteblue.png index 45bfcce524e..18ea71cf7d6 100644 Binary files a/doc/images/palettes/palette_redwhiteblue.png and b/doc/images/palettes/palette_redwhiteblue.png differ diff --git a/doc/images/palettes/palette_stepsBlGnYe.png b/doc/images/palettes/palette_stepsBlGnYe.png new file mode 100644 index 00000000000..4fb10721319 Binary files /dev/null and b/doc/images/palettes/palette_stepsBlGnYe.png differ diff --git a/doc/images/palettes/palette_stepsBrGr.png b/doc/images/palettes/palette_stepsBrGr.png new file mode 100644 index 00000000000..62b18d53ab6 Binary files /dev/null and b/doc/images/palettes/palette_stepsBrGr.png differ diff --git a/doc/images/palettes/palette_stepsGrBr.png b/doc/images/palettes/palette_stepsGrBr.png new file mode 100644 index 00000000000..2b3012e0c31 Binary files /dev/null and b/doc/images/palettes/palette_stepsGrBr.png differ diff --git a/doc/images/palettes/palette_stepsOrPu.png b/doc/images/palettes/palette_stepsOrPu.png new file mode 100644 index 00000000000..9ae3fca3d93 Binary files /dev/null and b/doc/images/palettes/palette_stepsOrPu.png differ diff --git a/doc/images/palettes/palette_stepsinvseismic.png b/doc/images/palettes/palette_stepsinvseismic.png new file mode 100644 index 00000000000..66f8a8d7888 Binary files /dev/null and b/doc/images/palettes/palette_stepsinvseismic.png differ diff --git a/doc/images/palettes/palette_stepsinvterrain.png b/doc/images/palettes/palette_stepsinvterrain.png new file mode 100644 index 00000000000..0740075af6c Binary files /dev/null and b/doc/images/palettes/palette_stepsinvterrain.png differ diff --git a/doc/images/palettes/palette_stepsseismic.png b/doc/images/palettes/palette_stepsseismic.png new file mode 100644 index 00000000000..7189d0d95b6 Binary files /dev/null and b/doc/images/palettes/palette_stepsseismic.png differ diff --git a/doc/images/palettes/palette_stepsterrain.png b/doc/images/palettes/palette_stepsterrain.png new file mode 100644 index 00000000000..d83e77c98f4 Binary files /dev/null and b/doc/images/palettes/palette_stepsterrain.png differ diff --git a/doc/images/palettes/palette_trafficlight.png b/doc/images/palettes/palette_trafficlight.png index df574f6d1ac..ffbbd4543fb 100644 Binary files a/doc/images/palettes/palette_trafficlight.png and b/doc/images/palettes/palette_trafficlight.png differ diff --git a/doc/images/palettes/palette_whitecyan.png b/doc/images/palettes/palette_whitecyan.png index 5d4f798d629..cb24976cfed 100644 Binary files a/doc/images/palettes/palette_whitecyan.png and b/doc/images/palettes/palette_whitecyan.png differ diff --git a/doc/images/palettes/palette_whitemagenta.png b/doc/images/palettes/palette_whitemagenta.png index fa5142c9d11..882b828dfdf 100644 Binary files a/doc/images/palettes/palette_whitemagenta.png and b/doc/images/palettes/palette_whitemagenta.png differ diff --git a/doc/images/palettes/palette_whiteyellow.png b/doc/images/palettes/palette_whiteyellow.png index 0480511b716..e1096d068fc 100644 Binary files a/doc/images/palettes/palette_whiteyellow.png and b/doc/images/palettes/palette_whiteyellow.png differ diff --git a/doc/images/palettes/palette_yellowmagenta.png b/doc/images/palettes/palette_yellowmagenta.png index a9e1d33ce2a..29938abfcfe 100644 Binary files a/doc/images/palettes/palette_yellowmagenta.png and b/doc/images/palettes/palette_yellowmagenta.png differ diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.cpp b/lib/jkqtcommon/jkqtpbasicimagetools.cpp index b3f99a4bc35..e48e77e307e 100644 --- a/lib/jkqtcommon/jkqtpbasicimagetools.cpp +++ b/lib/jkqtcommon/jkqtpbasicimagetools.cpp @@ -78,1182 +78,291 @@ QMap JKQTPImageTools::getDefaultLUTs() { - { - const auto palette=JKQTPMathImageRED; - const QString palN="red"; - const QString palNT=QObject::tr("red"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(static_cast(255.0*v), 0, 0); - } - } - } - - - { - const auto palette=JKQTPMathImageGREEN; - const QString palN="green"; - const QString palNT=QObject::tr("green"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, static_cast(255.0*v), 0); - } - } - } - - - { - const auto palette=JKQTPMathImageBLUE; - const QString palN="blue"; - const QString palNT=QObject::tr("blue"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, 0, static_cast(255.0*v)); - } - } - } - - - { - const auto palette=JKQTPMathImageGRAY; - const QString palN="gray"; - const QString palNT=QObject::tr("gray"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(static_cast(255.0*v), - static_cast(255.0*v), - static_cast(255.0*v)); - } - } - } - - - { - const auto palette=JKQTPMathImageALPHA; - const QString palN="alpha"; - const QString palNT=QObject::tr("alpha"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgba(255,255,255, - static_cast(255.0*v)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_ALPHA; - const QString palN="invAlpha"; - const QString palNT=QObject::tr("inv. alpha"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgba(255,255,255, - static_cast(255.0*v)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTEDRED; - const QString palN="invred"; - const QString palNT=QObject::tr("inv. red"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(static_cast(255.0*(1.0-v)), 0, 0); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTEDGREEN; - const QString palN="invgreen"; - const QString palNT=QObject::tr("inv. green"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, static_cast(255.0*(1.0-v)), 0); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTEDBLUE; - const QString palN="invblue"; - const QString palNT=QObject::tr("inv. blue"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, 0, static_cast(255.0*(1.0-v))); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTEDGRAY; - const QString palN="invgray"; - const QString palNT=QObject::tr("inv. gray"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=1.0-(l/static_cast(JKQTPImageTools::LUTSIZE)); - plut[l]=qRgb(static_cast(255.0*v), - static_cast(255.0*v), - static_cast(255.0*v)); - } - } - } - - - { - const auto palette=JKQTPMathImageMATLAB; - const QString palN="Matlab"; - const QString palNT=QObject::tr("Matlab"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 382.5 - 1020.0 * std::abs(v - 0.75); - if (r > 255.0) - r = 255.0; - else if (r < 0.0) - r = 0.0; - - double g = 382.5 - 1020.0 * std::abs(v - 0.5); - if (g > 255.0) - g = 255.0; - else if (g < 0.0) - g = 0.0; - - double b = 382.5 - 1020.0 * std::abs(v - 0.25); - if (b > 255.0) - b = 255.0; - else if (b < 0.0) - b = 0.0; - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_MATLAB; - const QString palN="invMatlab"; - const QString palNT=QObject::tr("inv. Matlab"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 382.5 - 1020.0 * std::abs(v - 0.75); - if (r > 255.0) - r = 255.0; - else if (r < 0.0) - r = 0.0; - - double g = 382.5 - 1020.0 * std::abs(v - 0.5); - if (g > 255.0) - g = 255.0; - else if (g < 0.0) - g = 0.0; - - double b = 382.5 - 1020.0 * std::abs(v - 0.25); - if (b > 255.0) - b = 255.0; - else if (b < 0.0) - b = 0.0; - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageRYGB; - const QString palN="RYGB"; - const QString palNT=QObject::tr("RYGB"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 796.875*v - 199.21875; - if (r > 255.0) - r = 255.0; - else if (r < 0.0) - r = 0.0; - - const double g = 255.0 * std::sin(JKQTPSTATISTICS_PI*v); - - double b = 255.0 - 765.0 * v; - if (b < 0.0) - b = 0.0; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_RYGB; - const QString palN="invRYGB"; - const QString palNT=QObject::tr("inv. RYGB"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 796.875*v - 199.21875; - if (r > 255.0) - r = 255.0; - else if (r < 0.0) - r = 0.0; - - const double g = 255.0 * std::sin(JKQTPSTATISTICS_PI*v); - - double b = 255.0 - 765.0 * v; - if (b < 0.0) - b = 0.0; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageHSV; - const QString palN="HSV"; - const QString palNT=QObject::tr("HSV"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - const int h = static_cast(floor(6*v)); - const double f = 6*v-double(h); - - switch (h) - { - case 0: plut[l]=qRgb(255, static_cast(255.0*f), 0); break; - case 1: plut[l]=qRgb(static_cast(255.0*(1-f)), 255, 0); break; - case 2: plut[l]=qRgb(0, 255, static_cast(255.0*f)); break; - case 3: plut[l]=qRgb(0, static_cast(255.0*(1-f)), 255); break; - case 4: plut[l]=qRgb(static_cast(255.0*f), 0, 255); break; - case 5: plut[l]=qRgb(255, 0, static_cast(255.0*(1-f))); break; - case 6: plut[l]=qRgb(255, static_cast(255.0*f), 0); break; - } - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_HSV; - const QString palN="invHSV"; - const QString palNT=QObject::tr("inv. HSV"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - const int h = static_cast(floor(6.0-6.0*v)); - const double f = 6.0-6.0*v-double(h); - - switch (h) - { - case 0: plut[l]=qRgb(255, static_cast(255.0*f), 0); break; - case 1: plut[l]=qRgb(static_cast(255.0*(1-f)), 255, 0); break; - case 2: plut[l]=qRgb(0, 255, static_cast(255.0*f)); break; - case 3: plut[l]=qRgb(0, static_cast(255.0*(1-f)), 255); break; - case 4: plut[l]=qRgb(static_cast(255.0*f), 0, 255); break; - case 5: plut[l]=qRgb(255, 0, static_cast(255.0*(1-f))); break; - case 6: plut[l]=qRgb(255, static_cast(255.0*f), 0); break; - } - } - } - } + lutstore[JKQTPMathImageRED]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::red)}), "red", QObject::tr("red")); + lutstore[JKQTPMathImageINVERTEDRED]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::red),QColor(Qt::black)}), "invred", QObject::tr("inv. red")); + lutstore[JKQTPMathImageGREEN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::green)}), "green", QObject::tr("green")); + lutstore[JKQTPMathImageINVERTEDGREEN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::green),QColor(Qt::black)}), "invgreen", QObject::tr("inv. green")); + lutstore[JKQTPMathImageBLUE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::blue)}), "blue", QObject::tr("blue")); + lutstore[JKQTPMathImageINVERTEDBLUE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::blue),QColor(Qt::black)}), "invblue", QObject::tr("inv. blue")); + lutstore[JKQTPMathImageGRAY]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::white)}), "gray", QObject::tr("gray")); + lutstore[JKQTPMathImageINVERTEDGRAY]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::white),QColor(Qt::black)}), "invgray", QObject::tr("inv. gray")); + lutstore[JKQTPMathImageALPHA]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(255,255,255,0),QColor(255,255,255,255)}), "alpha", QObject::tr("alpha")); + lutstore[JKQTPMathImageINVERTED_ALPHA]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(255,255,255,255),QColor(255,255,255,0)}), "invalpha", QObject::tr("inv. alpha")); + lutstore[JKQTPMathImageCYAN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::cyan)}), "cyan", QObject::tr("cyan")); + lutstore[JKQTPMathImageINVERTED_CYAN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::cyan),QColor(Qt::black)}), "invcyan", QObject::tr("inv. cyan")); + lutstore[JKQTPMathImageCYANWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::cyan),QColor(Qt::white)}), "cyanwhite", QObject::tr("cyan-white")); + lutstore[JKQTPMathImageINVERTED_CYANWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::white),QColor(Qt::cyan)}), "whitecyan", QObject::tr("white-cyan")); - { - const auto palette=JKQTPMathImageRAINBOW; - const QString palN="rainbow"; - const QString palNT=QObject::tr("rainbow"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*std::abs(2.0*v-0.5); - if (r > 255.0) - r = 255.0; - - const double g = 255.0*sin(JKQTPSTATISTICS_PI*v); - - const double b = 255.0*cos(0.5*JKQTPSTATISTICS_PI*v); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } + lutstore[JKQTPMathImageMAGENTA]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::magenta)}), "magenta", QObject::tr("magenta")); + lutstore[JKQTPMathImageINVERTED_MAGENTA]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::magenta),QColor(Qt::black)}), "invmagenta", QObject::tr("inv. magenta")); + lutstore[JKQTPMathImageMAGENTAWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::magenta),QColor(Qt::white)}), "magentawhite", QObject::tr("magenta-white")); + lutstore[JKQTPMathImageINVERTED_MAGENTAWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::white),QColor(Qt::magenta)}), "whitemagenta", QObject::tr("white-magenta")); + lutstore[JKQTPMathImageYELLOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::black),QColor(Qt::yellow)}), "yellow", QObject::tr("yellow")); + lutstore[JKQTPMathImageINVERTED_YELLOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::yellow),QColor(Qt::black)}), "invyellow", QObject::tr("inv. yellow")); + lutstore[JKQTPMathImageYELLOWWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::yellow),QColor(Qt::white)}), "yellowwhite", QObject::tr("yellow-white")); + lutstore[JKQTPMathImageINVERTED_YELLOWWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolateSorted({QColor(Qt::white),QColor(Qt::yellow)}), "whiteyellow", QObject::tr("white-yellow")); - { - const auto palette=JKQTPMathImageINVERTED_RAINBOW; - const QString palN="invrainbow"; - const QString palNT=QObject::tr("inv. rainbow"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*std::abs(2.0*v-0.5); - if (r > 255.0) - r = 255.0; - - const double g = 255.0*sin(JKQTPSTATISTICS_PI*v); - - const double b = 255.0*cos(0.5*JKQTPSTATISTICS_PI*v); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageHOT; - const QString palN="AFMhot"; - const QString palNT=QObject::tr("AFM hot"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v; - if (r > 255.0) - r = 255.0; - - double g = 765.0*v-255.0; - if (g > 255.0) - g = 255.0; - else if (g < 0.0) - g = 0.0; - - double b = 765.0*v-510.0; - if (b < 0.0) - b = 0.0; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_HOT; - const QString palN="invAFMhot"; - const QString palNT=QObject::tr("inv. AFM hot"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v; - if (r > 255.0) - r = 255.0; - - double g = 765.0*v-255.0; - if (g > 255.0) - g = 255.0; - else if (g < 0.0) - g = 0.0; - - double b = 765.0*v-510.0; - if (b < 0.0) - b = 0.0; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } { - const auto palette=JKQTPMathImageOCEAN; - const QString palN="ocean"; - const QString palNT=QObject::tr("ocean"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v-510.0; - if (r < 0.0) - r = 0.0; - - const double g = std::abs(382.5*v-127.5); - - const double b = 255.0*v; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - + const auto fR= [](float v) -> float { return (382.5 - 1020.0 * std::abs(v - 0.75))/255.0; }; + const auto fG= [](float v) -> float { return (382.5 - 1020.0 * std::abs(v - 0.5))/255.0; }; + const auto fB= [](float v) -> float { return (382.5 - 1020.0 * std::abs(v - 0.25))/255.0; }; + const auto& normLUT=lutstore[JKQTPMathImageMATLAB]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "Matlab", QObject::tr("Matlab")); + lutstore[JKQTPMathImageINVERTED_MATLAB]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invMatlab", QObject::tr("inv. Matlab")); - { - const auto palette=JKQTPMathImageINVERTED_OCEAN; - const QString palN="invocean"; - const QString palNT=QObject::tr("inv. ocean"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v-510.0; - if (r < 0.0) - r = 0.0; - - const double g = std::abs(382.5*v-127.5); - - const double b = 255.0*v; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } } - { - const auto palette=JKQTPMathImageBLUEMAGENTAYELLOW; - const QString palN="BlMaYe"; - const QString palNT=QObject::tr("blue-magenta-yellow"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v/0.32-0.78125); - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = 2.0*v-0.84; - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = 4.0*v; - if (b>1 || b<0) b = -2.0*v+1.84; - if (b>1 || b<0) b = v/0.08-11.5; - if (b>1 || b<0) b=1; - - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } - } - + const auto fR= [](float v) -> float { return (796.875*v - 199.21875)/255.0; }; + const auto fG= [](float v) -> float { return std::sin(JKQTPSTATISTICS_PI*v); }; + const auto fB= [](float v) -> float { return (255.0 - 765.0 * v)/255.0; }; + const auto& normLUT=lutstore[JKQTPMathImageRYGB]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "RYGB", QObject::tr("RYGB")); + lutstore[JKQTPMathImageINVERTED_RYGB]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invRYGB", QObject::tr("inv. RYGB")); - { - const auto palette=JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW; - const QString palN="YeMaBl"; - const QString palNT=QObject::tr("yellow-magenta-blue"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v/0.32-0.78125); - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = 2.0*v-0.84; - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = 4.0*v; - if (b>1 || b<0) b = -2.0*v+1.84; - if (b>1 || b<0) b = v/0.08-11.5; - if (b>1 || b<0) b=1; - - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } } - { - const auto palette=JKQTPMathImageBLUEYELLOW; - const QString palN="BlYe"; - const QString palNT=QObject::tr("blue-yellow"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = sqrt(sqrt(v)); - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = sin(JKQTPSTATISTICS_PI/2.0*v); - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = cos(JKQTPSTATISTICS_PI/2.0*v); - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } - } + const auto& normLUT=lutstore[JKQTPMathImageHSV]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT([](float v)->QRgb { + const int h = static_cast(floor(6.0*v)); + const double f = 6*v-double(h); - - { - const auto palette=JKQTPMathImageINVERTED_BLUEYELLOW; - const QString palN="YeBl"; - const QString palNT=QObject::tr("yellow-blue"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = sqrt(sqrt(v)); - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = sin(JKQTPSTATISTICS_PI/2.0*v); - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = cos(JKQTPSTATISTICS_PI/2.0*v); - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } - } - - - { - const auto palette=JKQTPMathImageCYAN; - const QString palN="cyan"; - const QString palNT=QObject::tr("cyan"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = v*0.5; - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = v; - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = v; - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_CYAN; - const QString palN="invcyan"; - const QString palNT=QObject::tr("inv. cyan"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = v*0.5; - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = v; - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = v; - if (b < 0.0) b = 0.0; - if (b > 1.0) b = 1.0; - plut[l]=qRgb(static_cast(255.0*r), static_cast(255.0*g), static_cast(255.0*b)); - } - } - } - - - { - const auto palette=JKQTPMathImageTRAFFICLIGHT; - const QString palN="trafficlight"; - const QString palNT=QObject::tr("trafficlight"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v < 0.5) ? 128.0*sin(JKQTPSTATISTICS_PI*(2.0*v-0.5))+128.0 : 255.0; - if (r > 255.0) - r = 255.0; - - double g = (v < 0.5) ? 512.0*v+128.0 : 512.0-512.0*v; - if (g > 255.0) - g = 255.0; - plut[l]=qRgb(static_cast(r), static_cast(g), 0); - } - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_TRAFFICLIGHT; - const QString palN="invtrafficlight"; - const QString palNT=QObject::tr("inv. trafficlight"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v < 0.5) ? 128.0*sin(JKQTPSTATISTICS_PI*(2.0*v-0.5))+128.0 : 255.0; - if (r > 255.0) - r = 255.0; - - double g = (v < 0.5) ? 512.0*v+128.0 : 512.0-512.0*v; - if (g > 255.0) - g = 255.0; - plut[l]=qRgb(static_cast(r), static_cast(g), 0); - } - } - } - - - { - const auto palette=JKQTPMathImageBLUEWHITERED; - const QString palN="bluewhitered"; - const QString palNT=QObject::tr("blue-white-red"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - JKQTPPaletteList lst; - lst<(8.0, 0xFFB2182B); - lst<(7.0, 0xFFD6604D); - lst<(6.0, 0xFFF4A582); - lst<(5.0, 0xFFFDDBC7); - lst<(4.0, 0xFFD1E5F0); - lst<(3.0, 0xFF92C5DE); - lst<(2.0, 0xFF4393C3); - lst<(1.0, 0xFF2166AC); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst, JKQTPImageTools::LUTSIZE+1); - } - - - { - const auto palette=JKQTPMathImageREDWHITEBLUE; - const QString palN="redwhiteblue"; - const QString palNT=QObject::tr("red-white-blue"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - - JKQTPPaletteList lst; - lst<(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - const double r = 255.0*qBound(0.0,sqrt(v),1.0); - const double g = 255.0*qBound(0.0,v*v*v,1.0); - const double b = 255.0*qBound(0.0,sin(2.0*JKQTPSTATISTICS_PI*v),1.0); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - - - { - const auto palette=JKQTPMathImageGREENREDVIOLET; - const QString palN="GnRdVi"; - const QString palNT=QObject::tr("green-red-violet"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - const double r = 255.0*qBound(0.0,v,1.0); - const double g = 255.0*qBound(0.0,fabs(v-0.5),1.0); - const double b = 255.0*qBound(0.0,v*v*v*v,1.0); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + switch (h) + { + case 0: return qRgb(255, static_cast(255.0*f), 0); + case 1: return qRgb(static_cast(255.0*(1-f)), 255, 0); + case 2: return qRgb(0, 255, static_cast(255.0*f)); + case 3: return qRgb(0, static_cast(255.0*(1-f)), 255); + case 4: return qRgb(static_cast(255.0*f), 0, 255); + case 5: return qRgb(255, 0, static_cast(255.0*(1-f))); + case 6: return qRgb(255, static_cast(255.0*f), 0); + default: return qRgb(0,0,0); } - } - } - + }), "HSV", QObject::tr("HSV")); + lutstore[JKQTPMathImageINVERTED_HSV]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invHSV", QObject::tr("inv. HSV")); - { - const auto palette=JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE; - const QString palN="BWprint"; - const QString palNT=QObject::tr("black-blue-white-yellow-white"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - const double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - const double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - const double b = 255.0*qBound(0.0,(v<0.25)?4*v:(v<0.42)?1.0:(v<0.92)?-2.0*v+1.84:v/0.08-11.5,1.0); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } } - { - const auto palette=JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK; - const QString palN="invBWprint"; - const QString palNT=QObject::tr("white-yellow-white-blue-black"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - const double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - const double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - const double b = 255.0*qBound(0.0,(v<0.25)?4*v:(v<0.42)?1.0:(v<0.92)?-2.0*v+1.84:v/0.08-11.5,1.0); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } + const auto fR= [](float v) -> float { return std::abs(2.0*v-0.5); }; + const auto fG= [](float v) -> float { return sin(JKQTPSTATISTICS_PI*v); }; + const auto fB= [](float v) -> float { return cos(0.5*JKQTPSTATISTICS_PI*v); }; + const auto& normLUT=lutstore[JKQTPMathImageRAINBOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "rainbow", QObject::tr("rainbow")); + lutstore[JKQTPMathImageINVERTED_RAINBOW]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invrainbow", QObject::tr("inv. rainbow")); - - { - const auto palette=JKQTPMathImageBR_GR; - const QString palN="BrBG"; - const QString palNT=QObject::tr("BrBG"); - lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); - JKQTPPaletteList lst; - lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); - lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); - lst<(2.0, qRgb(0xDF, 0xC2, 0x7D)); - lst< float { return 765.0*v/255.0; }; + const auto fG= [](float v) -> float { return (765.0*v-255.0)/255.0; }; + const auto fB= [](float v) -> float { return (765.0*v-510.0)/255.0; }; + const auto& normLUT=lutstore[JKQTPMathImageHOT]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "AFMhot", QObject::tr("AFM hot")); + lutstore[JKQTPMathImageINVERTED_HOT]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invAFMhot", QObject::tr("inv. AFM hot")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - { - const auto palettei=JKQTPMathImagePU_OR_STEP; - lutstore[palettei]=JKQTPImageTools::LUTData("stepsPuOr", QObject::tr("steps: PuOr")); - lutstore[palettei].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } } - - { - const auto palette=JKQTPMathImageYL_GN_BU; - const QString palN="YeGnBu"; - const QString palNT=QObject::tr("YeGnBu"); - lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); - JKQTPPaletteList lst; - lst< float { return (765.0*v-510.0)/255.0; }; + const auto fG= [](float v) -> float { return (std::abs(382.5*v-127.5))/255.0; }; + const auto fB= [](float v) -> float { return v; }; + const auto& normLUT=lutstore[JKQTPMathImageOCEAN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "ocean", QObject::tr("ocean")); + lutstore[JKQTPMathImageINVERTED_OCEAN]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invocean", QObject::tr("inv. ocean")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - { - const auto palettei=JKQTPMathImageYL_GN_BU_STEP; - lutstore[palettei]=JKQTPImageTools::LUTData("stepsYeGnBu", QObject::tr("steps: YeGnBu")); - lutstore[palettei].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } } - - { - JKQTPPaletteList lst; - lst< float { return v/0.32-0.78125; }; + const auto fG= [](float v) -> float { return 2.0*v-0.84; }; + const auto fB= [](float v) -> float { + double b = 4.0*v; + if (b>1 || b<0) b = -2.0*v+1.84; + if (b>1 || b<0) b = v/0.08-11.5; + if (b>1 || b<0) b=1; + return b; + }; + const auto& normLUT=lutstore[JKQTPMathImageBLUEMAGENTAYELLOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "BlMaYe", QObject::tr("blue-magenta-yellow")); + lutstore[JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "YeMaBl", QObject::tr("yellow-magenta-blue")); - { - const auto palette=JKQTPMathImageBU_GN; - lutstore[palette]=JKQTPImageTools::LUTData("bluegreen", QObject::tr("blue-green")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - } - - { - const auto palette=JKQTPMathImageBU_GN_STEP; - lutstore[palette]=JKQTPImageTools::LUTData("stepsBlGn", QObject::tr("steps: blue-green")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } - - - lst.reverse(); - - - { - const auto palette=JKQTPMathImageGN_BU; - lutstore[palette]=JKQTPImageTools::LUTData("greenblue", QObject::tr("green-blue")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - } - - { - const auto palette=JKQTPMathImageGN_BU_STEP; - lutstore[palette]=JKQTPImageTools::LUTData("stepsGnBl", QObject::tr("steps: green-blue")); - lutstore[palette].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } } - - - - - { - const auto palette=JKQTPMathImageMAGENTA; - const auto palettei=JKQTPMathImageINVERTED_MAGENTA; - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "magenta", QObject::tr("magenta")); - lutstore[palettei]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "invmagenta", QObject::tr("inv. magenta")); - QRgb* plut=lutstore[palette].lut.data(); - QRgb* pluti=lutstore[palettei].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); - pluti[l]=QColor::fromCmykF(0,1,0,1.0-v).rgba(); - } + const auto fR= [](float v) -> float { return sqrt(sqrt(v)); }; + const auto fG= [](float v) -> float { return sin(JKQTPSTATISTICS_PI/2.0*v); }; + const auto fB= [](float v) -> float { return cos(JKQTPSTATISTICS_PI/2.0*v); }; + const auto& normLUT=lutstore[JKQTPMathImageBLUEYELLOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "BlYe", QObject::tr("blue-yellow")); + lutstore[JKQTPMathImageINVERTED_BLUEYELLOW]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "YeBl", QObject::tr("yellow-blue")); - } } - { - const auto palette=JKQTPMathImageYELLOW; - const auto palettei=JKQTPMathImageINVERTED_YELLOW; - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "yellow", QObject::tr("yellow")); - lutstore[palettei]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "invyellow", QObject::tr("inv. yellow")); - QRgb* plut=lutstore[palette].lut.data(); - QRgb* pluti=lutstore[palettei].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); - pluti[l]=QColor::fromCmykF(0,0,1,1.0-v).rgba(); - } - - } - } - - - { - const auto palette=JKQTPMathImageCYAN; - const auto palettei=JKQTPMathImageINVERTED_CYAN; - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "cyan", QObject::tr("cyan")); - lutstore[palettei]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), "invcyan", QObject::tr("inv. cyan")); - QRgb* plut=lutstore[palette].lut.data(); - QRgb* pluti=lutstore[palettei].lut.data(); - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(1,0,0,v).rgba(); - pluti[l]=QColor::fromCmykF(1,0,0,1.0-v).rgba(); - } - - } - } - - - { - const auto palette=JKQTPMathImageINVERTED_MAGENTAWHITE; - const QString palN="whitemagenta"; - const QString palNT=QObject::tr("white-magenta"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); - } + const auto fR= [](float v) -> float { return ((v < 0.5) ? 128.0*sin(JKQTPSTATISTICS_PI*(2.0*v-0.5))+128.0 : 255.0)/255.0; }; + const auto fG= [](float v) -> float { return ((v < 0.5) ? 512.0*v+128.0 : 512.0-512.0*v)/255.0; }; + const auto fB= [](float v) -> float { return 0.0; }; + const auto& normLUT=lutstore[JKQTPMathImageTRAFFICLIGHT]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "Trafficlight", QObject::tr("Trafficlight")); + lutstore[JKQTPMathImageINVERTED_TRAFFICLIGHT]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invtrafficlight", QObject::tr("inv. Trafficlight")); - } } - { - const auto palette=JKQTPMathImageMAGENTAWHITE; - const QString palN="magentawhite"; - const QString palNT=QObject::tr("magenta-white"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); - } - - } + const auto fR= [](float v) -> float { return sqrt(v); }; + const auto fG= [](float v) -> float { return v*v*v; }; + const auto fB= [](float v) -> float { return sin(2.0*JKQTPSTATISTICS_PI*v); }; + const auto& normLUT=lutstore[JKQTPMathImageBLACKBLUEREDYELLOW]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "BBlRdYe", QObject::tr("black-blue-red-yellow")); + lutstore[JKQTPMathImageYELLOWREDBLUEBLACK]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "YeRdBlB", QObject::tr("yellow-red-blue-black")); } - { - const auto palette=JKQTPMathImageINVERTED_YELLOWWHITE; - const QString palN="whiteyellow"; - const QString palNT=QObject::tr("white-yellow"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); - } - - } + const auto fR= [](float v) -> float { return v; }; + const auto fG= [](float v) -> float { return fabs(v-0.5); }; + const auto fB= [](float v) -> float { return v*v*v*v; }; + const auto& normLUT=lutstore[JKQTPMathImageGREENREDVIOLET]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "GnRdVi", QObject::tr("green-red-violet")); + lutstore[JKQTPMathImageVIOLETREDGREEN]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "ViRdGn", QObject::tr("violet-red-green")); } - { - const auto palette=JKQTPMathImageYELLOWWHITE; - const QString palN="yellowwhite"; - const QString palNT=QObject::tr("yellow-white"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); - } - - } + const auto fR= [](float v) -> float { return v/0.32-0.78125; }; + const auto fG= [](float v) -> float { return v/0.32-0.78125; }; + const auto fB= [](float v) -> float { return (v<0.25)?4*v:(v<0.42)?1.0:(v<0.92)?-2.0*v+1.84:v/0.08-11.5; }; + const auto& normLUT=lutstore[JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUT(fR, fG, fB), "BWprint", QObject::tr("black-blue-white-yellow-white")); + lutstore[JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invBWprint", QObject::tr("white-yellow-white-blue-black")); } - { - const auto palette=JKQTPMathImageINVERTED_CYANWHITE; - const QString palN="whitecyan"; - const QString palNT=QObject::tr("white-cyan"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); - } - - } + const auto& normLUT=lutstore[JKQTPMathImageREDWHITEBLUE]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(JKQTPPaletteList( + {jkqtp_qRgbOpaque(0xB2182B), + jkqtp_qRgbOpaque(0xD6604D), + jkqtp_qRgbOpaque(0xF4A582), + jkqtp_qRgbOpaque(0xFDDBC7), + jkqtp_qRgbOpaque(0xD1E5F0), + jkqtp_qRgbOpaque(0x92C5DE), + jkqtp_qRgbOpaque(0x4393C3), + jkqtp_qRgbOpaque(0x2166AC)})), + "redwhiteblue", QObject::tr("red-white-blue")); + lutstore[JKQTPMathImageBLUEWHITERED]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "bluewhitered", QObject::tr("blue-white-red")); } - { - const auto palette=JKQTPMathImageCYANWHITE; - const QString palN="cyanwhite"; - const QString palNT=QObject::tr("cyan-white"); - lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); - QRgb* plut=lutstore[palette].lut.data(); //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - const double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); - } - - } + const JKQTPPaletteList lst= { + jkqtp_qRgbOpaque(0x8C510A), + jkqtp_qRgbOpaque(0xBF812D), + jkqtp_qRgbOpaque(0xDFC27D), + jkqtp_qRgbOpaque(0xF6E8C3), + jkqtp_qRgbOpaque(0xC7EAE5), + jkqtp_qRgbOpaque(0x80CDC1), + jkqtp_qRgbOpaque(0x35978F), + jkqtp_qRgbOpaque(0x01665E) + }; + const auto& normLUT=lutstore[JKQTPMathImageBR_GR]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "BrGr", QObject::tr("brown-white-green (diverging)")); + lutstore[JKQTPMathImageBR_GR].legacyNames<<"BrBG"; + const auto& normStepLUT=lutstore[JKQTPMathImageBR_GR_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsBrGr", QObject::tr("steps: brown-white-green (diverging)")); + lutstore[JKQTPMathImageBR_GR_STEP].legacyNames<<"stepsBrBG"; + lutstore[JKQTPMathImageGR_BR]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "GrBr", QObject::tr("green-white-brown (diverging)")); + lutstore[JKQTPMathImageGR_BR_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsGrBr", QObject::tr("steps: green-white-brown (diverging)")); } - { - const auto palette=JKQTPMathImageBlueGreenRed; - const QString palN="bluegreenred"; - const QString palNT=QObject::tr("blue-green-red"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("blue").rgb()); - lst<(2.0, QColor("green").rgb()); - lst<(3.0, QColor("red").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + const JKQTPPaletteList lst= { + jkqtp_qRgbOpaque(0xB35806), + jkqtp_qRgbOpaque(0xE08214), + jkqtp_qRgbOpaque(0xFDB863), + jkqtp_qRgbOpaque(0xFEE0B6), + jkqtp_qRgbOpaque(0xF7F7F7), + jkqtp_qRgbOpaque(0xD8DAEB), + jkqtp_qRgbOpaque(0xB2ABD2), + jkqtp_qRgbOpaque(0x8073AC), + jkqtp_qRgbOpaque(0x542788) + }; + const auto& normLUT=lutstore[JKQTPMathImagePU_OR]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "PuOr", QObject::tr("purple-white-orange (diverging)")); + const auto& normStepLUT=lutstore[JKQTPMathImagePU_OR_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsPuOr", QObject::tr("steps: purple-white-orange (diverging)")); + lutstore[JKQTPMathImageOR_PU]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "OrPu", QObject::tr("orange-white-purple (diverging)")); + lutstore[JKQTPMathImageOR_PU_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsOrPu", QObject::tr("steps: orange-white-purple (diverging)")); } - { - const auto palette=JKQTPMathImageRedGreenBlue; - const QString palN="redgreenblue"; - const QString palNT=QObject::tr("red-green-blue"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("red").rgb()); - lst<(2.0, QColor("green").rgb()); - lst<(3.0, QColor("blue").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - } - - - { - const auto palette=JKQTPMathImageMagentaYellow; - const QString palN="magentayellow"; - const QString palNT=QObject::tr("magenta-yellow"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("magenta").rgb()); - lst<(2.0, QColor("yellow").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - } - - - { - const auto palette=JKQTPMathImageYellowMagenta; - const QString palN="yellowmagenta"; - const QString palNT=QObject::tr("yellow-magenta"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("yellow").rgb()); - lst<(2.0, QColor("magenta").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - } - - - { - const auto palette=JKQTPMathImageRedBlue; - const QString palN="redblue"; - const QString palNT=QObject::tr("red-blue"); - lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("red").rgb()); - lst<(2.0, QColor("blue").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + const JKQTPPaletteList lst= { + jkqtp_qRgbOpaque(0xFFFFD9), + jkqtp_qRgbOpaque(0xEDF8B1), + jkqtp_qRgbOpaque(0xC7E9B4), + jkqtp_qRgbOpaque(0x7FCDBB), + jkqtp_qRgbOpaque(0x41B6C4), + jkqtp_qRgbOpaque(0x1D91C0), + jkqtp_qRgbOpaque(0x225EA8), + jkqtp_qRgbOpaque(0x253494), + jkqtp_qRgbOpaque(0x081D58) + }; + const auto& normLUT=lutstore[JKQTPMathImageYL_GN_BU]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "YeGnBu", QObject::tr("yellow-green-blue")); + const auto& normStepLUT=lutstore[JKQTPMathImageYL_GN_BU_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsYeGnBu", QObject::tr("steps: yellow-green-blue")); + lutstore[JKQTPMathImageBU_GN_YL]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "BlGnYe", QObject::tr("blue-green-yellow")); + lutstore[JKQTPMathImageBU_GN_YL_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsBlGnYe", QObject::tr("steps: blue-green-yellow")); } { - const auto palette=JKQTPMathImageBlueRed; - const QString palN="bluered"; - const QString palNT=QObject::tr("blue-red"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(1.0, QColor("blue").rgb()); - lst<(2.0, QColor("red").rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + const JKQTPPaletteList lst= { + jkqtp_qRgbOpaque(0xF7FCF0), + jkqtp_qRgbOpaque(0xE0F3DB), + jkqtp_qRgbOpaque(0xCCEBC5), + jkqtp_qRgbOpaque(0xA8DDB5), + jkqtp_qRgbOpaque(0x7BCCC4), + jkqtp_qRgbOpaque(0x4EB3D3), + jkqtp_qRgbOpaque(0x2B8CBE), + jkqtp_qRgbOpaque(0x0868AC), + jkqtp_qRgbOpaque(0x084081) + }; + const auto& normLUT=lutstore[JKQTPMathImageBU_GN]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "bluegreen", QObject::tr("blue-green-white")); + const auto& normStepLUT=lutstore[JKQTPMathImageBU_GN_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsBlGn", QObject::tr("steps: blue-green-white")); + lutstore[JKQTPMathImageGN_BU]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "BlGnYe", QObject::tr("white-green-blue")); + lutstore[JKQTPMathImageGN_BU_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsBlGnYe", QObject::tr("steps: white-green-blue")); + } + + { + const JKQTPPaletteList lst= { + QColor("blue"), + QColor("green"), + QColor("red") + }; + const auto& normLUT=lutstore[JKQTPMathImageBlueGreenRed]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "BlGnRd", QObject::tr("blue-green-red")); + lutstore[JKQTPMathImageBlueGreenRed].legacyNames<<"bluegreenred"; + lutstore[JKQTPMathImageRedGreenBlue]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "RdGnBu", QObject::tr("red-green-blue")); + lutstore[JKQTPMathImageRedGreenBlue].legacyNames<<"redgreenblue"; + } + + { + const JKQTPPaletteList lst= { + QColor("magenta"), + QColor("yellow") + }; + const auto& normLUT=lutstore[JKQTPMathImageMagentaYellow]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "magentayellow", QObject::tr("magenta-yellow")); + lutstore[JKQTPMathImageYellowMagenta]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "yellowmagenta", QObject::tr("yellow-magenta")); + } + + { + const JKQTPPaletteList lst= { + QColor("red"), + QColor("blue") + }; + const auto& normLUT=lutstore[JKQTPMathImageRedBlue]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "redblue", QObject::tr("red-blue")); + lutstore[JKQTPMathImageBlueRed]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "bluered", QObject::tr("blue-red")); + } + + { + const JKQTPPaletteList lst= { + QColor::fromRgbF(0.0f, 0.0f, 0.3f), + QColor::fromRgbF(0.0f, 0.0f, 1.0f), + QColor::fromRgbF(1.0f, 1.0f, 1.0f), + QColor::fromRgbF(1.0f, 0.0f, 0.0f), + QColor::fromRgbF(0.5f, 0.0f, 0.0f) + }; + const auto& normLUT=lutstore[JKQTPMathImageSeismic]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "seismic", QObject::tr("seismic")); + const auto& normStepLUT=lutstore[JKQTPMathImageSeismic_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsseismic", QObject::tr("steps: seismic")); + lutstore[JKQTPMathImageSeismic_STEP].legacyNames<<"seismic_step"; + lutstore[JKQTPMathImageINVERTED_Seismic]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invseismic", QObject::tr("inv. seismic")); + lutstore[JKQTPMathImageINVERTED_Seismic_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsinvseismic", QObject::tr("steps: inv. seismic")); } { - const auto palette=JKQTPMathImageSeismic; - const QString palN="seismic"; - const QString palNT=QObject::tr("seismic"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); - JKQTPPaletteList lst; - lst<(0, QColor::fromRgbF(0.0f, 0.0f, 0.3f).rgb()); - lst<(1, QColor::fromRgbF(0.0f, 0.0f, 1.0f).rgb()); - lst<(2, QColor::fromRgbF(1.0f, 1.0f, 1.0f).rgb()); - lst<(3, QColor::fromRgbF(1.0f, 0.0f, 0.0f).rgb()); - lst<(4, QColor::fromRgbF(0.5f, 0.0f, 0.0f).rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - { - const auto palettei=JKQTPMathImageSeismic_STEP; - lutstore[palettei]=JKQTPImageTools::LUTData("seismic_step", QObject::tr("steps: seismic")); - lutstore[palettei].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } - } - - { - const auto palette=JKQTPMathImageTerrain; - const QString palN="terrain"; - const QString palNT=QObject::tr("terrain"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); JKQTPPaletteList lst; lst<(0.00, QColor::fromRgbF(0.2f, 0.2f, 0.6f).rgb()); lst<(0.15, QColor::fromRgbF(0.0f, 0.6f, 1.0f).rgb()); @@ -1261,22 +370,15 @@ QMap JKQTPImageTools::getDefaultLUTs() { lst<(0.50, QColor::fromRgbF(1.0f, 1.0f, 0.6f).rgb()); lst<(0.75, QColor::fromRgbF(0.5f, 0.36f, 0.33f).rgb()); lst<(1.00, QColor::fromRgbF(1.0f, 1.0f, 1.0f).rgb()); - - lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); - - - { - const auto palettei=JKQTPMathImageTerrain_STEP; - lutstore[palettei]=JKQTPImageTools::LUTData("terrain_step", QObject::tr("steps: terrain")); - lutstore[palettei].lut=JKQTPBuildColorPaletteLUTColorsOnlySteps(lst); - } + const auto& normLUT=lutstore[JKQTPMathImageTerrain]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTLinInterpolate(lst), "terrain", QObject::tr("terrain")); + const auto& normStepLUT=lutstore[JKQTPMathImageTerrain_STEP]=JKQTPImageTools::LUTData(JKQTPBuildColorPaletteLUTColorsOnlySteps(lst), "stepsterrain", QObject::tr("steps: terrain")); + lutstore[JKQTPMathImageTerrain_STEP].legacyNames<<"terrain_step"; + lutstore[JKQTPMathImageINVERTED_Terrain]=JKQTPImageTools::LUTData(jkqtp_reversed(normLUT.lut), "invterrain", QObject::tr("inv. terrain")); + lutstore[JKQTPMathImageINVERTED_Terrain_STEP]=JKQTPImageTools::LUTData(jkqtp_reversed(normStepLUT.lut), "stepsinvterrain", QObject::tr("steps: inv. terrain")); } + { - const auto palette=JKQTPMathImageBone; - const QString palN="bone"; - const QString palNT=QObject::tr("bone"); - lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); QList lstR,lstG,lstB; lstR< JKQTPImageTools::getDefaultLUTs() { lstB< lstR,lstG,lstB; lstR< JKQTPImageTools::getDefaultLUTs() { lstB< lstR,lstG,lstB; lstR< JKQTPImageTools::getDefaultLUTs() { lstB< lstR,lstG,lstB; lstR< JKQTPImageTools::getDefaultLUTs() { lstB<(it.key()); } + for (const auto& ln: it.value().legacyNames) { + if (QString::compare(p, ln, Qt::CaseInsensitive)==0) { + return static_cast(it.key()); + } + } } for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) { @@ -3350,3 +2449,24 @@ JKQTPImageTools::LUTType JKQTPCreateGreensCubeHelixLUT(float start, float rotati } return res; } + +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUT(const std::function &palFunc, int lut_size, float vMin, float vMax) +{ + JKQTPImageTools::LUTType res; + const float delta=(vMax-vMin)/static_cast(lut_size-1); + for (int i=0; i(i)*delta; + res< &rFunc, const std::function &gFunc, const std::function &bFunc, int lut_size, float vMin, float vMax) +{ + return JKQTPBuildColorPaletteLUT([&rFunc, &gFunc, &bFunc](float v) { return QColor::fromRgbF(jkqtp_bounded(0.0, rFunc(v), 1.0), jkqtp_bounded(0.0, gFunc(v), 1.0), jkqtp_bounded(0.0, bFunc(v), 1.0)).rgba(); }, lut_size, vMin, vMax); +} + +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUT(const std::function &rFunc, const std::function &gFunc, const std::function &aFunc, const std::function &bFunc, int lut_size, float vMin, float vMax) +{ + return JKQTPBuildColorPaletteLUT([&rFunc, &gFunc, &bFunc, &aFunc](float v) { return QColor::fromRgbF(jkqtp_bounded(0.0, rFunc(v), 1.0), jkqtp_bounded(0.0, gFunc(v), 1.0), jkqtp_bounded(0.0, bFunc(v), 1.0), jkqtp_bounded(0.0, aFunc(v), 1.0)).rgba(); }, lut_size, vMin, vMax); +} diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.h b/lib/jkqtcommon/jkqtpbasicimagetools.h index 60ebf81af1c..7af05f28dfe 100644 --- a/lib/jkqtcommon/jkqtpbasicimagetools.h +++ b/lib/jkqtcommon/jkqtpbasicimagetools.h @@ -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 */ @@ -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 */ @@ -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 legacyNames; }; /*! \brief internal global storage object for lookup-tables @@ -1102,6 +1124,27 @@ class JKQTCOMMON_LIB_EXPORT JKQTPPaletteList: public QList > #endif template inline JKQTPPaletteList(std::initializer_list> args): ListType(args) {}; + inline JKQTPPaletteList(std::initializer_list args): + ListType() + { + for(const auto& v: args) { + push_back(v); + } + }; + inline JKQTPPaletteList(std::initializer_list args): + ListType() + { + for(const auto& v: args) { + push_back(v); + } + }; + inline JKQTPPaletteList(std::initializer_list> args): + ListType() + { + for(const auto& v: args) { + push_back(v.first, v.second); + } + }; template = true> inline JKQTPPaletteList(InputIterator first, InputIterator last): ListType(first, last) {}; inline JKQTPPaletteList(ListType &&other):ListType(std::forward(other)) {}; @@ -1281,6 +1324,25 @@ JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInter */ JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const QMap& 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& 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& rFunc, const std::function& gFunc, const std::function& 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& rFunc, const std::function& gFunc, const std::function& bFunc, const std::function& 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 diff --git a/lib/jkqtcommon/jkqtpmathtools.h b/lib/jkqtcommon/jkqtpmathtools.h index cb0aab3388a..e8309d56b98 100644 --- a/lib/jkqtcommon/jkqtpmathtools.h +++ b/lib/jkqtcommon/jkqtpmathtools.h @@ -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 +inline T jkqtp_reversed(const T& l) { + return T(l.rbegin(), l.rend()); +} + #endif // jkqtpmathtools_H_INCLUDED