diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 7e469bf978..9833f556cc 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -101,6 +101,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html imageplot_small.png \subpage JKQTPlotterImagePlot `JKQTPColumnMathImage`
image data copied from C-style row-major array into a single column of the internal datastore
Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.) + \image html imageplot_userpal_program_small.png + \subpage JKQTPlotterImagePlotUserPalette + `JKQTPColumnMathImage`
user-defines palettes
palettes from files \image html imageplot_modifier_small.png \subpage JKQTPlotterImagePlotModifier `JKQTPColumnMathImage`
image data copied from C-style row-major array into a single column of the internal datastore
Image is modified by a second image to display two data dimensions at the same time @@ -146,6 +149,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html test_styling_small.png \subpage JKQTPlotterStyling Modifying different Aspects of the Styling of JKQTPlotter + \image html imageplot_userpal_small.png + \subpage JKQTPlotterImagePlotUserPalette + `JKQTPColumnMathImage`
user-defines palettes
palettes from files diff --git a/doc/dox/jkqtplotter.dox b/doc/dox/jkqtplotter.dox index 13bd5e12b3..7e6da375e1 100644 --- a/doc/dox/jkqtplotter.dox +++ b/doc/dox/jkqtplotter.dox @@ -509,6 +509,9 @@ Examples: \defgroup jkqtplotter_imagelots_tools Tool Functions & Classes for Image Drawing \ingroup jkqtplotter_imagelots +\defgroup jkqtplotter_imagelots_tools_LUTS Tool Functions to Build Lookup-Tables for Palettes +\ingroup jkqtplotter_imagelots_tools + \defgroup jkqtplotter_imagelots_contour Contour Graphs (based on Image Data) \ingroup jkqtplotter_imagelots diff --git a/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.cdr b/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.cdr new file mode 100644 index 0000000000..9140d9b51b Binary files /dev/null and b/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.cdr differ diff --git a/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.png b/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.png new file mode 100644 index 0000000000..bc2f789764 Binary files /dev/null and b/doc/images/JKQTPBuildColorPaletteLUTLinInterpolateSorted.png differ diff --git a/doc/images/JKQTPBuildColorPaletteLUTSorted.cdr b/doc/images/JKQTPBuildColorPaletteLUTSorted.cdr new file mode 100644 index 0000000000..83d63ce13a Binary files /dev/null and b/doc/images/JKQTPBuildColorPaletteLUTSorted.cdr differ diff --git a/doc/images/JKQTPBuildColorPaletteLUTSorted.png b/doc/images/JKQTPBuildColorPaletteLUTSorted.png new file mode 100644 index 0000000000..2226bb1bf1 Binary files /dev/null and b/doc/images/JKQTPBuildColorPaletteLUTSorted.png differ diff --git a/doc/images/palettes/palette_AFMhot.png b/doc/images/palettes/palette_AFMhot.png index 0c63628b6f..1327a419ed 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 9462369a5c..35568d166e 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 2084a9e142..2962563fa8 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_BlMaYe.png b/doc/images/palettes/palette_BlMaYe.png index 83669e8ac2..c412ff18cf 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 9a5bacbfc3..e7ca107e5e 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_BrBG.png b/doc/images/palettes/palette_BrBG.png index 28bdcabd6f..1f336e7f1d 100644 Binary files a/doc/images/palettes/palette_BrBG.png and b/doc/images/palettes/palette_BrBG.png differ diff --git a/doc/images/palettes/palette_GnRdVi.png b/doc/images/palettes/palette_GnRdVi.png index c7544dfbed..873e0f04d8 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_HSV.png b/doc/images/palettes/palette_HSV.png index ae4949af4d..6a5c658325 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 ac8f0a1050..f3bc790d33 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_PuOr.png b/doc/images/palettes/palette_PuOr.png index fabbe8223e..e6ef70e175 100644 Binary files a/doc/images/palettes/palette_PuOr.png and b/doc/images/palettes/palette_PuOr.png differ diff --git a/doc/images/palettes/palette_RYGB.png b/doc/images/palettes/palette_RYGB.png index 0eeb5733a0..3673599344 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_YeBl.png b/doc/images/palettes/palette_YeBl.png index bb403263a3..9d8f0e7df8 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_YeGnBu.png b/doc/images/palettes/palette_YeGnBu.png index 88cde329e2..2b97c32d09 100644 Binary files a/doc/images/palettes/palette_YeGnBu.png and b/doc/images/palettes/palette_YeGnBu.png differ diff --git a/doc/images/palettes/palette_YeMaBl.png b/doc/images/palettes/palette_YeMaBl.png index 03ac3ac7e4..66e45567c3 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_autumn.png b/doc/images/palettes/palette_autumn.png new file mode 100644 index 0000000000..303cf7ee84 Binary files /dev/null and b/doc/images/palettes/palette_autumn.png differ diff --git a/doc/images/palettes/palette_blue.png b/doc/images/palettes/palette_blue.png index 80be8563af..36a96c2ff0 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_bluegreen.png b/doc/images/palettes/palette_bluegreen.png index 5d5c6297c4..e621b72771 100644 Binary files a/doc/images/palettes/palette_bluegreen.png and b/doc/images/palettes/palette_bluegreen.png differ diff --git a/doc/images/palettes/palette_bluegreenred.png b/doc/images/palettes/palette_bluegreenred.png index 48b69565ee..f13e1af413 100644 Binary files a/doc/images/palettes/palette_bluegreenred.png and b/doc/images/palettes/palette_bluegreenred.png differ diff --git a/doc/images/palettes/palette_bluered.png b/doc/images/palettes/palette_bluered.png index 2a61656668..5c15976b6c 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 8080489bd6..e2b203f49a 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_bone.png b/doc/images/palettes/palette_bone.png new file mode 100644 index 0000000000..d38ba08744 Binary files /dev/null and b/doc/images/palettes/palette_bone.png differ diff --git a/doc/images/palettes/palette_cool.png b/doc/images/palettes/palette_cool.png new file mode 100644 index 0000000000..efd59a46e1 Binary files /dev/null and b/doc/images/palettes/palette_cool.png differ diff --git a/doc/images/palettes/palette_copper.png b/doc/images/palettes/palette_copper.png new file mode 100644 index 0000000000..f48153583d Binary files /dev/null and b/doc/images/palettes/palette_copper.png differ diff --git a/doc/images/palettes/palette_cyan.png b/doc/images/palettes/palette_cyan.png index 3818cbefeb..04db7f9086 100644 Binary files a/doc/images/palettes/palette_cyan.png and b/doc/images/palettes/palette_cyan.png differ diff --git a/doc/images/palettes/palette_cyanwhite.png b/doc/images/palettes/palette_cyanwhite.png index 5343f05849..cef90025e2 100644 Binary files a/doc/images/palettes/palette_cyanwhite.png and b/doc/images/palettes/palette_cyanwhite.png differ diff --git a/doc/images/palettes/palette_gray.png b/doc/images/palettes/palette_gray.png index 0b879e6261..1b988b46e9 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 cdb490c032..735b484493 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_greenblue.png b/doc/images/palettes/palette_greenblue.png index 4b16f64395..66ee04637f 100644 Binary files a/doc/images/palettes/palette_greenblue.png and b/doc/images/palettes/palette_greenblue.png differ diff --git a/doc/images/palettes/palette_inferno.png b/doc/images/palettes/palette_inferno.png new file mode 100644 index 0000000000..5b8165a8d1 Binary files /dev/null and b/doc/images/palettes/palette_inferno.png differ diff --git a/doc/images/palettes/palette_invAFMhot.png b/doc/images/palettes/palette_invAFMhot.png index 1e354b5264..e8e9ec19c8 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 f39da8253d..279344670f 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 e2dc3de763..9a261e7b6b 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 4e284646b9..ffbd573b31 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 edf40c0fc7..e8b7ad1414 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_invblue.png b/doc/images/palettes/palette_invblue.png index 9deb7aca62..92029607c0 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_invcyan.png b/doc/images/palettes/palette_invcyan.png index f81793a2ee..608a9eff4a 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 1eef8e4982..686289367d 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 4f88ae48c8..0b01e5bc71 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 f4345eb51b..67950d8b2f 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 c53238236b..5d4889f937 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 4e2cb123d5..3d8b79669b 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 62287a59c1..a7b9f050b6 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_invtrafficlight.png b/doc/images/palettes/palette_invtrafficlight.png index ca438c2c20..af7a5d959e 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 99abeef587..5a25749a34 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_magenta.png b/doc/images/palettes/palette_magenta.png index 91d82e7e08..56051700da 100644 Binary files a/doc/images/palettes/palette_magenta.png and b/doc/images/palettes/palette_magenta.png differ diff --git a/doc/images/palettes/palette_magentawhite.png b/doc/images/palettes/palette_magentawhite.png index 85ee8cafe3..6119bda174 100644 Binary files a/doc/images/palettes/palette_magentawhite.png and b/doc/images/palettes/palette_magentawhite.png differ diff --git a/doc/images/palettes/palette_magentayellow.png b/doc/images/palettes/palette_magentayellow.png index 779a7ceca8..32446dc95a 100644 Binary files a/doc/images/palettes/palette_magentayellow.png and b/doc/images/palettes/palette_magentayellow.png differ diff --git a/doc/images/palettes/palette_magma.png b/doc/images/palettes/palette_magma.png new file mode 100644 index 0000000000..1c96eb9c6c Binary files /dev/null and b/doc/images/palettes/palette_magma.png differ diff --git a/doc/images/palettes/palette_ocean.png b/doc/images/palettes/palette_ocean.png index 89c8ff64b8..060c35caf5 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_plasma.png b/doc/images/palettes/palette_plasma.png new file mode 100644 index 0000000000..447592112e Binary files /dev/null and b/doc/images/palettes/palette_plasma.png differ diff --git a/doc/images/palettes/palette_rainbow.png b/doc/images/palettes/palette_rainbow.png index cc87320b82..5d9b9887db 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 ba8fc16253..c1ec3a1a80 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_redblue.png b/doc/images/palettes/palette_redblue.png index 4bcbbc12f6..02c37f05f3 100644 Binary files a/doc/images/palettes/palette_redblue.png and b/doc/images/palettes/palette_redblue.png differ diff --git a/doc/images/palettes/palette_redgreenblue.png b/doc/images/palettes/palette_redgreenblue.png index 8247d4ef42..6846bcedc2 100644 Binary files a/doc/images/palettes/palette_redgreenblue.png and b/doc/images/palettes/palette_redgreenblue.png differ diff --git a/doc/images/palettes/palette_redwhiteblue.png b/doc/images/palettes/palette_redwhiteblue.png index bfcfb433fe..2ee2abafaf 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_seismic.png b/doc/images/palettes/palette_seismic.png new file mode 100644 index 0000000000..4cffa0be98 Binary files /dev/null and b/doc/images/palettes/palette_seismic.png differ diff --git a/doc/images/palettes/palette_stepsBlGn.png b/doc/images/palettes/palette_stepsBlGn.png index 22a2ef764c..3d06760191 100644 Binary files a/doc/images/palettes/palette_stepsBlGn.png and b/doc/images/palettes/palette_stepsBlGn.png differ diff --git a/doc/images/palettes/palette_stepsBrBG.png b/doc/images/palettes/palette_stepsBrBG.png index 55783cbbc5..a4c07f3971 100644 Binary files a/doc/images/palettes/palette_stepsBrBG.png and b/doc/images/palettes/palette_stepsBrBG.png differ diff --git a/doc/images/palettes/palette_stepsGnBl.png b/doc/images/palettes/palette_stepsGnBl.png index 0fdee278a1..6b2fdd8e30 100644 Binary files a/doc/images/palettes/palette_stepsGnBl.png and b/doc/images/palettes/palette_stepsGnBl.png differ diff --git a/doc/images/palettes/palette_stepsPuOr.png b/doc/images/palettes/palette_stepsPuOr.png index face322f03..0d84f84abf 100644 Binary files a/doc/images/palettes/palette_stepsPuOr.png and b/doc/images/palettes/palette_stepsPuOr.png differ diff --git a/doc/images/palettes/palette_stepsYeGnBu.png b/doc/images/palettes/palette_stepsYeGnBu.png index c66a0b03c2..0b7cb565af 100644 Binary files a/doc/images/palettes/palette_stepsYeGnBu.png and b/doc/images/palettes/palette_stepsYeGnBu.png differ diff --git a/doc/images/palettes/palette_terrain.png b/doc/images/palettes/palette_terrain.png new file mode 100644 index 0000000000..feb0ba208a Binary files /dev/null and b/doc/images/palettes/palette_terrain.png differ diff --git a/doc/images/palettes/palette_trafficlight.png b/doc/images/palettes/palette_trafficlight.png index d8c22214d9..3341d04873 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_viridis.png b/doc/images/palettes/palette_viridis.png new file mode 100644 index 0000000000..7ea45f5adc Binary files /dev/null and b/doc/images/palettes/palette_viridis.png differ diff --git a/doc/images/palettes/palette_whitecyan.png b/doc/images/palettes/palette_whitecyan.png index 584aee50f0..ed1a56a291 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 7906b06105..8f4ffefff5 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 6710920bbc..6619d5e83f 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_yellow.png b/doc/images/palettes/palette_yellow.png index 2a73c69ce1..cfc3966264 100644 Binary files a/doc/images/palettes/palette_yellow.png and b/doc/images/palettes/palette_yellow.png differ diff --git a/doc/images/palettes/palette_yellowmagenta.png b/doc/images/palettes/palette_yellowmagenta.png index 97f4923238..0cb0cee2c9 100644 Binary files a/doc/images/palettes/palette_yellowmagenta.png and b/doc/images/palettes/palette_yellowmagenta.png differ diff --git a/doc/images/palettes/palette_yellowwhite.png b/doc/images/palettes/palette_yellowwhite.png index 364174f8ea..df09f46e17 100644 Binary files a/doc/images/palettes/palette_yellowwhite.png and b/doc/images/palettes/palette_yellowwhite.png differ diff --git a/doc/template_verbatimgraph.txt b/doc/template_verbatimgraph.txt new file mode 100644 index 0000000000..36ec0b49fd --- /dev/null +++ b/doc/template_verbatimgraph.txt @@ -0,0 +1,19 @@ + \verbatim + colval + ^ + | + 250 - + | + 200 - + | + 150 - + | + 100 - + | + 50 - + | + 0 - + | + ---|----|----|----|----|----|----|----|----|----|----|--> position + 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 + \endverbatim diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7223e7c7db..1e1c9adbf0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -29,6 +29,7 @@ add_subdirectory(filledgraphs) add_subdirectory(functionplot) add_subdirectory(geometric) add_subdirectory(imageplot) +add_subdirectory(imageplot_userpal) add_subdirectory(imageplot_modifier) add_subdirectory(imageplot_nodatastore) add_subdirectory(imageplot_opencv) diff --git a/examples/README.md b/examples/README.md index 47408179b2..9bbc0b546c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -42,6 +42,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int |:-------------:| ------------- | ------------- | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/rgbimageplot_qt_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/rgbimageplot_qt) | [`QImage` as a Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/rgbimageplot_qt) | `JKQTPImage`
`QImage` drawn onto a plot with arbitrary scaling
inverted coordinate axes | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot) | [Basic 1-channel Raw C Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot) | `JKQTPColumnMathImage`
image data copied from C-style row-major array into a single column of the internal datastore
Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.) | +| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_userpal_program_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_userpal) | [Image Plots with User-Defined Palettes](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_userpal) | `JKQTPColumnMathImage`
user-defines palettes
palettes from files | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_modifier_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_modifier) | [Modifier-Feature of Image Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_modifier) | `JKQTPColumnMathImage`
image data copied from C-style row-major array into a single column of the internal datastore
Image is modified by a second image to display two data dimensions at the same time | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_nodatastore_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_nodatastore) | [Basic 1-channel Raw C Image Plot
without the internal datastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_nodatastore) | `JKQTPMathImage`
image data in a C-style row-major array, not using internal datastore | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/rgbimageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/rgbimageplot) | [Simple 3-channel Math RGB/CMY Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/rgbimageplot) | `JKQTPColumnRGBMathImage`
image data in a C-style row-major array, not using internal datastore
RGB/CMY color compositing | diff --git a/examples/imageplot_userpal/CMakeLists.txt b/examples/imageplot_userpal/CMakeLists.txt new file mode 100644 index 0000000000..b5b800b322 --- /dev/null +++ b/examples/imageplot_userpal/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.0) + +set(EXAMPLE_NAME imageplot_userpal) +set(EXENAME jkqtptest_${EXAMPLE_NAME}) + +message( STATUS ".. Building Example ${EXAMPLE_NAME}" ) + + +# Set up source files +set(SOURCES ${EXAMPLE_NAME}.cpp) +set(HEADERS ) +set(RESOURCES imageplot_userpal.qrc ) +set(UIS ) + +add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS}) +target_include_directories(${EXENAME} PRIVATE ../../lib) +if(BUILD_STATIC_LIBS) + target_link_libraries(${EXENAME} JKQTPlotterLib) +elseif(BUILD_SHARED_LIBS) + target_link_libraries(${EXENAME} JKQTPlotterSharedLib) +endif() + + + +# Installation +if(LIB_INSTALL) + install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif(LIB_INSTALL) diff --git a/examples/imageplot_userpal/README.md b/examples/imageplot_userpal/README.md new file mode 100644 index 0000000000..e724cd2daf --- /dev/null +++ b/examples/imageplot_userpal/README.md @@ -0,0 +1,210 @@ +# Example (JKQTPlotter): Image Plots with Custom Palettes {#JKQTPlotterImagePlotUserPalette} + +This project (see `./examples/imageplot_userpal/`) demonstrates how to use user-defined color-palettes for image plots. +The source code of the main application is (see [`imageplot_userpal.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_userpal/imageplot_userpal.cpp)). + +# Build Palettes Programmatically + +JKQTPlotter comes with a large set of predefined color palettes, which are enumerated in `JKQTPMathImageColorPalette`. +In addition you can build your own palettes as simple lookup-tables of type `JKQTPImageTools::LUTType` (which is a `QVector`) and register them in the system (using `JKQTPImageTools::registerPalette()`). There are several options available for building such a palette: +1. you can simply define a palette from single colors: +```.cpp + JKQTPImageTools::LUTType pal{ + QColor("blue").rgb(), + QColor("green").rgb(), + QColor("white").rgb(), + QColor("yellow").rgb(), + QColor("red").rgb(), + QColor("red").rgb() + }; +``` + Such a palette will have exactly as many entries, as you specified: ![palsimple](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_userpal_palsimple.png) +2. Alternatively you can build a palette from a set of colors with assocziated positions on the values axis (typically 0..1 as these are in any way later mapped to the actual data range): +```.cpp + QList > palsteps2; + palsteps2<(0.00, QColor("blue").rgba()); + palsteps2<(0.05, QColor("green").rgba()); + palsteps2<(0.45, QColor("white").rgba()); + palsteps2<(0.55, QColor("yellow").rgba()); + palsteps2<(0.95, QColor("red").rgba()); + palsteps2<(1.00, QColor("red").rgba()); + + pal=JKQTPBuildColorPaletteLUT(palsteps2, JKQTPImageTools::LUTSIZE); +``` + Such a palette will have `JKQTPImageTools::LUTSIZE (=255)` entries and the colors are not spaced equally: ![palsteps2](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_userpal_palsteps2.png) +3. The palettes so far had steps, but you can also give a series of nodes with positions (on the value axis) and RGB-colors there (e.g. `palsteps2` above) but then linearly interpolate between these by calling: +```.cpp + pal=JKQTPBuildColorPaletteLUTLinInterpolate(palsteps2, JKQTPImageTools::LUTSIZE); +``` + The resulting LUT is then: ![imageplot_userpal_2_linear](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_userpal_2_linear.png) +4. Finally there is a second way of linear interpolation, where linear segments are given for the three color channels separately. To use such a definition, call `JKQTPBuildColorPaletteLUTLinSegments` instead (see documenttaion there). + +For each of these options, you finally call `JKQTPImageTools::registerPalette()` to make them known to the system: +```.cpp + int userpalette_id=JKQTPImageTools::registerPalette("userpal_computer_readable_name", pal, QObject::tr("User Palette Human-Readable Name")); +``` +This function returns an integer, which you can cast to a `JKQTPMathImageColorPalette` to use your new palette: +```.cpp + JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(plot); + // ... + graph->setPalette(static_cast(userpalette_id)); +``` + +# Load Palettes from Files + +In addition to building palettes/LUTs programmatically, as shown above, you can simply load palettes from files using: +```.cpp + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/All_idl_cmaps.xml"); +``` + +This function may load different file formats (discriminated by the extension): +1. XML-files (extension `.xml`) may contain one or more color palettes and should be formatted as follows: +```.xml + + + + ... + +``` + or with several palettes in one file: +```.xml + + + + + ... + + + + + ... + + ... + +``` + +2. CSV-files (extensions `.csv`, `.rgb`, `.pal`) are simply a list of 3 or 4 comma-separated values: +``` + red, green, blue + red, green, blue + ... +``` + or: +``` + scalar, red, green, blue + scalar, red, green, blue + ... +``` + +By default the palettes are simply read from the files as raw data. Alternatively you can linearly interpolate between the nodes in the file by calling +```.cpp + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/All_idl_cmaps.xml", true); +``` + +Examples for such palette files can be found here: [/examples/imageplot_userpal/palettes/](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_userpal/palettes/) + +# Main Program of the Example (GUI) + +The rest of the example program [`imageplot_userpal.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/imageplot_userpal/imageplot_userpal.cpp) just generates a 2D function plot as a color-map and displays it ... +```.cpp + // 1. create a window containing a plotter and a combobox to select the color palette + // ... and get a pointer to the internal datastore (for convenience) + QWidget win; + QVBoxLayout* lay=new QVBoxLayout(); + win.setLayout(lay); + JKQTPMathImageColorPaletteComboBox* cmbPalette=new JKQTPMathImageColorPaletteComboBox(&win); + lay->addWidget(cmbPalette); + JKQTPlotter* plot=new JKQTPlotter(&win); + lay->addWidget(plot); + JKQTPDatastore* ds=plot->getDatastore(); + + // 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg) + const int NX=100; // image dimension in x-direction [pixels] + const int NY=NX; // image dimension in x-direction [pixels] + const double dx=0.6e-2; // size of a pixel in x-direction [micrometers] + const double dy=0.6e-2; // size of a pixel in x-direction [micrometers] + + // 2.1 Parameters for airy disk plot (see https://en.wikipedia.org/wiki/Airy_disk) + double NA=1.1; // numerical aperture of lens + double wavelength=488e-3; // wavelength of the light [micrometers] + + // 2.2 calculate image of airy disk in a row-major array and immediately store the values + // in a new image column cAiryDisk + size_t cAiryDisk=ds->addCalculatedImageColumn(NX, NY, [&](size_t ix, size_t iy)->double { + double x=static_cast(static_cast(ix)-NX/2)*dx; + double y=static_cast(static_cast(iy)-NY/2)*dy; + const double r=sqrt(x*x+y*y); + const double v=2.0*M_PI*NA*r/wavelength; + if (ix==NX/2 && iy==NY/2) return 1.0; + else return pow(2.0*j1(v)/v, 2); + }, "imagedata"); + + + + + // 3. create a graph (JKQTPColumnMathImage) with the column created above as data + // The data is color-coded with the color-palette JKQTPMathImageMATLAB + // the converted range of data is determined automatically because setAutoImageRange(true) + JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(plot); + graph->setTitle("default MATLAB palette"); + // set the image column with the data + graph->setImageColumn(cAiryDisk); + // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner) + graph->setX(0); + graph->setY(0); + // width and height of the image in plot-axis-coordinates + graph->setWidth(1); + graph->setHeight(1); + // color-map is taken from cmbPalette + plot->connect(cmbPalette, &JKQTPMathImageColorPaletteComboBox::currentPaletteChanged,[&](JKQTPMathImageColorPalette p) { graph->setPalette(p); plot->redrawPlot(); }); + cmbPalette->setCurrentColorPalette(graph->getPalette()); + + + // 4. add the graphs to the plot, so it is actually displayed + plot->addGraph(graph); + + + // 5. fix axis and plot aspect ratio to 1 + plot->getPlotter()->setMaintainAspectRatio(true); + plot->getPlotter()->setMaintainAxisAspectRatio(true); + + // 6. autoscale the plot so the graph is contained + plot->zoomToFit(); + + + // 8. show plotter and make it a decent size + win.show(); + win.resize(500,550); + win.setWindowTitle("JKQTPColumnMathImage, User Palettes"); +``` +...along with a `JKQTPMathImageColorPaletteComboBox` to select a colormap and redraw the plot: +```.cpp + JKQTPMathImageColorPaletteComboBox* cmbPalette=new JKQTPMathImageColorPaletteComboBox(&win); + // ... + plot->connect(cmbPalette, &JKQTPMathImageColorPaletteComboBox::currentPaletteChanged,[&](JKQTPMathImageColorPalette p) { graph->setPalette(p); plot->redrawPlot(); }); + cmbPalette->setCurrentColorPalette(graph->getPalette()); +``` + +It also adds two `QPushButton`s that allow to save the current or all registered color-palettes to small PNG-Files: +```.cpp + QPushButton* btnSavePal=new QPushButton(QObject::tr("save current palette"), &win); + btnSavePal->connect(btnSavePal, &QPushButton::clicked, [&]() { + auto img=JKQTPImageTools::GetPaletteImage(cmbPalette->currentColorPalette(), JKQTPImageTools::LUTSIZE, 16); + img.save(JKQTPImageTools::JKQTPMathImageColorPalette2String(cmbPalette->currentColorPalette())+".png"); + }); + lay->addWidget(btnSavePal); + QPushButton* btnSaveAllPal=new QPushButton(QObject::tr("save all palettes"), &win); + btnSavePal->connect(btnSaveAllPal, &QPushButton::clicked, [&]() { + for (auto pn: JKQTPImageTools::getPredefinedPalettes()) { + auto p=JKQTPImageTools::String2JKQTPMathImageColorPalette(pn); + auto img=JKQTPImageTools::GetPaletteImage(p, JKQTPImageTools::LUTSIZE, 16); + img.save("palette_"+JKQTPImageTools::JKQTPMathImageColorPalette2String(p)+".png"); + } + }); + lay->addWidget(btnSaveAllPal); +``` + +The whole program looks like this: + +![imageplot_userpal_program](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/imageplot_userpal_program.png) + diff --git a/examples/imageplot_userpal/imageplot_userpal.cpp b/examples/imageplot_userpal/imageplot_userpal.cpp new file mode 100644 index 0000000000..b8c28b4ca0 --- /dev/null +++ b/examples/imageplot_userpal/imageplot_userpal.cpp @@ -0,0 +1,173 @@ +/** \example imageplot_userpal.cpp + * Shows how to plot colored math images/matrices with JKQTPlotter, using user-defined image palettes + * + * \ref JKQTPlotterImagePlot + */ + +#include +#include +#include +#include +#include +#include "jkqtplotter/jkqtplotter.h" +#include "jkqtplotter/graphs/jkqtpimage.h" +#include "jkqtplotter/gui/jkqtpcomboboxes.h" +#include "jkqtcommon/jkqtpbasicimagetools.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + + // 0. tell the library where to find additional palettes. + // this needs to be done BEFORE first using JKQTPlotter + // 0.1 first we want to build a user-defined palette with five colors + // from a simple list of these colors: + JKQTPImageTools::LUTType pal{ + QColor("blue").rgb(), + QColor("green").rgb(), + QColor("white").rgb(), + QColor("yellow").rgb(), + QColor("red").rgb(), + QColor("red").rgb() + }; + JKQTPImageTools::registerPalette("userpal_list", pal, QObject::tr("User Palette simple list")); + + // 0.2 first we want to build a user-defined palette with five colors + // the function JKQTPBuildColorPaletteLUT builds a full-sized palette + // with steps from the given 5 colors. + // Note that you need to double the last color in order to define its range's + // beginning and end + QList > palsteps1; + palsteps1<(0.0, QColor("blue").rgba()); + palsteps1<(0.2, QColor("green").rgba()); + palsteps1<(0.4, QColor("white").rgba()); + palsteps1<(0.6, QColor("yellow").rgba()); + palsteps1<(0.8, QColor("red").rgba()); + palsteps1<(1.0, QColor("red").rgba()); + JKQTPImageTools::registerPalette("userpal_1_steps", JKQTPBuildColorPaletteLUT(palsteps1), QObject::tr("User Palette 1, steps")); + + + // With the double value (first argument), you can determine where the next color + // band starts, with respect to the other colors. As an example, we make the central + // white band narrow, as well as the bands at the borders: + QList > palsteps2; + palsteps2<(0.00, QColor("blue").rgba()); + palsteps2<(0.05, QColor("green").rgba()); + palsteps2<(0.45, QColor("white").rgba()); + palsteps2<(0.55, QColor("yellow").rgba()); + palsteps2<(0.95, QColor("red").rgba()); + palsteps2<(1.00, QColor("red").rgba()); + int userpalette_id=JKQTPImageTools::registerPalette("userpal_2_steps", JKQTPBuildColorPaletteLUT(palsteps2), QObject::tr("User Palette 2, steps")); + + + // 0.2 If we use JKQTPBuildColorPaletteLUTLinInterpolate() instead of JKQTPBuildColorPaletteLUT(), + // the palettes will be smooth (linearly interpolated between the single given colors: + JKQTPImageTools::registerPalette("userpal_1_linear", JKQTPBuildColorPaletteLUTLinInterpolate(palsteps1), QObject::tr("User Palette 1, linear")); + JKQTPImageTools::registerPalette("userpal_2_linear", JKQTPBuildColorPaletteLUTLinInterpolate(palsteps2), QObject::tr("User Palette 2, linear")); + + // 0.3 Now we load a whole set of additional palettes from an XML-file: + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/All_idl_cmaps.xml"); + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/All_mpl_cmaps.xml"); + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/CoolWarmUChar33.csv"); + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/CoolWarmUChar257.csv"); + JKQTPImageTools::registerPalettesFromFile(":/usercolorpalettes/palettes/NSW_Discrete_Z_ColorMap.xml"); + + + // 1. create a window containing a plotter and a combobox to select the color palette + // ... and get a pointer to the internal datastore (for convenience) + QWidget win; + QVBoxLayout* lay=new QVBoxLayout(); + win.setLayout(lay); + JKQTPMathImageColorPaletteComboBox* cmbPalette=new JKQTPMathImageColorPaletteComboBox(&win); + lay->addWidget(cmbPalette); + JKQTPlotter* plot=new JKQTPlotter(&win); + lay->addWidget(plot); + JKQTPDatastore* ds=plot->getDatastore(); + + // 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg) + const int NX=100; // image dimension in x-direction [pixels] + const int NY=NX; // image dimension in x-direction [pixels] + const double dx=0.6e-2; // size of a pixel in x-direction [micrometers] + const double dy=0.6e-2; // size of a pixel in x-direction [micrometers] + + // 2.1 Parameters for airy disk plot (see https://en.wikipedia.org/wiki/Airy_disk) + double NA=1.1; // numerical aperture of lens + double wavelength=488e-3; // wavelength of the light [micrometers] + + // 2.2 calculate image of airy disk in a row-major array and immediately store the values + // in a new image column cAiryDisk + size_t cAiryDisk=ds->addCalculatedImageColumn(NX, NY, [&](size_t ix, size_t iy)->double { + double x=static_cast(static_cast(ix)-NX/2)*dx; + double y=static_cast(static_cast(iy)-NY/2)*dy; + const double r=sqrt(x*x+y*y); + const double v=2.0*M_PI*NA*r/wavelength; + if (ix==NX/2 && iy==NY/2) return 1.0; + else return pow(2.0*j1(v)/v, 2); + }, "imagedata"); + + + + + // 3. create a graph (JKQTPColumnMathImage) with the column created above as data + // The data is color-coded with the color-palette JKQTPMathImageMATLAB + // the converted range of data is determined automatically because setAutoImageRange(true) + JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(plot); + graph->setTitle("default MATLAB palette"); + // set the image column with the data + graph->setImageColumn(cAiryDisk); + // where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner) + graph->setX(0); + graph->setY(0); + // width and height of the image in plot-axis-coordinates + graph->setWidth(1); + graph->setHeight(1); + // color-map is taken from cmbPalette + plot->connect(cmbPalette, &JKQTPMathImageColorPaletteComboBox::currentPaletteChanged,[&](JKQTPMathImageColorPalette p) { graph->setPalette(p); plot->redrawPlot(); }); + graph->setPalette(static_cast(userpalette_id)); + cmbPalette->setCurrentColorPalette(graph->getPalette()); + + + // 4. add the graphs to the plot, so it is actually displayed + plot->addGraph(graph); + + + // 5. fix axis and plot aspect ratio to 1 + plot->getPlotter()->setMaintainAspectRatio(true); + plot->getPlotter()->setMaintainAxisAspectRatio(true); + + // 6. autoscale the plot so the graph is contained + plot->zoomToFit(); + + + // 7. Finally we add two buttons that save the current palette to a PNG-file and all loaded palettes: + QPushButton* btnSavePal=new QPushButton(QObject::tr("save current palette"), &win); + btnSavePal->connect(btnSavePal, &QPushButton::clicked, [&]() { + auto img=JKQTPImageTools::GetPaletteImage(cmbPalette->currentColorPalette(), JKQTPImageTools::LUTSIZE, 16); + img.save(JKQTPImageTools::JKQTPMathImageColorPalette2String(cmbPalette->currentColorPalette())+".png"); + }); + lay->addWidget(btnSavePal); + QPushButton* btnSaveAllPal=new QPushButton(QObject::tr("save all palettes"), &win); + btnSavePal->connect(btnSaveAllPal, &QPushButton::clicked, [&]() { + for (auto pn: JKQTPImageTools::getPredefinedPalettes()) { + auto p=JKQTPImageTools::String2JKQTPMathImageColorPalette(pn); + auto img=JKQTPImageTools::GetPaletteImage(p, JKQTPImageTools::LUTSIZE, 16); + img.save("palette_"+JKQTPImageTools::JKQTPMathImageColorPalette2String(p)+".png"); + } + }); + lay->addWidget(btnSaveAllPal); + + + + // 8. show plotter and make it a decent size + win.show(); + win.resize(500,550); + win.setWindowTitle("JKQTPColumnMathImage, USer Palettes"); + + + return app.exec(); +} diff --git a/examples/imageplot_userpal/imageplot_userpal.pro b/examples/imageplot_userpal/imageplot_userpal.pro new file mode 100644 index 0000000000..35df32608b --- /dev/null +++ b/examples/imageplot_userpal/imageplot_userpal.pro @@ -0,0 +1,27 @@ +# source code for this simple demo +SOURCES = imageplot_userpal.cpp + +# configure Qt +CONFIG += link_prl qt +QT += core gui xml svg +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + +# output executable name +TARGET = imageplot_userpal + +# include JKQTPlotter source code +DEPENDPATH += ../../lib ../../qmake/staticlib/jkqtplotterlib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release) { + LIBS += -L../../qmake/staticlib/jkqtplotterlib/debug -ljkqtplotterlib_debug +} else { + LIBS += -L../../qmake/staticlib/jkqtplotterlib/release -ljkqtplotterlib +} +message("LIBS = $$LIBS") + +win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX + + + + diff --git a/examples/imageplot_userpal/imageplot_userpal.qrc b/examples/imageplot_userpal/imageplot_userpal.qrc new file mode 100644 index 0000000000..4a46b408b7 --- /dev/null +++ b/examples/imageplot_userpal/imageplot_userpal.qrc @@ -0,0 +1,9 @@ + + + palettes/All_idl_cmaps.xml + palettes/All_mpl_cmaps.xml + palettes/CoolWarmUChar33.csv + palettes/CoolWarmUChar257.csv + palettes/NSW_Discrete_Z_ColorMap.xml + + diff --git a/examples/imageplot_userpal/imageplot_userpal_and_lib.pro b/examples/imageplot_userpal/imageplot_userpal_and_lib.pro new file mode 100644 index 0000000000..cd086ab132 --- /dev/null +++ b/examples/imageplot_userpal/imageplot_userpal_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib imageplot + +jkqtplotterlib.file = ../../qmake/staticlib/jkqtplotterlib/jkqtplotterlib.pro + +imageplot.file=$$PWD/imageplot.pro +imageplot.depends = jkqtplotterlib diff --git a/examples/imageplot_userpal/palettes/All_idl_cmaps.xml b/examples/imageplot_userpal/palettes/All_idl_cmaps.xml new file mode 100644 index 0000000000..3df5a00bbe --- /dev/null +++ b/examples/imageplot_userpal/palettes/All_idl_cmaps.xml @@ -0,0 +1,10581 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/imageplot_userpal/palettes/All_mpl_cmaps.xml b/examples/imageplot_userpal/palettes/All_mpl_cmaps.xml new file mode 100644 index 0000000000..efc094000c --- /dev/null +++ b/examples/imageplot_userpal/palettes/All_mpl_cmaps.xml @@ -0,0 +1,12903 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/imageplot_userpal/palettes/CoolWarmUChar257.csv b/examples/imageplot_userpal/palettes/CoolWarmUChar257.csv new file mode 100644 index 0000000000..b1e2c5679b --- /dev/null +++ b/examples/imageplot_userpal/palettes/CoolWarmUChar257.csv @@ -0,0 +1,258 @@ +Scalar,R,G,B +0,59,76,192 +0.00390625,60,78,194 +0.0078125,61,80,195 +0.01171875,62,81,197 +0.015625,63,83,198 +0.01953125,64,85,200 +0.0234375,66,87,201 +0.02734375,67,88,203 +0.03125,68,90,204 +0.03515625,69,92,206 +0.0390625,70,93,207 +0.04296875,71,95,209 +0.046875,73,97,210 +0.05078125,74,99,211 +0.0546875,75,100,213 +0.05859375,76,102,214 +0.0625,77,104,215 +0.06640625,79,105,217 +0.0703125,80,107,218 +0.07421875,81,109,219 +0.078125,82,110,221 +0.08203125,84,112,222 +0.0859375,85,114,223 +0.08984375,86,115,224 +0.09375,87,117,225 +0.09765625,89,119,226 +0.1015625,90,120,228 +0.10546875,91,122,229 +0.109375,93,123,230 +0.11328125,94,125,231 +0.1171875,95,127,232 +0.12109375,96,128,233 +0.125,98,130,234 +0.12890625,99,131,235 +0.1328125,100,133,236 +0.13671875,102,135,237 +0.140625,103,136,238 +0.14453125,104,138,239 +0.1484375,106,139,239 +0.15234375,107,141,240 +0.15625,108,142,241 +0.16015625,110,144,242 +0.1640625,111,145,243 +0.16796875,112,147,243 +0.171875,114,148,244 +0.17578125,115,150,245 +0.1796875,116,151,246 +0.18359375,118,153,246 +0.1875,119,154,247 +0.19140625,120,156,247 +0.1953125,122,157,248 +0.19921875,123,158,249 +0.203125,124,160,249 +0.20703125,126,161,250 +0.2109375,127,163,250 +0.21484375,129,164,251 +0.21875,130,165,251 +0.22265625,131,167,252 +0.2265625,133,168,252 +0.23046875,134,169,252 +0.234375,135,171,253 +0.23828125,137,172,253 +0.2421875,138,173,253 +0.24609375,140,174,254 +0.25,141,176,254 +0.25390625,142,177,254 +0.2578125,144,178,254 +0.26171875,145,179,254 +0.265625,147,181,255 +0.26953125,148,182,255 +0.2734375,149,183,255 +0.27734375,151,184,255 +0.28125,152,185,255 +0.28515625,153,186,255 +0.2890625,155,187,255 +0.29296875,156,188,255 +0.296875,158,190,255 +0.30078125,159,191,255 +0.3046875,160,192,255 +0.30859375,162,193,255 +0.3125,163,194,255 +0.31640625,164,195,254 +0.3203125,166,196,254 +0.32421875,167,197,254 +0.328125,168,198,254 +0.33203125,170,199,253 +0.3359375,171,199,253 +0.33984375,172,200,253 +0.34375,174,201,253 +0.34765625,175,202,252 +0.3515625,176,203,252 +0.35546875,178,204,251 +0.359375,179,205,251 +0.36328125,180,205,251 +0.3671875,182,206,250 +0.37109375,183,207,250 +0.375,184,208,249 +0.37890625,185,208,248 +0.3828125,187,209,248 +0.38671875,188,210,247 +0.390625,189,210,247 +0.39453125,190,211,246 +0.3984375,192,212,245 +0.40234375,193,212,245 +0.40625,194,213,244 +0.41015625,195,213,243 +0.4140625,197,214,243 +0.41796875,198,214,242 +0.421875,199,215,241 +0.42578125,200,215,240 +0.4296875,201,216,239 +0.43359375,203,216,238 +0.4375,204,217,238 +0.44140625,205,217,237 +0.4453125,206,217,236 +0.44921875,207,218,235 +0.453125,208,218,234 +0.45703125,209,219,233 +0.4609375,210,219,232 +0.46484375,211,219,231 +0.46875,213,219,230 +0.47265625,214,220,229 +0.4765625,215,220,228 +0.48046875,216,220,227 +0.484375,217,220,225 +0.48828125,218,220,224 +0.4921875,219,220,223 +0.49609375,220,221,222 +0.5,221,221,221 +0.50390625,222,220,219 +0.5078125,223,220,218 +0.51171875,224,219,216 +0.515625,225,219,215 +0.51953125,226,218,214 +0.5234375,227,218,212 +0.52734375,228,217,211 +0.53125,229,216,209 +0.53515625,230,216,208 +0.5390625,231,215,206 +0.54296875,232,215,205 +0.546875,232,214,203 +0.55078125,233,213,202 +0.5546875,234,212,200 +0.55859375,235,212,199 +0.5625,236,211,197 +0.56640625,236,210,196 +0.5703125,237,209,194 +0.57421875,238,209,193 +0.578125,238,208,191 +0.58203125,239,207,190 +0.5859375,240,206,188 +0.58984375,240,205,187 +0.59375,241,204,185 +0.59765625,241,203,184 +0.6015625,242,202,182 +0.60546875,242,201,181 +0.609375,243,200,179 +0.61328125,243,199,178 +0.6171875,244,198,176 +0.62109375,244,197,174 +0.625,245,196,173 +0.62890625,245,195,171 +0.6328125,245,194,170 +0.63671875,245,193,168 +0.640625,246,192,167 +0.64453125,246,191,165 +0.6484375,246,190,163 +0.65234375,246,188,162 +0.65625,247,187,160 +0.66015625,247,186,159 +0.6640625,247,185,157 +0.66796875,247,184,156 +0.671875,247,182,154 +0.67578125,247,181,152 +0.6796875,247,180,151 +0.68359375,247,178,149 +0.6875,247,177,148 +0.69140625,247,176,146 +0.6953125,247,174,145 +0.69921875,247,173,143 +0.703125,247,172,141 +0.70703125,247,170,140 +0.7109375,247,169,138 +0.71484375,247,167,137 +0.71875,247,166,135 +0.72265625,246,164,134 +0.7265625,246,163,132 +0.73046875,246,161,131 +0.734375,246,160,129 +0.73828125,245,158,127 +0.7421875,245,157,126 +0.74609375,245,155,124 +0.75,244,154,123 +0.75390625,244,152,121 +0.7578125,244,151,120 +0.76171875,243,149,118 +0.765625,243,147,117 +0.76953125,242,146,115 +0.7734375,242,144,114 +0.77734375,241,142,112 +0.78125,241,141,111 +0.78515625,240,139,109 +0.7890625,240,137,108 +0.79296875,239,136,106 +0.796875,238,134,105 +0.80078125,238,132,103 +0.8046875,237,130,102 +0.80859375,236,129,100 +0.8125,236,127,99 +0.81640625,235,125,97 +0.8203125,234,123,96 +0.82421875,233,121,95 +0.828125,233,120,93 +0.83203125,232,118,92 +0.8359375,231,116,90 +0.83984375,230,114,89 +0.84375,229,112,88 +0.84765625,228,110,86 +0.8515625,227,108,85 +0.85546875,227,106,83 +0.859375,226,104,82 +0.86328125,225,102,81 +0.8671875,224,100,79 +0.87109375,223,98,78 +0.875,222,96,77 +0.87890625,221,94,75 +0.8828125,220,92,74 +0.88671875,218,90,73 +0.890625,217,88,71 +0.89453125,216,86,70 +0.8984375,215,84,69 +0.90234375,214,82,67 +0.90625,213,80,66 +0.91015625,212,78,65 +0.9140625,210,75,64 +0.91796875,209,73,62 +0.921875,208,71,61 +0.92578125,207,69,60 +0.9296875,205,66,59 +0.93359375,204,64,57 +0.9375,203,62,56 +0.94140625,202,59,55 +0.9453125,200,57,54 +0.94921875,199,54,53 +0.953125,198,51,52 +0.95703125,196,49,50 +0.9609375,195,46,49 +0.96484375,193,43,48 +0.96875,192,40,47 +0.97265625,190,37,46 +0.9765625,189,34,45 +0.98046875,188,30,44 +0.984375,186,26,43 +0.98828125,185,22,41 +0.9921875,183,17,40 +0.99609375,181,11,39 +1,180,4,38 \ No newline at end of file diff --git a/examples/imageplot_userpal/palettes/CoolWarmUChar33.csv b/examples/imageplot_userpal/palettes/CoolWarmUChar33.csv new file mode 100644 index 0000000000..5bc9c68283 --- /dev/null +++ b/examples/imageplot_userpal/palettes/CoolWarmUChar33.csv @@ -0,0 +1,34 @@ +Scalar,R,G,B +0,59,76,192 +0.03125,68,90,204 +0.0625,77,104,215 +0.09375,87,117,225 +0.125,98,130,234 +0.15625,108,142,241 +0.1875,119,154,247 +0.21875,130,165,251 +0.25,141,176,254 +0.28125,152,185,255 +0.3125,163,194,255 +0.34375,174,201,253 +0.375,184,208,249 +0.40625,194,213,244 +0.4375,204,217,238 +0.46875,213,219,230 +0.5,221,221,221 +0.53125,229,216,209 +0.5625,236,211,197 +0.59375,241,204,185 +0.625,245,196,173 +0.65625,247,187,160 +0.6875,247,177,148 +0.71875,247,166,135 +0.75,244,154,123 +0.78125,241,141,111 +0.8125,236,127,99 +0.84375,229,112,88 +0.875,222,96,77 +0.90625,213,80,66 +0.9375,203,62,56 +0.96875,192,40,47 +1,180,4,38 \ No newline at end of file diff --git a/examples/imageplot_userpal/palettes/NSW_Discrete_Z_ColorMap.xml b/examples/imageplot_userpal/palettes/NSW_Discrete_Z_ColorMap.xml new file mode 100644 index 0000000000..79ebaae4d8 --- /dev/null +++ b/examples/imageplot_userpal/palettes/NSW_Discrete_Z_ColorMap.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/jkqtcommon/CMakeLists.txt b/lib/jkqtcommon/CMakeLists.txt index 42c9d64690..af14ab1a20 100644 --- a/lib/jkqtcommon/CMakeLists.txt +++ b/lib/jkqtcommon/CMakeLists.txt @@ -73,7 +73,7 @@ if(BUILD_SHARED_LIBS) add_library(${libsh_name} SHARED ${SOURCES} ${HEADERS}) set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}") set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}") - target_link_libraries(${libsh_name} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport) + target_link_libraries(${libsh_name} Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport) target_compile_definitions(${libsh_name} PUBLIC JKQTCOMMON_LIB_IN_DLL) target_compile_definitions(${libsh_name} PRIVATE JKQTCOMMON_LIB_EXPORT_LIBRARY) set_property(TARGET ${libsh_name} PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS "ON") @@ -86,7 +86,7 @@ if(BUILD_STATIC_LIBS) add_library(${lib_name} STATIC ${SOURCES} ${HEADERS}) set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}") set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}") - target_link_libraries(${lib_name} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport) + target_link_libraries(${lib_name} Qt5::Core Qt5::Gui Qt5::Xml Qt5::Widgets Qt5::PrintSupport) write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion ) diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.cpp b/lib/jkqtcommon/jkqtpbasicimagetools.cpp index af2fa32605..b6dc9dfbe2 100644 --- a/lib/jkqtcommon/jkqtpbasicimagetools.cpp +++ b/lib/jkqtcommon/jkqtpbasicimagetools.cpp @@ -30,1732 +30,2760 @@ const int JKQTPImageTools::PALETTE_ICON_WIDTH = 64; const int JKQTPImageTools::PALETTE_IMAGEICON_HEIGHT = 64; const int JKQTPImageTools::LUTSIZE = 256; -QList JKQTPImageTools::global_jkqtpimagetools_lutstore = QList(); +QMap JKQTPImageTools::global_jkqtpimagetools_lutstore = JKQTPImageTools::getDefaultLUTs(); +int JKQTPImageTools::global_next_userpalette = JKQTPMathImageFIRST_REGISTERED_USER_PALETTE; -bool JKQTPImagePlot_buildDefinedPaletteLessThan(const QPair &s1, const QPair &s2) - { - return s1.first > items, int lut_size) { - qSort(items.begin(), items.end(), JKQTPImagePlot_buildDefinedPaletteLessThan); + + + + + + + + +QMap JKQTPImageTools::getDefaultLUTs() { + QMap lutstore; + + { + auto palette=JKQTPMathImageRED; + QString palN="red"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(static_cast(255.0*v), 0, 0); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageGREEN; + QString palN="green"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(0, static_cast(255.0*v), 0); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageBLUE; + QString palN="blue"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(0, 0, static_cast(255.0*v)); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageGRAY; + QString palN="gray"; + 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++) { + 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)); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageALPHA; + QString palN="alpha"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgba(255,255,255, + static_cast(255.0*v)); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageINVERTED_ALPHA; + QString palN="invAlpha"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgba(255,255,255, + static_cast(255.0*v)); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageINVERTEDRED; + QString palN="invred"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(static_cast(255.0*(1.0-v)), 0, 0); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageINVERTEDGREEN; + QString palN="invgreen"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(0, static_cast(255.0*(1.0-v)), 0); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageINVERTEDBLUE; + QString palN="invblue"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=qRgb(0, 0, static_cast(255.0*(1.0-v))); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageINVERTEDGRAY; + QString palN="invgray"; + 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++) { + 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)); + } + plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; + } + } + + + { + auto palette=JKQTPMathImageMATLAB; + QString palN="Matlab"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_MATLAB; + QString palN="invMatlab"; + 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--) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageRYGB; + QString palN="RYGB"; + 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++) { + 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; + + double g = 255.0 * std::sin(M_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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_RYGB; + QString palN="invRYGB"; + 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--) { + 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; + + double g = 255.0 * std::sin(M_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)); + } + } + } + + + { + auto palette=JKQTPMathImageHSV; + QString palN="HSV"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + int h = static_cast(floor(6*v)); + 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; + } + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_HSV; + QString palN="invHSV"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + int h = static_cast(floor(6.0-6.0*v)); + 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; + } + } + } + } + + + { + auto palette=JKQTPMathImageRAINBOW; + QString palN="rainbow"; + 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++) { + 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; + + double g = 255.0*sin(M_PI*v); + + double b = 255.0*cos(0.5*M_PI*v); + + plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_RAINBOW; + QString palN="invrainbow"; + 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--) { + 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; + + double g = 255.0*sin(M_PI*v); + + double b = 255.0*cos(0.5*M_PI*v); + + plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + } + } + } + + + { + auto palette=JKQTPMathImageHOT; + QString palN="AFMhot"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_HOT; + QString palN="invAFMhot"; + 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--) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageOCEAN; + QString palN="ocean"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + double r = 765.0*v-510.0; + if (r < 0.0) + r = 0.0; + + double g = std::abs(382.5*v-127.5); + + double b = 255.0*v; + plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_OCEAN; + QString palN="invocean"; + 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--) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = 765.0*v-510.0; + if (r < 0.0) + r = 0.0; + + double g = std::abs(382.5*v-127.5); + + double b = 255.0*v; + plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + } + } + } + + + { + auto palette=JKQTPMathImageBLUEMAGENTAYELLOW; + QString palN="BlMaYe"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW; + QString palN="YeMaBl"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageBLUEYELLOW; + QString palN="BlYe"; + 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++) { + 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(M_PI/2.0*v); + if (g < 0.0) g = 0.0; + if (g > 1.0) g = 1.0; + + double b = cos(M_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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_BLUEYELLOW; + QString palN="YeBl"; + 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++) { + 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(M_PI/2.0*v); + if (g < 0.0) g = 0.0; + if (g > 1.0) g = 1.0; + + double b = cos(M_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)); + } + } + } + + + { + auto palette=JKQTPMathImageCYAN; + QString palN="cyan"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_CYAN; + QString palN="invcyan"; + 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++) { + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageTRAFFICLIGHT; + QString palN="trafficlight"; + 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++) { + double v=l/static_cast(JKQTPImageTools::LUTSIZE); + double r = (v < 0.5) ? 128.0*sin(M_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); + } + } + } + + + { + auto palette=JKQTPMathImageINVERTED_TRAFFICLIGHT; + QString palN="invtrafficlight"; + 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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = (v < 0.5) ? 128.0*sin(M_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); + } + } + } + + + { + auto palette=JKQTPMathImageBLUEWHITERED; + QString palN="bluewhitered"; + QString palNT=QObject::tr("blue-white-red"); + lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); + QList > 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); + } + + + { + auto palette=JKQTPMathImageREDWHITEBLUE; + QString palN="redwhiteblue"; + QString palNT=QObject::tr("red-white-blue"); + lutstore[palette]=JKQTPImageTools::LUTData(QVector(JKQTPImageTools::LUTSIZE+1, 0), palN, palNT); + + QList > lst; + lst<(0.0, 0xFFB2182B); + lst<(1.0, 0xFFD6604D); + lst<(2.0, 0xFFF4A582); + lst<(3.0, 0xFFFDDBC7); + lst<(4.0, 0xFFD1E5F0); + lst<(5.0, 0xFF92C5DE); + lst<(6.0, 0xFF4393C3); + lst<(7.0, 0xFF2166AC); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst, JKQTPImageTools::LUTSIZE+1); + + } + + + { + auto palette=JKQTPMathImageBLACKBLUEREDYELLOW; + QString palN="BBlRdYe"; + QString palNT=QObject::tr("black-blue-red-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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = 255.0*qBound(0.0,sqrt(v),1.0); + double g = 255.0*qBound(0.0,v*v*v,1.0); + double b = 255.0*qBound(0.0,sin(2.0*M_PI*v),1.0); + + plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + } + } + } + + + { + auto palette=JKQTPMathImageGREENREDVIOLET; + QString palN="GnRdVi"; + 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = 255.0*qBound(0.0,v,1.0); + double g = 255.0*qBound(0.0,fabs(v-0.5),1.0); + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE; + QString palN="BWprint"; + 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); + double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK; + QString palN="invBWprint"; + 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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); + double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); + 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)); + } + } + } + + + { + auto palette=JKQTPMathImageBR_GR; + QString palN="BrBG"; + QString palNT=QObject::tr("BrBG"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); + lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); + lst<(2.0, qRgb(0xDF, 0xC2, 0x7D)); + lst<(3.0, 0xFFF6E8C3); + lst<(4.0, 0xFFC7EAE5); + lst<(5.0, 0xFF80CDC1); + lst<(6.0, 0xFF35978F); + lst<(7.0, 0xFF01665E); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageBR_GR_STEP; + QString palN="stepsBrBG"; + QString palNT=QObject::tr("steps: BrBG"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + + QList > lst; + lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); + lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); + lst<(2.0, qRgb(0xDF, 0xC2, 0x7D)); + lst<(3.0, 0xFFF6E8C3); + lst<(4.0, 0xFFC7EAE5); + lst<(5.0, 0xFF80CDC1); + lst<(6.0, 0xFF35978F); + lst<(7.0, 0xFF01665E); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUT(lst); + + } + + + { + auto palette=JKQTPMathImagePU_OR; + QString palN="PuOr"; + QString palNT=QObject::tr("PuOr"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(0.0, 0xFFB35806); + lst<(1.0, 0xFFE08214); + lst<(2.0, 0xFFFDB863); + lst<(3.0, 0xFFFEE0B6); + lst<(4.0, 0xFFF7F7F7); + lst<(5.0, 0xFFD8DAEB); + lst<(6.0, 0xFFB2ABD2); + lst<(7.0, 0xFF8073AC); + lst<(8.0, 0xFF542788); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImagePU_OR_STEP; + QString palN="stepsPuOr"; + QString palNT=QObject::tr("steps: PuOr"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(0.0, 0xFFB35806); + lst<(1.0, 0xFFE08214); + lst<(2.0, 0xFFFDB863); + lst<(3.0, 0xFFFEE0B6); + lst<(4.0, 0xFFF7F7F7); + lst<(5.0, 0xFFD8DAEB); + lst<(6.0, 0xFFB2ABD2); + lst<(7.0, 0xFF8073AC); + lst<(8.0, 0xFF542788); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUT(lst); + } + + + { + auto palette=JKQTPMathImageYL_GN_BU; + QString palN="YeGnBu"; + QString palNT=QObject::tr("YeGnBu"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(0.0, 0xFFFFFFD9); + lst<(1.0, 0xFFEDF8B1); + lst<(2.0, 0xFFC7E9B4); + lst<(3.0, 0xFF7FCDBB); + lst<(4.0, 0xFF41B6C4); + lst<(5.0, 0xFF1D91C0); + lst<(6.0, 0xFF225EA8); + lst<(7.0, 0xFF253494); + lst<(8.0, 0xFF081D58); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageYL_GN_BU_STEP; + QString palN="stepsYeGnBu"; + QString palNT=QObject::tr("steps: YeGnBu"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(0.0, 0xFFFFFFD9); + lst<(1.0, 0xFFEDF8B1); + lst<(2.0, 0xFFC7E9B4); + lst<(3.0, 0xFF7FCDBB); + lst<(4.0, 0xFF41B6C4); + lst<(5.0, 0xFF1D91C0); + lst<(6.0, 0xFF225EA8); + lst<(7.0, 0xFF253494); + lst<(8.0, 0xFF081D58); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUT(lst); + } + + + { + auto palette=JKQTPMathImageGN_BU; + QString palN="greenblue"; + QString palNT=QObject::tr("green-blue"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(0.0, 0xFFF7FCF0); + lst<(1.0, 0xFFE0F3DB); + lst<(2.0, 0xFFCCEBC5); + lst<(3.0, 0xFFA8DDB5); + lst<(4.0, 0xFF7BCCC4); + lst<(5.0, 0xFF4EB3D3); + lst<(6.0, 0xFF2B8CBE); + lst<(7.0, 0xFF0868AC); + lst<(8.0, 0xFF084081); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageGN_BU_STEP; + QString palN="stepsGnBl"; + QString palNT=QObject::tr("steps: green-blue"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(0.0, 0xFFF7FCF0); + lst<(1.0, 0xFFE0F3DB); + lst<(2.0, 0xFFCCEBC5); + lst<(3.0, 0xFFA8DDB5); + lst<(4.0, 0xFF7BCCC4); + lst<(5.0, 0xFF4EB3D3); + lst<(6.0, 0xFF2B8CBE); + lst<(7.0, 0xFF0868AC); + lst<(8.0, 0xFF084081); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUT(lst); + } + + + { + auto palette=JKQTPMathImageBU_GN; + QString palN="bluegreen"; + QString palNT=QObject::tr("blue-green"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(8.0, 0xFFF7FCF0); + lst<(7.0, 0xFFE0F3DB); + lst<(6.0, 0xFFCCEBC5); + lst<(5.0, 0xFFA8DDB5); + lst<(4.0, 0xFF7BCCC4); + lst<(3.0, 0xFF4EB3D3); + lst<(2.0, 0xFF2B8CBE); + lst<(1.0, 0xFF0868AC); + lst<(0.0, 0xFF084081); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageBU_GN_STEP; + QString palN="stepsBlGn"; + QString palNT=QObject::tr("steps: blue-green"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(8.0, 0xFFF7FCF0); + lst<(7.0, 0xFFE0F3DB); + lst<(6.0, 0xFFCCEBC5); + lst<(5.0, 0xFFA8DDB5); + lst<(4.0, 0xFF7BCCC4); + lst<(3.0, 0xFF4EB3D3); + lst<(2.0, 0xFF2B8CBE); + lst<(1.0, 0xFF0868AC); + lst<(0.0, 0xFF084081); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUT(lst); + } + + + { + auto palette=JKQTPMathImageINVERTED_MAGENTA; + QString palN="invmagenta"; + QString palNT=QObject::tr("inv. 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageMAGENTA; + QString palN="magenta"; + QString palNT=QObject::tr("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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageINVERTED_YELLOW; + QString palN="invyellow"; + QString palNT=QObject::tr("inv. 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageYELLOW; + QString palN="yellow"; + QString palNT=QObject::tr("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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageINVERTED_MAGENTAWHITE; + QString palN="whitemagenta"; + 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageMAGENTAWHITE; + QString palN="magentawhite"; + 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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageINVERTED_YELLOWWHITE; + QString palN="whiteyellow"; + 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageYELLOWWHITE; + QString palN="yellowwhite"; + 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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageINVERTED_CYANWHITE; + QString palN="whitecyan"; + 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++) { + double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageCYANWHITE; + QString palN="cyanwhite"; + 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++) { + double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); + plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); + } + + } + } + + + { + auto palette=JKQTPMathImageBlueGreenRed; + QString palN="bluegreenred"; + QString palNT=QObject::tr("blue-green-red"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(1.0, QColor("blue").rgb()); + lst<(2.0, QColor("green").rgb()); + lst<(3.0, QColor("red").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageRedGreenBlue; + QString palN="redgreenblue"; + QString palNT=QObject::tr("red-green-blue"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(1.0, QColor("red").rgb()); + lst<(2.0, QColor("green").rgb()); + lst<(3.0, QColor("blue").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageMagentaYellow; + QString palN="magentayellow"; + QString palNT=QObject::tr("magenta-yellow"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(1.0, QColor("magenta").rgb()); + lst<(2.0, QColor("yellow").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageYellowMagenta; + QString palN="yellowmagenta"; + QString palNT=QObject::tr("yellow-magenta"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(1.0, QColor("yellow").rgb()); + lst<(2.0, QColor("magenta").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageRedBlue; + QString palN="redblue"; + QString palNT=QObject::tr("red-blue"); + lutstore[palette]=JKQTPImageTools::LUTData(palN, palNT); + QList > lst; + lst<(1.0, QColor("red").rgb()); + lst<(2.0, QColor("blue").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + + { + auto palette=JKQTPMathImageBlueRed; + QString palN="bluered"; + QString palNT=QObject::tr("blue-red"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(1.0, QColor("blue").rgb()); + lst<(2.0, QColor("red").rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + { + auto palette=JKQTPMathImageSeismic; + QString palN="seismic"; + QString palNT=QObject::tr("seismic"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(0, QColor::fromRgbF(0.0, 0.0, 0.3).rgb()); + lst<(1, QColor::fromRgbF(0.0, 0.0, 1.0).rgb()); + lst<(2, QColor::fromRgbF(1.0, 1.0, 1.0).rgb()); + lst<(3, QColor::fromRgbF(1.0, 0.0, 0.0).rgb()); + lst<(4, QColor::fromRgbF(0.5, 0.0, 0.0).rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + { + auto palette=JKQTPMathImageTerrain; + QString palN="terrain"; + QString palNT=QObject::tr("terrain"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList > lst; + lst<(0.00, QColor::fromRgbF(0.2, 0.2, 0.6).rgb()); + lst<(0.15, QColor::fromRgbF(0.0, 0.6, 1.0).rgb()); + lst<(0.25, QColor::fromRgbF(0.0, 0.8, 0.4).rgb()); + lst<(0.50, QColor::fromRgbF(1.0, 1.0, 0.6).rgb()); + lst<(0.75, QColor::fromRgbF(0.5, 0.36, 0.33).rgb()); + lst<(1.00, QColor::fromRgbF(1.0, 1.0, 1.0).rgb()); + + lutstore[palette].lut=JKQTPBuildColorPaletteLUTLinInterpolate(lst); + } + + { + auto palette=JKQTPMathImageBone; + QString palN="bone"; + QString palNT=QObject::tr("bone"); + lutstore[palette]=JKQTPImageTools::LUTData( palN, palNT); + QList lstR,lstG,lstB; + lstR< lstR,lstG,lstB; + lstR< lstR,lstG,lstB; + lstR< lstR,lstG,lstB; + lstR< &s1, const QPair &s2) +{ + return s1.first > items, int lut_size) { + qSort(items.begin(), items.end(), JKQTPBuildColorPaletteLUTLessThan); + return JKQTPBuildColorPaletteLUTLinInterpolateSorted(items, lut_size); +} + + + +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUT(QList > items, int lut_size) { + qSort(items.begin(), items.end(), JKQTPBuildColorPaletteLUTLessThan); + return JKQTPBuildColorPaletteLUTSorted(items, lut_size); +} + +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUTLinSegments( QList itemsR, QList itemsG, QList itemsB, int lut_size) +{ + qSort(itemsR.begin(), itemsR.end(), JKQTPBuildColorPaletteLUTLinSegLessThan); + qSort(itemsG.begin(), itemsG.end(), JKQTPBuildColorPaletteLUTLinSegLessThan); + qSort(itemsB.begin(), itemsB.end(), JKQTPBuildColorPaletteLUTLinSegLessThan); + return JKQTPBuildColorPaletteLUTLinSegmentsSorted(itemsR, itemsG, itemsB, lut_size); +} + +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUTLinSegmentsSorted(const QList &itemsR, const QList &itemsG, const QList &itemsB, int lut_size) +{ + JKQTPImageTools::LUTType lut(lut_size, qRgb(255,255,255)); + if (itemsR.size()<=0 && itemsG.size()<=0 && itemsB.size()<=0) return lut; + + auto buildChannel=[](JKQTPImageTools::LUTType& lut, const QList &items, int channel) { + if (items.size()==1) { + for (int i=0; i(lut.size()-2); + double v=dmin; + int j1=0; + for (int i=0; i(static_cast(items[j2].colval_endprevious-items[j1].colval_startnext)*local_relV); + + JKQTPSetColorChannel(lut[i], channel, jkqtp_bounded(0, newCol, 255)); + //qDebug()<<"i="< lut[i]=0x"<=items[j1].position && v>=items[j2].position && j1 > &items, int lut_size) +{ + JKQTPImageTools::LUTType lut(lut_size, 0); + if (items.size()<=1) return lut; + double dmin=items.first().first; + double dmax=items.last().first; + double delta=(dmax-dmin)/static_cast(lut_size-2); + double v=dmin; + int j1=0; + for (int i=0; i(r), static_cast(g), static_cast(b)); + v+=delta; + // advance over items, if v crosses items[j2].first + while (v>=items[j1].first && v>=items[j2].first && j1 > &items, int lut_size) +{ + JKQTPImageTools::LUTType lut(lut_size+1, 0); double dmin=items.first().first; double dmax=items.last().first; double delta=(dmax-dmin)/double(lut_size); int i=0; int j=0; for (double v=dmin; v<=dmax; v=v+delta) { - double r=0; - double g=0; - double b=0; - if (j+1=items[j+1].first) j++; - } else { - r=double(qRed(items.last().second)); - g=double(qGreen(items.last().second)); - b=double(qBlue(items.last().second)); - } - if (i<=lut_size) lut[i]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - i++; + double r=0; + double g=0; + double b=0; + if (j+1=items[j+1].first) j++; + } + if (i<=lut_size) lut[i]=qRgb(static_cast(r), static_cast(g), static_cast(b)); + i++; } -} - -void JKQTPImagePlot_buildDefinedPaletteLinInterpolate(int* lut, int N, ...) { - QList > items; - - va_list args; - va_start(args, N); - - for (int i=0; i > items) { - qSort(items.begin(), items.end(), JKQTPImagePlot_buildDefinedPaletteLessThan); - - double dmin=items.first().first; - double dmax=items.last().first; - double delta=(dmax-dmin)/double(JKQTPImageTools::LUTSIZE); - int i=0; - int j=0; - for (double v=dmin; v<=dmax; v=v+delta) { - double r=0; - double g=0; - double b=0; - if (j+1=items[j+1].first) j++; - } - if (i<=JKQTPImageTools::LUTSIZE) lut[i]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - i++; +JKQTPImageTools::LUTType JKQTPBuildColorPaletteLUTLinInterpolate(const QMap &items, int lut_size) +{ + QList > itemsi; + for (auto it=items.begin(); it!=items.end(); ++it) { + itemsi.append(qMakePair(it.key(), it.value())); } + return JKQTPBuildColorPaletteLUTLinInterpolateSorted(itemsi, lut_size); } -void JKQTPImagePlot_buildDefinedPalette(int* lut, int N, ...) { - QList > items; - - va_list args; - va_start(args, N); - - for (int i=0; i &items, int lut_size) +{ + QList > itemsi; + for (auto it=items.begin(); it!=items.end(); ++it) { + itemsi.append(qMakePair(it.key(), it.value())); } - - va_end(args); - - JKQTPImagePlot_buildDefinedPalette(lut, items); + return JKQTPBuildColorPaletteLUTSorted(itemsi, lut_size); } double JKQTPImagePlot_QStringToDouble(QString value) { QString v=value; if (value.contains(',')) { - v=value.replace(',', '.'); + v=value.replace(',', '.'); } QLocale loc=QLocale::c(); loc.setNumberOptions(QLocale::OmitGroupSeparator); return loc.toDouble(v) ; } -static QStringList JKQTPImagePlot_palettesSearchPaths=QStringList(); -static QMap > > JKQTPImagePlot_lutsFromFiles; + template bool JKQTPImagePlot_QPairCompareFirst(const QPair &s1, const QPair &s2) { return s1.first < s2.first; } -QStringList JKQTPImagePlot_getPredefinedPalettes() { +QStringList JKQTPImageTools::getPredefinedPalettes() { static QStringList sl; - if (JKQTPImagePlot_palettesSearchPaths.isEmpty()) { - JKQTPImagePlot_palettesSearchPaths<<":/colorpalettes/"; - JKQTPImagePlot_palettesSearchPaths<<(QApplication::applicationDirPath()+"/colorpalettes/"); - JKQTPImagePlot_palettesSearchPaths<<(QApplication::applicationDirPath()+"/assets/colorpalettes/"); + if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) { + sl.clear(); + for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) { + if (it.key()>=0 && it.key()<=JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE) { + if (it.value().nameT.size()!=0) sl< > pal; - QRegExp rx3("\\s*([0-9eE.+-]+)\\s*([,\\t ])\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*", Qt::CaseInsensitive); - rx3.setMinimal(false); - QRegExp rx4("\\s*([0-9eE.+-]+)\\s*([,\\t ])\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*", Qt::CaseInsensitive); - rx4.setMinimal(false); - // determine format - for (int i=slt.size()-1; i>=0; i--) { - slt[i]=slt[i].trimmed(); - if (rx4.indexIn(slt[i])>=0) { - has4=true; - double r=JKQTPImagePlot_QStringToDouble(rx4.cap(3)); - double g=JKQTPImagePlot_QStringToDouble(rx4.cap(4)); - double b=JKQTPImagePlot_QStringToDouble(rx4.cap(5)); - if (r>1.0 || g>1.0 || b>1.0) { - rgb255=true; - } - } else if (rx3.indexIn(slt[i])>=0) { - has4=false; - double r=JKQTPImagePlot_QStringToDouble(rx3.cap(1)); - double g=JKQTPImagePlot_QStringToDouble(rx3.cap(3)); - double b=JKQTPImagePlot_QStringToDouble(rx3.cap(4)); - if (r>1.0 || g>1.0 || b>1.0) { - rgb255=true; - } - } else { - slt.removeAt(i); - } - } - // read data - bool ok=true; - for (int i=0; i=0) { - x=JKQTPImagePlot_QStringToDouble(rx4.cap(1)); - r=JKQTPImagePlot_QStringToDouble(rx4.cap(3)); - g=JKQTPImagePlot_QStringToDouble(rx4.cap(4)); - b=JKQTPImagePlot_QStringToDouble(rx4.cap(5)); - } else if (!has4 && rx3.indexIn(slt[i])>=0) { - x=i; - r=JKQTPImagePlot_QStringToDouble(rx3.cap(1)); - g=JKQTPImagePlot_QStringToDouble(rx3.cap(3)); - b=JKQTPImagePlot_QStringToDouble(rx3.cap(4)); - //qDebug()<(round(255*r)), 255), qBound(0,static_cast(round(255*g)), 255), qBound(0,static_cast(round(255*b)), 255))); - } else { - pal<(round(r)), 255), qBound(0,static_cast(round(g)), 255), qBound(0,static_cast(round(b)), 255))); - } - } - } - //qDebug()<<"read: "< > pal; - if (colorspace=="rgb"){ - QDomElement e = n.firstChildElement("Point"); - while(!e.isNull()) { - double x=JKQTPImagePlot_QStringToDouble(e.attribute("x", "0")); - //double o=JKQTPImagePlot_QStringToDouble(e.attribute("o", "0")); - double r=JKQTPImagePlot_QStringToDouble(e.attribute("r", "0")); - double g=JKQTPImagePlot_QStringToDouble(e.attribute("g", "0")); - double b=JKQTPImagePlot_QStringToDouble(e.attribute("b", "0")); - pal<(round(255*r)), 255), qBound(0,static_cast(round(255*g)), 255), qBound(0,static_cast(round(255*b)), 255))); - e = e.nextSiblingElement("Point"); - } - if (pal.size()>1) { - sl<); - JKQTPImagePlot_lutsFromFiles[sl.size()-1]=pal; - palID=sl.size(); - //qDebug()<<"read "< &lutstore) { - QList ls=lutstore; - lutstore.clear(); - for (int i=0; i& lutstore, JKQTPMathImageColorPalette palette) { - int* lut_used=nullptr; +QStringList JKQTPImageTools::getPredefinedPalettesMachineReadable() { + static QStringList sl; - if (palette == JKQTPMathImageRED) - { - //int*& plut=lutstore[palette]; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(static_cast(255.0*v), 0, 0); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageGREEN) - { - //int*& plut=&lut_green; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, static_cast(255.0*v), 0); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageBLUE) - { - //int*& plut=&lut_blue; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, 0, static_cast(255.0*v)); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageGRAY) - { - //int*& plut=&lut_gray; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageALPHA) - { - //int*& plut=&lut_gray; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgba(255,255,255, - static_cast(255.0*v)); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_ALPHA) - { - //int*& plut=&lut_gray; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgba(255,255,255, - static_cast(255.0*v)); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTEDRED) - { - //int*& plut=&lut_invred; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(static_cast(255.0*(1.0-v)), 0, 0); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageINVERTEDGREEN) - { - //int*& plut=&lut_invgreen; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, static_cast(255.0*(1.0-v)), 0); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTEDBLUE) - { - //int*& plut=&lut_invblue; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=qRgb(0, 0, static_cast(255.0*(1.0-v))); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTEDGRAY) - { - //int*& plut=&lut_invgray; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE]; - } - } - lut_used=lutstore[palette]; - } - - else if (palette == JKQTPMathImageMATLAB) - { - //int*& plut=&lut_matlab; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - } - } - lut_used=lutstore[palette]; - } - - else if (palette == JKQTPMathImageINVERTED_MATLAB) - { - //int*& plut=&lut_matlab_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - 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)); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageRYGB) //gnuplot: 30,-13,-23 - { - //int*& plut=&lut_rygb; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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; - - double g = 255.0 * std::sin(M_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)); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageINVERTED_RYGB) //gnuplot: 30,-13,-23 - { - //int*& plut=&lut_rygb_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - 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; - - double g = 255.0 * std::sin(M_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)); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageHSV) - { - //int*& plut=&lut_hsv; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - int h = static_cast(floor(6*v)); - 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; - } - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_HSV) - { - //int*& plut=&lut_invhsv; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - int h = static_cast(floor(6.0-6.0*v)); - 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; - } - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageRAINBOW) //gnuplot: 33,13,10 - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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; - - double g = 255.0*sin(M_PI*v); - - double b = 255.0*cos(0.5*M_PI*v); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageINVERTED_RAINBOW) //gnuplot: 33,13,10 - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - 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; - - double g = 255.0*sin(M_PI*v); - - double b = 255.0*cos(0.5*M_PI*v); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageHOT) //gnuplot: 21,22,23 - { - //int*& plut=&lut_hot; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_HOT) //gnuplot: 21,22,23 - { - //int*& plut=&lut_hot_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - 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)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageOCEAN) //gnuplot: 23,28,3 - { - //int*& plut=&lut_ocean; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v-510.0; - if (r < 0.0) - r = 0.0; - - double g = std::abs(382.5*v-127.5); - - double b = 255.0*v; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_OCEAN) //gnuplot: 23,28,3 - { - //int*& plut=&lut_ocean_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=JKQTPImageTools::LUTSIZE; l>=0; l--) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 765.0*v-510.0; - if (r < 0.0) - r = 0.0; - - double g = std::abs(382.5*v-127.5); - - double b = 255.0*v; - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBLUEMAGENTAYELLOW) //gnuplot: 30,31,32 - { - //int*& plut=&lut_bluemagentayellow; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW) //gnuplot: 30,31,32 - { - //int*& plut=&lut_bluemagentayellow_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } + if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) { + sl.clear(); + for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) { + if (it.key()>=0) { + if (it.value().name.size()!=0) sl<(JKQTPImageTools::LUTSIZE); - double r = sqrt(sqrt(v)); - if (r < 0.0) r = 0.0; - if (r > 1.0) r = 1.0; - - double g = sin(M_PI/2.0*v); - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = cos(M_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)); - } - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageINVERTED_BLUEYELLOW) //gnuplot: 8,9,10 - { - //int*& plut=&lut_blueyellow_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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(M_PI/2.0*v); - if (g < 0.0) g = 0.0; - if (g > 1.0) g = 1.0; - - double b = cos(M_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)); - } - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageCYAN) - { - //int*& plut=&lut_cyan; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageINVERTED_CYAN) - { - //int*& plut=&lut_cyan_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - 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)); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageTRAFFICLIGHT) - { - //int*& plut=&lut_trafficlight; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=l/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v < 0.5) ? 128.0*sin(M_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); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageINVERTED_TRAFFICLIGHT) - { - //int*& plut=&lut_trafficlight_inverted; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = (v < 0.5) ? 128.0*sin(M_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); - } - } - } - lut_used=lutstore[palette]; - - } - else if (palette == JKQTPMathImageBLUEWHITERED) //gnuplot: 34,13,-34 - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > 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); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } - else if (palette == JKQTPMathImageREDWHITEBLUE) //gnuplot: https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/RdBu.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFB2182B); - lst<(1.0, 0xFFD6604D); - lst<(2.0, 0xFFF4A582); - lst<(3.0, 0xFFFDDBC7); - lst<(4.0, 0xFFD1E5F0); - lst<(5.0, 0xFF92C5DE); - lst<(6.0, 0xFF4393C3); - lst<(7.0, 0xFF2166AC); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - - - } else if (palette == JKQTPMathImageBLACKBLUEREDYELLOW) //gnuplot: 7,5,15 - { -// int*& plut=&lut_BLACKBLUEREDYELLOW; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*qBound(0.0,sqrt(v),1.0); - double g = 255.0*qBound(0.0,v*v*v,1.0); - double b = 255.0*qBound(0.0,sin(2.0*M_PI*v),1.0); - - plut[l]=qRgb(static_cast(r), static_cast(g), static_cast(b)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageGREENREDVIOLET) //gnuplot: 3,11,6 - { - //int*& plut=&lut_GREENREDVIOLET; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*qBound(0.0,v,1.0); - double g = 255.0*qBound(0.0,fabs(v-0.5),1.0); - 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)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE) //gnuplot: 30,31,32 - { - //int*& plut=&lut_BLACKBLUEVIOLETYELLOWWHITE; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - 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)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK) //gnuplot: 30,31,32 - { - //int*& plut=&lut_WHITEYELLOWVIOLETBLUEBLACK; - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - double r = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - double g = 255.0*qBound(0.0,v/0.32-0.78125,1.0); - 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)); - } - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBR_GR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/BrBG.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); - lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); - lst<(2.0, qRgb(0xDF, 0xC2, 0x7D)); - lst<(3.0, 0xFFF6E8C3); - lst<(4.0, 0xFFC7EAE5); - lst<(5.0, 0xFF80CDC1); - lst<(6.0, 0xFF35978F); - lst<(7.0, 0xFF01665E); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBR_GR_STEP) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/BrBG.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, qRgb(0x8C, 0x51, 0x0A)); - lst<(1.0, qRgb(0xBF, 0x81, 0x2D)); - lst<(2.0, qRgb(0xDF, 0xC2, 0x7D)); - lst<(3.0, 0xFFF6E8C3); - lst<(4.0, 0xFFC7EAE5); - lst<(5.0, 0xFF80CDC1); - lst<(6.0, 0xFF35978F); - lst<(7.0, 0xFF01665E); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImagePU_OR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFB35806); - lst<(1.0, 0xFFE08214); - lst<(2.0, 0xFFFDB863); - lst<(3.0, 0xFFFEE0B6); - lst<(4.0, 0xFFF7F7F7); - lst<(5.0, 0xFFD8DAEB); - lst<(6.0, 0xFFB2ABD2); - lst<(7.0, 0xFF8073AC); - lst<(8.0, 0xFF542788); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImagePU_OR_STEP) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFB35806); - lst<(1.0, 0xFFE08214); - lst<(2.0, 0xFFFDB863); - lst<(3.0, 0xFFFEE0B6); - lst<(4.0, 0xFFF7F7F7); - lst<(5.0, 0xFFD8DAEB); - lst<(6.0, 0xFFB2ABD2); - lst<(7.0, 0xFF8073AC); - lst<(8.0, 0xFF542788); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageYL_GN_BU) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFFFFFD9); - lst<(1.0, 0xFFEDF8B1); - lst<(2.0, 0xFFC7E9B4); - lst<(3.0, 0xFF7FCDBB); - lst<(4.0, 0xFF41B6C4); - lst<(5.0, 0xFF1D91C0); - lst<(6.0, 0xFF225EA8); - lst<(7.0, 0xFF253494); - lst<(8.0, 0xFF081D58); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageYL_GN_BU_STEP) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFFFFFD9); - lst<(1.0, 0xFFEDF8B1); - lst<(2.0, 0xFFC7E9B4); - lst<(3.0, 0xFF7FCDBB); - lst<(4.0, 0xFF41B6C4); - lst<(5.0, 0xFF1D91C0); - lst<(6.0, 0xFF225EA8); - lst<(7.0, 0xFF253494); - lst<(8.0, 0xFF081D58); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageGN_BU) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFF7FCF0); - lst<(1.0, 0xFFE0F3DB); - lst<(2.0, 0xFFCCEBC5); - lst<(3.0, 0xFFA8DDB5); - lst<(4.0, 0xFF7BCCC4); - lst<(5.0, 0xFF4EB3D3); - lst<(6.0, 0xFF2B8CBE); - lst<(7.0, 0xFF0868AC); - lst<(8.0, 0xFF084081); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageGN_BU_STEP) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFFF7FCF0); - lst<(1.0, 0xFFE0F3DB); - lst<(2.0, 0xFFCCEBC5); - lst<(3.0, 0xFFA8DDB5); - lst<(4.0, 0xFF7BCCC4); - lst<(5.0, 0xFF4EB3D3); - lst<(6.0, 0xFF2B8CBE); - lst<(7.0, 0xFF0868AC); - lst<(8.0, 0xFF084081); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBU_GN) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(8.0, 0xFFF7FCF0); - lst<(7.0, 0xFFE0F3DB); - lst<(6.0, 0xFFCCEBC5); - lst<(5.0, 0xFFA8DDB5); - lst<(4.0, 0xFF7BCCC4); - lst<(3.0, 0xFF4EB3D3); - lst<(2.0, 0xFF2B8CBE); - lst<(1.0, 0xFF0868AC); - lst<(0.0, 0xFF084081); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBU_GN_STEP) //http://colorbrewer2.org/ - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(8.0, 0xFFF7FCF0); - lst<(7.0, 0xFFE0F3DB); - lst<(6.0, 0xFFCCEBC5); - lst<(5.0, 0xFFA8DDB5); - lst<(4.0, 0xFF7BCCC4); - lst<(3.0, 0xFF4EB3D3); - lst<(2.0, 0xFF2B8CBE); - lst<(1.0, 0xFF0868AC); - lst<(0.0, 0xFF084081); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageINVERTED_MAGENTA) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageMAGENTA) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,1,0,v).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageINVERTED_YELLOW) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageYELLOW) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,1,v).rgba(); - } - - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageINVERTED_MAGENTAWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageMAGENTAWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,v,0,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageINVERTED_YELLOWWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageYELLOWWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(0,0,v,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageINVERTED_CYANWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageCYANWHITE) // from CMYK model - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - for (int l=0; l<=JKQTPImageTools::LUTSIZE; l++) { - double v=(JKQTPImageTools::LUTSIZE-l)/static_cast(JKQTPImageTools::LUTSIZE); - plut[l]=QColor::fromCmykF(v,0,0,0).rgba(); - } - - } - } - lut_used=lutstore[palette]; - } else if (palette == JKQTPMathImageBlueGreenRed) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("blue").rgb()); - lst<(2.0, QColor("green").rgb()); - lst<(3.0, QColor("red").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImageRedGreenBlue) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("red").rgb()); - lst<(2.0, QColor("green").rgb()); - lst<(3.0, QColor("blue").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - - } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("magenta").rgb()); - lst<(2.0, QColor("yellow").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+1) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("yellow").rgb()); - lst<(2.0, QColor("magenta").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+2) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("red").rgb()); - lst<(2.0, QColor("blue").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - } else if (palette == JKQTPMathImagePREDEFINED_PALETTES_COUNT+3) - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(1.0, QColor("blue").rgb()); - lst<(2.0, QColor("red").rgb()); - - JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, lst); - } - } - lut_used=lutstore[palette]; - - - /* - } else if (palette == JKQTPMathImagePU_OR) //https://github.com/aschn/gnuplot-colorbrewer/blob/master/diverging/PuOr.plt - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - QList > lst; - lst<(0.0, 0xFF); - lst<(1.0, 0xFF); - lst<(2.0, 0xFF); - lst<(3.0, 0xFF); - lst<(4.0, 0xFF); - lst<(5.0, 0xFF); - lst<(6.0, 0xFF); - lst<(7.0, 0xFF); - lst<(8.0, 0xFF); - - JKQTPImagePlot_buildDefinedPalette(plut, lst); - } - } - lut_used=lutstore[palette]; - - */ - - } else if (JKQTPImagePlot_lutsFromFiles.contains(palette)) // LUTs read from files in JKQTPImagePlot_lutsFromFiles - { - if (lutstore[palette]==nullptr) { - lutstore[palette]=(int*)malloc((JKQTPImageTools::LUTSIZE+2)*sizeof(int)); - int* plut=lutstore[palette]; - //std::cout<<"!!! creating rainbow lut\n"; - if (plut!=nullptr) { - if (JKQTPImagePlot_lutsFromFiles[palette].size()>220) JKQTPImagePlot_buildDefinedPalette(plut, JKQTPImagePlot_lutsFromFiles[palette]); - else JKQTPImagePlot_buildDefinedPaletteLinInterpolate(plut, JKQTPImagePlot_lutsFromFiles[palette]); - } - } - lut_used=lutstore[palette]; - } - return lut_used; + return sl; } -QImage JKQTPMathImageGetPaletteImage(int i, int width) + + + +QString JKQTPImageTools::JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p) { - return JKQTPMathImageGetPaletteImage(i, width, 1); + auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.find(p); + if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast(p)); + else { + if (it.value().name.size()>0) return it.value().name; + else return QString::number(static_cast(p)); + } } -QImage JKQTPMathImageGetPaletteImage(int i, int width, int height) +JKQTPMathImageColorPalette JKQTPImageTools::String2JKQTPMathImageColorPalette(const QString &p) +{ + for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) { + if (QString::compare(p, it.value().name, Qt::CaseInsensitive)==0) { + return static_cast(it.key()); + } + } + + for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) { + if (QString::compare(p, it.value().nameT, Qt::CaseInsensitive)==0) { + return static_cast(it.key()); + } + } + + bool ok=false; + JKQTPMathImageColorPalette res = static_cast(p.toInt(&ok)); + if (!ok) return JKQTPMathImageMATLAB; + else return res; +} + + + + + + + + + + + + + +const JKQTPImageTools::LUTType& JKQTPImageTools::getLUTforPalette(QMap& lutstore, JKQTPMathImageColorPalette palette) { + static JKQTPImageTools::LUTType empty(JKQTPImageTools::LUTSIZE, 0); + + auto it=lutstore.find(static_cast(palette)); + if (it==lutstore.end()) { + return empty; + } else { + return it.value().lut; + } +} + + + +QImage JKQTPImageTools::GetPaletteImage(int i, int width) +{ + return JKQTPImageTools::GetPaletteImage(i, width, 1); +} + +QImage JKQTPImageTools::GetPaletteImage(int i, int width, int height) { QImage img; - double* pic=static_cast(malloc(width*height*sizeof(double))); + QVector pic(width*height,0); for (int j=0; j(pic, width, height, img, (JKQTPMathImageColorPalette)i, Qt::black, Qt::black); - free(pic); + JKQTPImageTools::array2image(pic.data(), width, height, img, static_cast(i), Qt::black, Qt::black); return img; } -QImage JKQTPMathImageGetPaletteImage(JKQTPMathImageColorPalette palette, int width) +QImage JKQTPImageTools::GetPaletteImage(JKQTPMathImageColorPalette palette, int width) { - return JKQTPMathImageGetPaletteImage(static_cast(palette), width); + return JKQTPImageTools::GetPaletteImage(static_cast(palette), width); } -QImage JKQTPMathImageGetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height) +QImage JKQTPImageTools::GetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height) { - return JKQTPMathImageGetPaletteImage(static_cast(palette), width, height); + return JKQTPImageTools::GetPaletteImage(static_cast(palette), width, height); } -QImage JKQTPMathImageGetPaletteImage(int *lut, int lut_size, int width) +QImage JKQTPImageTools::GetPaletteImage(const JKQTPImageTools::LUTType& lut, int width) { QImage img; - double* pic=static_cast(malloc(width*sizeof(double))); + QVector pic(width); for (int j=0; j(pic, width, 1, img, lut, lut_size, Qt::black, Qt::black); - free(pic); + JKQTPImageTools::array2image(pic.data(), pic.size(), 1, img, lut, Qt::black, Qt::black); return img; } -QIcon JKQTPMathImageGetPaletteIcon(int i) { - QImage img=JKQTPMathImageGetPaletteImage(i, JKQTPImageTools::PALETTE_ICON_WIDTH); +QIcon JKQTPImageTools::GetPaletteIcon(int i) { + QImage img=JKQTPImageTools::GetPaletteImage(i, JKQTPImageTools::PALETTE_ICON_WIDTH); QPixmap pix(JKQTPImageTools::PALETTE_ICON_WIDTH,8); QRect r(0,0,JKQTPImageTools::PALETTE_ICON_WIDTH-1,7); QPainter p(&pix); @@ -1767,8 +2795,8 @@ QIcon JKQTPMathImageGetPaletteIcon(int i) { } -QIcon JKQTPMathImageGetPaletteIcon(JKQTPMathImageColorPalette palette) { - return JKQTPMathImageGetPaletteIcon(static_cast(palette)); +QIcon JKQTPImageTools::GetPaletteIcon(JKQTPMathImageColorPalette palette) { + return JKQTPImageTools::GetPaletteIcon(static_cast(palette)); } @@ -1777,190 +2805,169 @@ QIcon JKQTPMathImageGetPaletteIcon(JKQTPMathImageColorPalette palette) { -QImage JKQTPMathImageGetAlphaPaletteImage(int *lut, int lut_size, int width, int height) + + +int JKQTPImageTools::registerPalette(const QString &name, const JKQTPImageTools::LUTType &paletteLut, const QString &nameT) { - QImage img; - if (!lut || lut_size<=0 || width<=0 || height<=0) return img; - double* pic=static_cast(malloc(width*sizeof(double))); - for (int j=0; j l1(lut_size, QColor("white").rgba()); - for (int i=0; i(pic, width, 1, img, l1.data(), lut_size, Qt::black, Qt::black); - free(pic); - QImage img2(width, height, QImage::Format_ARGB32); - QPainter p(&img2); - QBrush b; - b.setStyle(Qt::TexturePattern); - b.setTextureImage(img1); - p.setBrush(b); - p.fillRect(QRect(0,0,width,height), b); - p.drawImage(QRect(0,0,width,height), img); - p.end(); - return img2; + int id=JKQTPImageTools::global_next_userpalette++; + JKQTPImageTools::global_jkqtpimagetools_lutstore[id].name=name; + JKQTPImageTools::global_jkqtpimagetools_lutstore[id].nameT=((nameT.size()>0)?nameT:name); + JKQTPImageTools::global_jkqtpimagetools_lutstore[id].lut=paletteLut; + return id; } - - - - -QString JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p) +QVector JKQTPImageTools::registerPalettesFromFile(const QString &filename, bool interpolatePalette) { - switch (p) { - case JKQTPMathImageGRAY: return QString("gray"); - case JKQTPMathImageINVERTEDGRAY: return QString("invgray"); - case JKQTPMathImageRED: return QString("red"); - case JKQTPMathImageINVERTEDRED: return QString("invred"); - case JKQTPMathImageGREEN: return QString("green"); - case JKQTPMathImageINVERTEDGREEN: return QString("invgreen"); - case JKQTPMathImageBLUE: return QString("blue"); - case JKQTPMathImageINVERTEDBLUE: return QString("invblue"); - case JKQTPMathImageCYAN: return QString("cyan"); - case JKQTPMathImageINVERTED_CYAN: return QString("invcyan"); - case JKQTPMathImageYELLOW: return QString("yellow"); - case JKQTPMathImageINVERTED_YELLOW: return QString("invyellow"); - case JKQTPMathImageMAGENTA: return QString("magenta"); - case JKQTPMathImageINVERTED_MAGENTA: return QString("invmagenta"); + QVector ids; + QString ext=QFileInfo(filename).suffix().toLower(); + if (ext=="rgb" || ext=="pal" || ext=="csv") { + QFile file(filename); + if (file.open(QIODevice::ReadOnly|QIODevice::Text)) { + QString txt=file.readAll(); + QStringList slt=txt.split('\n'); + bool has4=false; + bool rgb255=false; + QList > pal; + QRegExp rx3("\\s*([0-9eE.+-]+)\\s*([,\\t ])\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*", Qt::CaseInsensitive); + rx3.setMinimal(false); + QRegExp rx4("\\s*([0-9eE.+-]+)\\s*([,\\t ])\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*\\2\\s*([0-9eE.+-]+)\\s*", Qt::CaseInsensitive); + rx4.setMinimal(false); + // determine format + for (int i=slt.size()-1; i>=0; i--) { + slt[i]=slt[i].trimmed(); + if (rx4.indexIn(slt[i])>=0) { + has4=true; + double r=JKQTPImagePlot_QStringToDouble(rx4.cap(3)); + double g=JKQTPImagePlot_QStringToDouble(rx4.cap(4)); + double b=JKQTPImagePlot_QStringToDouble(rx4.cap(5)); + if (r>1.0 || g>1.0 || b>1.0) { + rgb255=true; + } + } else if (rx3.indexIn(slt[i])>=0) { + has4=false; + double r=JKQTPImagePlot_QStringToDouble(rx3.cap(1)); + double g=JKQTPImagePlot_QStringToDouble(rx3.cap(3)); + double b=JKQTPImagePlot_QStringToDouble(rx3.cap(4)); + if (r>1.0 || g>1.0 || b>1.0) { + rgb255=true; + } + } else { + slt.removeAt(i); + } + } + // read data + bool ok=true; + for (int i=0; i=0) { + x=JKQTPImagePlot_QStringToDouble(rx4.cap(1)); + r=JKQTPImagePlot_QStringToDouble(rx4.cap(3)); + g=JKQTPImagePlot_QStringToDouble(rx4.cap(4)); + b=JKQTPImagePlot_QStringToDouble(rx4.cap(5)); + } else if (!has4 && rx3.indexIn(slt[i])>=0) { + x=i; + r=JKQTPImagePlot_QStringToDouble(rx3.cap(1)); + g=JKQTPImagePlot_QStringToDouble(rx3.cap(3)); + b=JKQTPImagePlot_QStringToDouble(rx3.cap(4)); + //qDebug()<(round(255*r)), 255), qBound(0,static_cast(round(255*g)), 255), qBound(0,static_cast(round(255*b)), 255))); + } else { + pal<(round(r)), 255), qBound(0,static_cast(round(g)), 255), qBound(0,static_cast(round(b)), 255))); + } + } + } + if (ok && pal.size()>1) { + if (interpolatePalette) ids<(p)); + } } +#ifdef QT_XML_LIB + else if (ext=="xml") { + int cnt=1; + QDomDocument doc("palette"); + QFile file(filename); + if (file.open(QIODevice::ReadOnly)) { + if (doc.setContent(&file)) { + file.close(); + QDomElement docElem = doc.documentElement(); + + QDomElement n = docElem.firstChildElement("ColorMap"); + if (docElem.nodeName()=="ColorMap") n=docElem; + while(!n.isNull()) { + QString name=n.attribute("name", QString("%2_palette%1").arg(cnt).arg(QFileInfo(filename).fileName())); + QString nameT=n.attribute("name", QObject::tr("%2: Palette #%1").arg(cnt).arg(QFileInfo(filename).fileName())); + QString colorspace=n.attribute("space", "RGB").toLower(); + QList > pal; + if (colorspace=="rgb"){ + QDomElement e = n.firstChildElement("Point"); + while(!e.isNull()) { + double x=JKQTPImagePlot_QStringToDouble(e.attribute("x", "0")); + double r=JKQTPImagePlot_QStringToDouble(e.attribute("r", "0")); + double g=JKQTPImagePlot_QStringToDouble(e.attribute("g", "0")); + double b=JKQTPImagePlot_QStringToDouble(e.attribute("b", "0")); + pal<(round(255*r)), 255), qBound(0,static_cast(round(255*g)), 255), qBound(0,static_cast(round(255*b)), 255))); + e = e.nextSiblingElement("Point"); + } + if (pal.size()>1) { + if (interpolatePalette) ids<(0, y1*255.0, 255), jkqtp_boundedRoundTo(0, y2*255.0, 255)); +} + + +JKQTPColorPaletteSingleColorLinSegment::JKQTPColorPaletteSingleColorLinSegment(): + position(0), colval_endprevious(0), colval_startnext(0) { - if (QString::compare(p, "gray", Qt::CaseInsensitive)==0) return JKQTPMathImageGRAY; - if (QString::compare(p, "invgray", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTEDGRAY; - if (QString::compare(p, "red", Qt::CaseInsensitive)==0) return JKQTPMathImageRED; - if (QString::compare(p, "invred", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTEDRED; - if (QString::compare(p, "green", Qt::CaseInsensitive)==0) return JKQTPMathImageGREEN; - if (QString::compare(p, "invgreen", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTEDGREEN; - if (QString::compare(p, "blue", Qt::CaseInsensitive)==0) return JKQTPMathImageBLUE; - if (QString::compare(p, "invblue", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTEDBLUE; - if (QString::compare(p, "cyan", Qt::CaseInsensitive)==0) return JKQTPMathImageCYAN; - if (QString::compare(p, "invcyan", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_CYAN; - if (QString::compare(p, "yellow", Qt::CaseInsensitive)==0) return JKQTPMathImageYELLOW; - if (QString::compare(p, "invyellow", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_YELLOW; - if (QString::compare(p, "magenta", Qt::CaseInsensitive)==0) return JKQTPMathImageMAGENTA; - if (QString::compare(p, "invmagenta", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_MAGENTA; - - - if (QString::compare(p, "Matlab", Qt::CaseInsensitive)==0) return JKQTPMathImageMATLAB; - if (QString::compare(p, "invMatlab", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_MATLAB; - if (QString::compare(p, "RYGB", Qt::CaseInsensitive)==0) return JKQTPMathImageRYGB; - if (QString::compare(p, "invRYGB", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_RYGB; - if (QString::compare(p, "HSV", Qt::CaseInsensitive)==0) return JKQTPMathImageHSV; - if (QString::compare(p, "invHSV", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_HSV; - if (QString::compare(p, "rainbow", Qt::CaseInsensitive)==0) return JKQTPMathImageRAINBOW; - if (QString::compare(p, "invrainbow", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_RAINBOW; - if (QString::compare(p, "AFMhot", Qt::CaseInsensitive)==0) return JKQTPMathImageHOT; - if (QString::compare(p, "invAFMhot", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_HOT; - if (QString::compare(p, "ocean", Qt::CaseInsensitive)==0) return JKQTPMathImageOCEAN; - if (QString::compare(p, "invocean", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_OCEAN; - if (QString::compare(p, "trafficlight", Qt::CaseInsensitive)==0) return JKQTPMathImageTRAFFICLIGHT; - if (QString::compare(p, "invtrafficlight", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_TRAFFICLIGHT; - if (QString::compare(p, "BlMaYe", Qt::CaseInsensitive)==0) return JKQTPMathImageBLUEMAGENTAYELLOW; - if (QString::compare(p, "YeMaBl", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW; - if (QString::compare(p, "BlYe", Qt::CaseInsensitive)==0) return JKQTPMathImageBLUEYELLOW; - if (QString::compare(p, "YeBl", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_BLUEYELLOW; - - if (QString::compare(p, "bluewhitered", Qt::CaseInsensitive)==0) return JKQTPMathImageBLUEWHITERED; - if (QString::compare(p, "redwhiteblue", Qt::CaseInsensitive)==0) return JKQTPMathImageREDWHITEBLUE; - - if (QString::compare(p, "BBlRdYe", Qt::CaseInsensitive)==0) return JKQTPMathImageBLACKBLUEREDYELLOW; - if (QString::compare(p, "GnRdVi", Qt::CaseInsensitive)==0) return JKQTPMathImageGREENREDVIOLET; - if (QString::compare(p, "BWprint", Qt::CaseInsensitive)==0) return JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE; - if (QString::compare(p, "invBWprint", Qt::CaseInsensitive)==0) return JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK; - if (QString::compare(p, "BrBG", Qt::CaseInsensitive)==0) return JKQTPMathImageBR_GR; - if (QString::compare(p, "PuOr", Qt::CaseInsensitive)==0) return JKQTPMathImagePU_OR; - if (QString::compare(p, "greenblue", Qt::CaseInsensitive)==0) return JKQTPMathImageGN_BU; - if (QString::compare(p, "bluegreen", Qt::CaseInsensitive)==0) return JKQTPMathImageBU_GN; - if (QString::compare(p, "YeGnBu", Qt::CaseInsensitive)==0) return JKQTPMathImageYL_GN_BU; - - if (QString::compare(p, "stepsBrBG", Qt::CaseInsensitive)==0) return JKQTPMathImageBR_GR_STEP; - if (QString::compare(p, "stepsPuOr", Qt::CaseInsensitive)==0) return JKQTPMathImagePU_OR_STEP; - if (QString::compare(p, "stepsGnBl", Qt::CaseInsensitive)==0) return JKQTPMathImageGN_BU_STEP; - if (QString::compare(p, "stepsBlGn", Qt::CaseInsensitive)==0) return JKQTPMathImageBU_GN_STEP; - if (QString::compare(p, "stepsYeGnBu", Qt::CaseInsensitive)==0) return JKQTPMathImageYL_GN_BU_STEP; - - - if (QString::compare(p, "cyanwhite", Qt::CaseInsensitive)==0) return JKQTPMathImageCYANWHITE; - if (QString::compare(p, "whitecyan", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_CYANWHITE; - if (QString::compare(p, "yellowwhite", Qt::CaseInsensitive)==0) return JKQTPMathImageYELLOWWHITE; - if (QString::compare(p, "whiteyellow", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_YELLOWWHITE; - if (QString::compare(p, "magentawhite", Qt::CaseInsensitive)==0) return JKQTPMathImageMAGENTAWHITE; - if (QString::compare(p, "whitemagenta", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_MAGENTAWHITE; - if (QString::compare(p, "bluegreenred", Qt::CaseInsensitive)==0) return JKQTPMathImageBlueGreenRed; - if (QString::compare(p, "redgreenblue", Qt::CaseInsensitive)==0) return JKQTPMathImageRedGreenBlue; - if (QString::compare(p, "alpha", Qt::CaseInsensitive)==0) return JKQTPMathImageALPHA; - if (QString::compare(p, "invAlpha", Qt::CaseInsensitive)==0) return JKQTPMathImageINVERTED_ALPHA; - - bool ok=false; - JKQTPMathImageColorPalette res = static_cast(p.toInt(&ok)); - if (!ok) return JKQTPMathImageMATLAB; - else return res; } diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.h b/lib/jkqtcommon/jkqtpbasicimagetools.h index fec5134880..9c5a5a5678 100644 --- a/lib/jkqtcommon/jkqtpbasicimagetools.h +++ b/lib/jkqtcommon/jkqtpbasicimagetools.h @@ -24,38 +24,40 @@ #include #include #include -#include "jkqtcommon/jkqtcommon_imexport.h" #include #include #include #include +#include "jkqtcommon/jkqtcommon_imexport.h" +#include "jkqtcommon/jkqtpmathtools.h" -/*! \brief tool structure that summarizes several static properties - \ingroup jkqtptools_qt - \internal -*/ -struct JKQTPImageTools { - /*! \brief Width of the Palette-Icons, generated e.g. by JKQTPMathImageGetPaletteIcon() - \ingroup jkqtptools_qt */ - static JKQTCOMMON_LIB_EXPORT const int PALETTE_ICON_WIDTH; - /*! \brief Height of the Palette-Icons, generated e.g. by JKQTPMathImageGetPaletteIcon() - \ingroup jkqtptools_qt */ - static JKQTCOMMON_LIB_EXPORT const int PALETTE_IMAGEICON_HEIGHT; - - /*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image() - \ingroup jkqtplotter_imagelots_tools - */ - static JKQTCOMMON_LIB_EXPORT const int LUTSIZE; - - /*! \brief internal global storage object for lookup-tables - \ingroup jkqtplotter_imagelots_tools - \internal - */ - static JKQTCOMMON_LIB_EXPORT QList global_jkqtpimagetools_lutstore; - -}; +/*! \brief retrieve an R/G/B/Alpha (\a ch == 0/1/2/3) value from the \c QRgb value \a rgb + \ingroup jkqtplotter_imagelots_tools + */ +inline int JKQTPGetColorChannel(QRgb rgb, int ch) +{ + switch(ch) { + case 0: return qRed(rgb); + case 1: return qGreen(rgb); + case 2: return qBlue(rgb); + case 3: return qAlpha(rgb); + } + return qGray(rgb); +} +/*! \brief set the R/G/B/Alpha (\a ch == 0/1/2/3) value in the \c QRgb value \a rgb to \a val (0..255!) + \ingroup jkqtplotter_imagelots_tools + */ +inline void JKQTPSetColorChannel(QRgb& rgb, int ch, int val) +{ + switch(ch) { + case 0: rgb= qRgba(val, qGreen(rgb), qBlue(rgb), qAlpha(rgb)); break; + case 1: rgb= qRgba(qRed(rgb), val, qBlue(rgb), qAlpha(rgb)); break; + case 2: rgb= qRgba(qRed(rgb), qGreen(rgb), val, qAlpha(rgb)); break; + case 3: rgb= qRgba(qRed(rgb), qGreen(rgb), qBlue(rgb), val); break; + } +} /*! \brief available palettes for coloring an image \ingroup jkqtplotter_imagelots_tools @@ -91,10 +93,25 @@ enum JKQTPMathImageColorPalette { JKQTPMathImageINVERTED_OCEAN, /*!< \image html palettes/palette_invocean.png */ JKQTPMathImageTRAFFICLIGHT, /*!< \image html palettes/palette_trafficlight.png */ JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image html palettes/palette_invtrafficlight.png */ + + JKQTPMathImageBone, /*!< \image html palettes/palette_bone.png */ + JKQTPMathImageCool, /*!< \image html palettes/palette_cool.png */ + JKQTPMathImageCopper, /*!< \image html palettes/palette_copper.png */ + JKQTPMathImageAutumn, /*!< \image html palettes/palette_autumn.png */ + JKQTPMathImageSeismic, /*!< \image html palettes/palette_seismic.png */ + JKQTPMathImageTerrain, /*!< \image html palettes/palette_terrain.png */ + JKQTPMathImageViridis, /*!< \image html palettes/palette_viridis.png \see from https://github.com/BIDS/colormap/blob/master/colormaps.py https://github.com/BIDS/colormap/blob/master/colormaps.py */ + JKQTPMathImageMagma, /*!< \image html palettes/palette_magma.png \see from https://github.com/BIDS/colormap/blob/master/colormaps.py https://github.com/BIDS/colormap/blob/master/colormaps.py */ + JKQTPMathImageInferno, /*!< \image html palettes/palette_inferno.png \see from https://github.com/BIDS/colormap/blob/master/colormaps.py https://github.com/BIDS/colormap/blob/master/colormaps.py */ + JKQTPMathImagePlasma, /*!< \image html palettes/palette_plasma.png \see from https://github.com/BIDS/colormap/blob/master/colormaps.py https://github.com/BIDS/colormap/blob/master/colormaps.py */ + + JKQTPMathImageBLUEMAGENTAYELLOW, /*!< \image html palettes/palette_BlMaYe.png */ JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW, /*!< \image html palettes/palette_YeMaBl.png */ + JKQTPMathImageYELLOWMAGENTABLUE=JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW, /*!< \image html palettes/palette_YeMaBl.png */ JKQTPMathImageBLUEYELLOW, /*!< \image html palettes/palette_BlYe.png */ JKQTPMathImageINVERTED_BLUEYELLOW, /*!< \image html palettes/palette_YeBl.png */ + JKQTPMathImageYELLOWBLUE=JKQTPMathImageINVERTED_BLUEYELLOW, /*!< \image html palettes/palette_YeBl.png */ JKQTPMathImageBLUEWHITERED, /*!< \image html palettes/palette_bluewhitered.png */ JKQTPMathImageREDWHITEBLUE, /*!< \image html palettes/palette_redwhiteblue.png */ @@ -104,10 +121,15 @@ enum JKQTPMathImageColorPalette { 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 */ JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */ + JKQTPMathImageOrangeWhitePurple=JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.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 */ JKQTPMathImageBR_GR_STEP, /*!< \image html palettes/palette_stepsBrBG.png */ JKQTPMathImagePU_OR_STEP, /*!< \image html palettes/palette_stepsPuOr.png */ @@ -118,38 +140,33 @@ enum JKQTPMathImageColorPalette { JKQTPMathImageCYANWHITE, /*!< \image html palettes/palette_cyanwhite.png */ JKQTPMathImageINVERTED_CYANWHITE, /*!< \image html palettes/palette_whitecyan.png */ + JKQTPMathImageWHITECYAN=JKQTPMathImageINVERTED_CYANWHITE, /*!< \image html palettes/palette_whitecyan.png */ JKQTPMathImageYELLOWWHITE, /*!< \image html palettes/palette_yellowwhite.png */ JKQTPMathImageINVERTED_YELLOWWHITE, /*!< \image html palettes/palette_whiteyellow.png */ + JKQTPMathImageWHITEYELLOW=JKQTPMathImageINVERTED_YELLOWWHITE, /*!< \image html palettes/palette_whiteyellow.png */ JKQTPMathImageMAGENTAWHITE, /*!< \image html palettes/palette_magentawhite.png */ JKQTPMathImageINVERTED_MAGENTAWHITE, /*!< \image html palettes/palette_whitemagenta.png */ + JKQTPMathImageWHITEMAGENTA=JKQTPMathImageINVERTED_MAGENTAWHITE, /*!< \image html palettes/palette_whitemagenta.png */ JKQTPMathImageBlueGreenRed, /*!< \image html palettes/palette_bluegreenred.png */ JKQTPMathImageRedGreenBlue, /*!< \image html palettes/palette_redgreenblue.png */ + JKQTPMathImageMagentaYellow, /*!< \image html palettes/palette_magentayellow.png */ + JKQTPMathImageYellowMagenta, /*!< \image html palettes/palette_yellowmagenta.png */ + JKQTPMathImageRedBlue, /*!< \image html palettes/palette_redblue.png */ + JKQTPMathImageBlueRed, /*!< \image html palettes/palette_bluered.png */ - JKQTPMathImagePREDEFINED_PALETTES_COUNT, + JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the number of predefined palettes */ - JKQTPMathImageUSER_PALETTE=65000, + JKQTPMathImageUSER_PALETTE=65000, /*!< \brief special value for JKQTPImageTools::array2image(), which signals the usage of a provided user-defined palette */ - JKQTPMathImageALPHA=JKQTPMathImageUSER_PALETTE-2, - JKQTPMathImageINVERTED_ALPHA=JKQTPMathImageUSER_PALETTE-1 + JKQTPMathImageALPHA=JKQTPMathImageUSER_PALETTE-2, /*!< \brief special palette with increasing alpha values */ + JKQTPMathImageINVERTED_ALPHA=JKQTPMathImageUSER_PALETTE-1, /*!< \brief special palette with decreasing alpha values */ + + JKQTPMathImageFIRST_REGISTERED_USER_PALETTE=JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */ + JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE=JKQTPMathImageUSER_PALETTE-10, /*!< \brief the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */ }; - -/*! \brief convert the palette \a p to a string - \ingroup jkqtplotter_imagelots_tools - \see String2JKQTPMathImageColorPalette() - */ -JKQTCOMMON_LIB_EXPORT QString JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p); - -/*! \brief convert the palette name \a p to JKQTPMathImageColorPalette (compatible with String2JKQTPMathImageColorPalette() ) - \ingroup jkqtplotter_imagelots_tools - \see JKQTPMathImageColorPalette2String() - */ -JKQTCOMMON_LIB_EXPORT JKQTPMathImageColorPalette String2JKQTPMathImageColorPalette(const QString& p); - - - /*! \brief modes available for image pixels that are above/below the pixel value range \ingroup jkqtplotter_imagelots_tools */ @@ -159,6 +176,316 @@ enum JKQTPMathImageColorRangeFailAction { JKQTPMathImageTransparent=2 /*!< set transparent */ }; +/*! \brief tool structure that summarizes several static properties of JKQTPlotters palette system, + also provides functions to work with palettes and register user-defined palettes. + \ingroup jkqtptools_qt + + \see \ref JKQTPlotterImagePlot +*/ +struct JKQTPImageTools { + + /*! \brief Datatype to store lookup-tables used to map data values (scales to 0..size-1) onto RGB-colors + \ingroup jkqtptools_qt */ + typedef QVector LUTType; + + /*! \brief Width of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() + \ingroup jkqtptools_qt */ + static JKQTCOMMON_LIB_EXPORT const int PALETTE_ICON_WIDTH; + /*! \brief Height of the Palette-Icons, generated e.g. by JKQTPImageTools::GetPaletteIcon() + \ingroup jkqtptools_qt */ + static JKQTCOMMON_LIB_EXPORT const int PALETTE_IMAGEICON_HEIGHT; + + /*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image() + */ + static JKQTCOMMON_LIB_EXPORT const int LUTSIZE; + + /*! \brief loads all palettes defined in the given palette files \a filename into global_jkqtpimagetools_userluts + and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to each palette + All new IDs are returned as a list + + + The file might either be a palette XML-file or a CSV-file: + + \b CSV-files need to have one of the following two formats (RED/GREEN/BLUE: 0..255): + \verbatim + scalar, red, green, blue + scalar, red, green, blue + ... + \endverbatim + or simply + \verbatim + red, green, blue + red, green, blue + ... + \endverbatim + The parser will also allow tabs and whitespaces as column separators. + + + \b CML-files need to have one of the following two formats (RED/GREEN/BLUE/OPACITY: 0..1): + \verbatim + + + + ... + + \endverbatim + optionally several \c ... definitions may be put below an arbitrarily named + document node, e.g.: + \verbatim + + + + + ... + + + + + ... + + ... + + \endverbatim + + \note In both cases, the palette will be formed without interpolation, i.e. using JKQTPBuildColorPaletteLUT() . + If in addition \a interpolatePalette is set to \c true, the function JKQTPBuildColorPaletteLUTLinInterpolate() + is used instead. + + \see \ref JKQTPlotterImagePlot , JKQTPBuildColorPaletteLUT() + */ + static JKQTCOMMON_LIB_EXPORT QVector registerPalettesFromFile(const QString& filename, bool interpolatePalette=false); + + /*! \brief registers a new LUT defined by \a paletteLut and with the given \a name (computer-readable) for later use, optionally stores also the human-readable and localized name \a nameT + and assigns a new LUT-ID >=JKQTPMathImageFIRST_REGISTERED_USER_PALETTE to the palette and returns it + + \see \ref JKQTPlotterImagePlot, JKQTPBuildColorPaletteLUTLinInterpolate(), JKQTPBuildColorPaletteLUT(), JKQTPBuildColorPaletteLUTLinInterpolateSorted(), JKQTPBuildColorPaletteLUTSorted(), JKQTPBuildColorPaletteLUTLinInterpolate(), JKQTPBuildColorPaletteLUT() + */ + static JKQTCOMMON_LIB_EXPORT int registerPalette(const QString& name, const LUTType &paletteLut, const QString &nameT=QString()); + + + + + + + + + /*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette) + + \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height + \param width width of the array in \a dbl + \param height height of the array in \a dbl + \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 ) + \param palette the color palette to use for the display + \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. + \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. + \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor + \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor + \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail + \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail + \param nanColor color to use for pixels that are not-a-number + \param infColor color to use for pixels that are infinity + \param logScale create a log-scaled image + \param logBase base for the logarithm used when \c logScale==true + \param lutUser user define LUT, used if \a palette \c ==JKQTPMathImageUSER_PALETTE + \note There is a variant of this function that is called with a userLUT directly, instead of \a palette + */ + template + static inline void array2image(const T* dbl_in, int width, int height, QImage &img, JKQTPMathImageColorPalette palette, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0, const LUTType& lutUser=LUTType()) + { + if (!dbl_in || width<=0 || height<=0) + return; + + double min = *dbl_in; + double max = *dbl_in; + if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) { + bool first=true; + for (int i=1; i(v)) || std::isinf(static_cast(v)))) { + if (first) { + min=max=v; + first=false; + } else { + if (v < min) + min = v; + else if (v > max) + max = v; + } + } + } + + } else { + min = minColor; + max = maxColor; + } + + const T* dbl=dbl_in; + QVector dbl1; + if (logScale) { + double logB=log10(logBase); + dbl1=QVector(width*height, 0); + for (int i=0; i0) { + // LUT found: collor the image accordingly + for (int j=0; j(img.scanLine(height-1-j)); + for (int i=0; i((val-min)/delta*static_cast(lutSize-1)); + const int vv = (v < 0) ? 0 : ( (v >= lutSize) ? (lutSize-1) : v); + line[i]=lut_used[vv]; + if ((v<0)&&(paletteMinFail==JKQTPMathImageGivenColor)) { + line[i]=minFailColor.rgba(); + } else if ((v>lutSize)&&(paletteMaxFail==JKQTPMathImageGivenColor)) { + line[i]=maxFailColor.rgba(); + } else if ((v<0)&&(paletteMinFail==JKQTPMathImageTransparent)) { + line[i]=QColor(Qt::transparent).rgba(); + } else if ((v>lutSize)&&(paletteMaxFail==JKQTPMathImageTransparent)) { + line[i]=QColor(Qt::transparent).rgba(); + } + } + } + } + } else { + // no LUT found: paint a black image! + img.fill(0); + } + } + + } + + /*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette) + + \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height + \param width width of the array in \a dbl + \param height height of the array in \a dbl + \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 ) + \param lutUser user-defined lookup-table + \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. + \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. + \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor + \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor + \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail + \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail + \param nanColor color to use for pixels that are not-a-number + \param infColor color to use for pixels that are infinity + \param logScale create a log-scaled image + \param logBase base for the logarithm used when \c logScale==true + */ + template + static inline void array2image(const T* dbl_in, int width, int height, QImage &img, const LUTType& lutUser, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0) + { + array2image(dbl_in, width, height, img, JKQTPMathImageUSER_PALETTE, minColor, maxColor, paletteMinFail, paletteMaxFail, minFailColor, maxFailColor, nanColor, infColor, logScale, logBase, lutUser); + } + + + + /*! \brief return a list of all globally available LUTs, human-readable/localized form */ + static QStringList JKQTCOMMON_LIB_EXPORT getPredefinedPalettes(); + + /*! \brief return a list of all globally available LUTs, machine-readable form */ + static QStringList JKQTCOMMON_LIB_EXPORT getPredefinedPalettesMachineReadable(); + + /*! \brief convert the palette \a p to a string + \see JKQTPImageTools::String2JKQTPMathImageColorPalette() + */ + static JKQTCOMMON_LIB_EXPORT QString JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p); + + /*! \brief convert the palette name \a p to JKQTPMathImageColorPalette (compatible with JKQTPImageTools::String2JKQTPMathImageColorPalette() ) + \see JKQTPImageTools::JKQTPMathImageColorPalette2String() + */ + static JKQTCOMMON_LIB_EXPORT JKQTPMathImageColorPalette String2JKQTPMathImageColorPalette(const QString& p); + + + /*! \brief generates a QImage with width \a width and height 1 for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */ + static QImage JKQTCOMMON_LIB_EXPORT GetPaletteImage(int i, int width); + /*! \brief generates a QImage with width \a width and height \a height for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */ + static QImage JKQTCOMMON_LIB_EXPORT GetPaletteImage(int i, int width, int height); + /*! \brief generates a QImage with width \a width and height 1 for a specific JKQTPMathImageColorPalette */ + static QImage JKQTCOMMON_LIB_EXPORT GetPaletteImage(JKQTPMathImageColorPalette palette, int width); + /*! \brief generates a QImage with width \a width and height \a height for a specific JKQTPMathImageColorPalette */ + static QImage JKQTCOMMON_LIB_EXPORT GetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height); + /*! \brief generates a QImage with width \a width and height 1 for a lookup-table \a lut */ + static QImage JKQTCOMMON_LIB_EXPORT GetPaletteImage(const LUTType& lut, int width); + + /*! \brief generates a QIcon for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) */ + static QIcon JKQTCOMMON_LIB_EXPORT GetPaletteIcon(int i) ; + + + /*! \brief generates a QIcon for a specific JKQTPMathImageColorPalette */ + static QIcon JKQTCOMMON_LIB_EXPORT GetPaletteIcon(JKQTPMathImageColorPalette palette) ; + + private: + + /*! \brief internal datatype, representing a lookup-table and its metadata inside global_jkqtpimagetools_lutstore + \internal + */ + struct LUTData { + LUTData(); + LUTData(const LUTType& _lut, const QString& _name, const QString& _nameT); + LUTData(const QString& _name, const QString& _nameT); + /** \brief the LUT itself */ + LUTType lut; + /** \brief name for the LUT (machine-readable) */ + QString name; + /** \brief name for the LUT (localized, human-readable) */ + QString nameT; + }; + + /*! \brief internal global storage object for lookup-tables + \internal + */ + static JKQTCOMMON_LIB_EXPORT QMap global_jkqtpimagetools_lutstore; + + /*! \brief storage for the next ID to assign to a user-defined palette, registered with registerPalette() or registerPalettesFromFile() + \internal + + \see registerPalette() registerPalettesFromFile() + */ + static JKQTCOMMON_LIB_EXPORT int global_next_userpalette; + + /*! \brief returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore + \internal + */ + static JKQTCOMMON_LIB_EXPORT QMap getDefaultLUTs(); + + + /*! \brief create a LUT for a given JKQTPMathImageColorPalette, store it in \a lutstore and return it + \internal + */ + static JKQTCOMMON_LIB_EXPORT const LUTType& getLUTforPalette(QMap &lutcache, JKQTPMathImageColorPalette palette); + +}; + + + + + + + /*! \brief modes available for RGB images \ingroup jkqtplotter_imagelots_tools @@ -175,19 +502,6 @@ enum JKQTPRGBMathImageRGBMode { }; -/*! \brief returns a vector containing all elements of the given array - \ingroup jkqtplotter_imagelots_tools - -*/ -template -inline QVector JKQTPImagePlot_arrayToVector(const T* input, int N) { - if (!input || N<=0) return QVector(); - T dummy; - QVector out(N, dummy); - memcpy(out.data(), input, N*sizeof(T)); - return out; -} - /*! \brief returns a vector containing all elements of the given array as doubles \ingroup jkqtplotter_imagelots_tools @@ -302,7 +616,7 @@ inline void JKQTPImagePlot_array2RGBimage(T* dbl_in, int width, int height, QIma double min = *dbl_in; double max = *dbl_in; bool first=true; - if (minColor == maxColor) { + if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) { for (int i=1; i(malloc(width*height*sizeof(T))); //memcpy(dbl, dbl_in, width*height*sizeof(T)); for (int i=0; i -inline QList JKQTPImagePlot_makeQList(const T& defaultVal, int N=1) { - QList l; - for (int i=0; i > items, int lut_size=JKQTPImageTools::LUTSIZE); - -/*! \brief build a linearly interpolated palette in \a lut with \a N entries that are provided as (double, QRgb) value pairss in the variable arguments - \ingroup jkqtplotter_imagelots_tools - - The entries in \a items are sorted by the first (double) argument and the full range is distributed - over 0 ... lut_size. Values in the LUT in between are generated by linear interpolations - - \a lut needs to have \c lut_size) entries -*/ -void JKQTCOMMON_LIB_EXPORT JKQTPImagePlot_buildDefinedPaletteLinInterpolate(int* lut, int N, ...); - -/*! \brief build a palette in \a lut with \a N entries that are provided in \a items - \ingroup jkqtplotter_imagelots_tools - - The entries in \a items are sorted by the first (double) argument and the full range is distributed - over 0 ... JKQTPImageTools::LUTSIZE. - - \a lut needs to have \c JKQTPImageTools::LUTSIZE) entries -*/ -void JKQTCOMMON_LIB_EXPORT JKQTPImagePlot_buildDefinedPalette(int* lut, QList > items); - -/*! \brief build a palette in \a lut with \a N entries that are provided as as (double, QRgb) value pairss in the variable arguments - \ingroup jkqtplotter_imagelots_tools -*/ -void JKQTCOMMON_LIB_EXPORT JKQTPImagePlot_buildDefinedPalette(int* lut, int N, ...); - -/*! \brief return a list of all globally available LUTs - \ingroup jkqtplotter_imagelots_tools */ -QStringList JKQTCOMMON_LIB_EXPORT JKQTPImagePlot_getPredefinedPalettes(); - - - -/*! \brief create a LUT for a given JKQTPMathImageColorPalette, store it in \a lutstore and return it - \ingroup jkqtplotter_imagelots_tools - \internal - */ -JKQTCOMMON_LIB_EXPORT int* JKQTPImagePlot_getCreateLUT(QList &lutstore, JKQTPMathImageColorPalette palette); -/*! \brief frees a list of LUTs - \ingroup jkqtplotter_imagelots_tools - \internal - */ -void JKQTCOMMON_LIB_EXPORT JKQTPImagePlot_freeLUTs(QList &lutstore); - - -/*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette) - \ingroup jkqtplotter_imagelots_tools - - This method uses lookup tables which are saved as static variables to convert the 2D array into - an image. The luts are only created once, and stored then, so mor CPU time is saved. The precompiler define - JKQTPImageTools::LUTSIZE sets the size of the LUTs. Note that if you don't use a specific color palette, - the according LUT won't be calculated and stored! - - \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height - \param width width of the array in \a dbl - \param height height of the array in \a dbl - \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 ) - \param palette the color palette to use for the display - \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. - \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. - \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor - \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor - \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail - \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail - \param nanColor color to use for pixels that are not-a-number - \param infColor color to use for pixels that are infinity - \param logScale create a log-scaled image - \param logBase base for the logarithm used when \c logScale==true - \param lutUser user define LUT - \param lutUserSize size of the LUT in lutUser -*/ -template -inline void JKQTPImagePlot_array2image(const T* dbl_in, int width, int height, QImage &img, JKQTPMathImageColorPalette palette, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0, const int* lutUser=0, int lutUserSize=0) -{ - if (!dbl_in || width<=0 || height<=0) - return; - - double min = *dbl_in; - double max = *dbl_in; - if (minColor == maxColor) { - bool first=true; - for (int i=1; i(v)) || std::isinf(static_cast(v)))) { - if (first) { - min=max=v; - first=false; - } else { - if (v < min) - min = v; - else if (v > max) - max = v; - } - } - } - - } else { - min = minColor; - max = maxColor; - } - - const T* dbl=dbl_in; - T* dbl1=nullptr; - if (logScale) { - double logB=log10(logBase); - dbl1=(T*)malloc(width*height*sizeof(T)); - //memcpy(dbl, dbl_in, width*height*sizeof(T)); - for (int i=0; i(nullptr, JKQTPImagePlot_getPredefinedPalettes().size()+2); - - - img = QImage(width, height, QImage::Format_ARGB32); - if (min == max) - img.fill(0); - else - { - - if (palette==JKQTPMathImageUSER_PALETTE) { - lut_used=lutUser; - lutSize=lutUserSize; - //qDebug()<<"user palette "<0) { - const unsigned int* lut_usedui=reinterpret_cast(lut_used); - // LUT found: collor the image accordingly - for (int j=0; j(img.scanLine(height-1-j)); - for (int i=0; i((val-min)/delta*static_cast(lutSize)); - const int vv = (v < 0) ? 0 : ( (v > lutSize) ? (lutSize) : v); - line[i]=lut_usedui[vv]; - if ((v<0)&&(paletteMinFail==JKQTPMathImageGivenColor)) { - line[i]=minFailColor.rgba(); - } else if ((v>lutSize)&&(paletteMaxFail==JKQTPMathImageGivenColor)) { - line[i]=maxFailColor.rgba(); - } else if ((v<0)&&(paletteMinFail==JKQTPMathImageTransparent)) { - line[i]=QColor(Qt::transparent).rgba(); - } else if ((v>lutSize)&&(paletteMaxFail==JKQTPMathImageTransparent)) { - line[i]=QColor(Qt::transparent).rgba(); - } - } - } - } - } else { - // no LUT found: paint a black image! - img.fill(0); - } - } - - if (dbl1) free(dbl1); - +struct JKQTPColorPaletteSingleColorLinSegment { + JKQTPColorPaletteSingleColorLinSegment(double p, uint8_t y1, uint8_t y2); + static JKQTPColorPaletteSingleColorLinSegment makeDbl_0_1(double p, double y1, double y2); + JKQTPColorPaletteSingleColorLinSegment(); + /** \brief scalar position of the element on the value axis */ + double position; + /** \brief color-channel-value that ends the prevoius segment (ignored for the first entry in a table) */ + uint8_t colval_endprevious; + /** \brief color-channel-value that starts the next segment (ignored for the last entry in a table) */ + uint8_t colval_startnext; }; -/*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette) - \ingroup jkqtplotter_imagelots_tools +/*! \brief build an interpolated palette with \a lut_size entries from the linear segments defined for the color channels R, G and B in \a itemsR, \a itemG and \a itemB respectively + \b NOTE: The entries in \a itemsR, \a itemsG, \a itemsB are assumed to be sorted by the position entry. + \ingroup jkqtplotter_imagelots_tools_LUTS - This method uses lookup tables which are saved as static variables to convert the 2D array into - an image. The luts are only created once, and stored then, so mor CPU time is saved. The precompiler define - JKQTPImageTools::LUTSIZE sets the size of the LUTs. Note that if you don't use a specific color palette, - the according LUT won't be calculated and stored! - \param dbl_in pointer to a 1D array of template type \c T representing the image to plot. This array has to be of size \a width * \a height - \param width width of the array in \a dbl - \param height height of the array in \a dbl - \param[out] img the QImage object to draw to (should be initialized as \c QImage::Format_ARGB32 ) - \param lutUser user-defined lookup-table - \param lutUserSize number of entries in \a lutUser - \param minColor lower boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. - \param maxColor upper boundary of color range in \a dbl pixels, if \a minColor == \a maxColor then this function will extract the image min and image max. - \param paletteMinFail specifies what shell happen, when a value in \a dbl is below \a minColor - \param paletteMaxFail specifies what shell happen, when a value in \a dbl is above \a maxColor - \param minFailColor color to use for pixels that are below \a minColor for some settings of \a paletteMinFail - \param maxFailColor color to use for pixels that are below \a maxColor for some settings of \a paletteMaxFail - \param nanColor color to use for pixels that are not-a-number - \param infColor color to use for pixels that are infinity - \param logScale create a log-scaled image - \param logBase base for the logarithm used when \c logScale==true + + + This is used to build a table of linear segments as a \c QList : + \verbatim + i position colval1 colval2 + ~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ + 0 0.0 0 (IGNORED) 0 + 1 0.5 100 100 + 2 0.8 255 255 + 3 1.0 255 255 (IGNORED) + \endverbatim + + This will build a graph: + \verbatim + colval + ^ + | + 250 - #**********# + | *** + 200 - *** + | *** + 150 - ** + | ** + 100 - *****# + | **** + 50 - ***** + | ***** + 0 - #***** + | + ---|----|----|----|----|----|----|----|----|----|----|--> position + 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 + \endverbatim + + You can also build graphs with a jump at a certain position + \verbatim + i position colval1 colval2 + ~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ + 0 0.0 0 (IGNORED) 0 + 1 0.5 100 0 + 2 1.0 255 255 (IGNORED) + \endverbatim + + This results in: + + \verbatim + colval + ^ + | + 250 - **# + | ** + 200 - ** + | ** + 150 - *** + | ** + 100 - # ** + | ****** ** + 50 - ****** ** + | ****** ** + 0 - #****** #** + | + ---|----|----|----|----|----|----|----|----|----|----|--> position + 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 + \endverbatim + + \see JKQTPBuildColorPaletteLUTLinSegments(), \ref JKQTPlotterImagePlotUserPalette , https://matplotlib.org/api/_as_gen/matplotlib.colors.LinearSegmentedColormap.html#matplotlib.colors.LinearSegmentedColormap */ -template -inline void JKQTPImagePlot_array2image(const T* dbl_in, int width, int height, QImage &img, const int* lutUser, int lutUserSize, double minColor, double maxColor, JKQTPMathImageColorRangeFailAction paletteMinFail=JKQTPMathImageLastPaletteColor, JKQTPMathImageColorRangeFailAction paletteMaxFail=JKQTPMathImageLastPaletteColor, QColor minFailColor=QColor("black"), QColor maxFailColor=QColor("black"), QColor nanColor=QColor("black"), QColor infColor=QColor("black"), bool logScale=false, double logBase=10.0) -{ - JKQTPImagePlot_array2image(dbl_in, width, height, img, JKQTPMathImageUSER_PALETTE, minColor, maxColor, paletteMinFail, paletteMaxFail, minFailColor, maxFailColor, nanColor, infColor, logScale, logBase, lutUser, lutUserSize); -} +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegmentsSorted(const QList& itemsR, const QList& itemsG, const QList& itemsB, int lut_size=JKQTPImageTools::LUTSIZE); + + + +/*! \brief build a linearly interpolated palette (as a look-up table) with \a lut_size entries by linearly interpolating between the nodes in \a items . + \b NOTE: \a items is assumed to be sorted by the first component of the \c QPair entries! + \ingroup jkqtplotter_imagelots_tools_LUTS + + The LUT is built following these rules: + - the final LUT has \a lut_size entries + - the first color in the lut is given by \c items.first().second + - the last color in the lut is given by \c items.last().second + - in between the colors are interpolated between the nodes in \a items and the color-nodes are + distributed according to the first component of the \c QPair entries:
+ \image html JKQTPBuildColorPaletteLUTLinInterpolateSorted.png + . + + \see JKQTPBuildColorPaletteLUTLinInterpolate(), \ref JKQTPlotterImagePlotUserPalette + +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInterpolateSorted(const QList >& items, int lut_size=JKQTPImageTools::LUTSIZE); + + +/*! \brief build a palette (as a look-up table) with \a lut_size entries that step between the nodes provided in \a items. + \b NOTE: \a items is assumed to be sorted by the first component of the \c QPair entries! + \ingroup jkqtplotter_imagelots_tools_LUTS + + The LUT is built following these rules: + - the final LUT has \a lut_size entries + - the first color in the lut is given by \c items.first().second + - the last color in the lut is given by \c items.last().second + - in between the colors are stepped between the nodes in \a items and the color-nodes are + distributed according to the first component of the \c QPair entries:
+ \image html JKQTPBuildColorPaletteLUTSorted.png + . + + \see JKQTPBuildColorPaletteLUT(), \ref JKQTPlotterImagePlotUserPalette + +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTSorted(const QList >& items, int lut_size=JKQTPImageTools::LUTSIZE); + +/*! \brief like JKQTPBuildColorPaletteLUTLinInterpolateSorted(), but sorts \a items before processing it! + \ingroup jkqtplotter_imagelots_tools_LUTS + + \copydetails JKQTPBuildColorPaletteLUTLinInterpolateSorted() +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInterpolate(QList > items, int lut_size=JKQTPImageTools::LUTSIZE); + + +/*! \brief like JKQTPBuildColorPaletteLUTSorted(), but sorts \a items before processing it! + \ingroup jkqtplotter_imagelots_tools_LUTS + + \copydetails JKQTPBuildColorPaletteLUTSorted() +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(QList > items, int lut_size=JKQTPImageTools::LUTSIZE); + +/*! \brief like JKQTPBuildColorPaletteLUTLinSegmentsSorted(), but sorts \a itemsR, \a itemB, \a itemsG before processing them! + \ingroup jkqtplotter_imagelots_tools_LUTS + + \copydetails JKQTPBuildColorPaletteLUTLinSegmentsSorted() + +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinSegments(QList itemsR, QList itemsG, QList itemsB, int lut_size=JKQTPImageTools::LUTSIZE); + + +/*! \brief like JKQTPBuildColorPaletteLUTLinInterpolateSorted(), but accepts a \c QMap as parameter instead of \c QList> + \ingroup jkqtplotter_imagelots_tools_LUTS + + \copydetails JKQTPBuildColorPaletteLUTLinInterpolateSorted() + +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUTLinInterpolate(const QMap& items, int lut_size=JKQTPImageTools::LUTSIZE); + + +/*! \brief like JKQTPBuildColorPaletteLUTSorted(), but accepts a \c QMap as parameter instead of \c QList> + \ingroup jkqtplotter_imagelots_tools_LUTS + + \copydetails JKQTPBuildColorPaletteLUTSorted() +*/ +JKQTPImageTools::LUTType JKQTCOMMON_LIB_EXPORT JKQTPBuildColorPaletteLUT(const QMap& items, int lut_size=JKQTPImageTools::LUTSIZE); -/*! \brief generates a QImage with width \a width and height 1 for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteImage(int i, int width); -/*! \brief generates a QImage with width \a width and height \a height for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteImage(int i, int width, int height); -/*! \brief generates a QImage with width \a width and height 1 for a specific JKQTPMathImageColorPalette - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteImage(JKQTPMathImageColorPalette palette, int width); -/*! \brief generates a QImage with width \a width and height \a height for a specific JKQTPMathImageColorPalette - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteImage(JKQTPMathImageColorPalette palette, int width, int height); -/*! \brief generates a QImage with width \a width and height 1 for a lookup-table \a lut with \a lut_size entries - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteImage(int* lut, int lut_size, int width); -/*! \brief generates a QImage with width \a width and height \a height for a lookup-table \a lut with \a lut_size entries - \ingroup jkqtplotter_imagelots_tools */ -QImage JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetAlphaPaletteImage(int* lut, int lut_size, int width, int height); - -/*! \brief generates a QIcon for the i-th color palette (\a i is based on the list returned by JKQTPImagePlot_getPredefinedPalettes() ) - \ingroup jkqtplotter_imagelots_tools */ -QIcon JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteIcon(int i) ; - - -/*! \brief generates a QIcon for a specific JKQTPMathImageColorPalette - \ingroup jkqtplotter_imagelots_tools */ -QIcon JKQTCOMMON_LIB_EXPORT JKQTPMathImageGetPaletteIcon(JKQTPMathImageColorPalette palette) ; diff --git a/lib/jkqtplotter/graphs/jkqtpimage.cpp b/lib/jkqtplotter/graphs/jkqtpimage.cpp index 68332483a3..f22227e41e 100644 --- a/lib/jkqtplotter/graphs/jkqtpimage.cpp +++ b/lib/jkqtplotter/graphs/jkqtpimage.cpp @@ -1225,7 +1225,7 @@ QImage JKQTPMathImage::drawOutsidePalette(uint8_t steps) } QImage b(h,200, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(d,h,steps, b, palette, 0, steps-1); + JKQTPImageTools::array2image(d,h,steps, b, palette, 0, steps-1); //b.save("c:/temp/b1.png"); if (modifierMode!=ModifyNone) { modifyImage(b, dd, DoubleArray, h,steps, 0, h-1); @@ -1265,7 +1265,7 @@ void JKQTPMathImage::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) } QStringList JKQTPMathImage::getPalettes() { - return JKQTPImagePlot_getPredefinedPalettes(); + return JKQTPImageTools::getPredefinedPalettes(); } int JKQTPMathImage::getPalettesCount() @@ -1297,7 +1297,7 @@ QImage JKQTPMathImage::getPaletteImage(int i, int width, int height) for (int j=0; j(pic, width, qMax(1,height), img, (JKQTPMathImageColorPalette)i, 0, width-1); + JKQTPImageTools::array2image(pic, width, qMax(1,height), img, static_cast(i), 0, width-1); free(pic); return img; } @@ -1346,7 +1346,7 @@ QImage JKQTPMathImage::getPaletteKeyImage(int i, int width, int height) pic[j]=exp(-0.5*(double((x-x01)*double(x-x01))/w1x+double((y-y01)*double(y-y01))/w1y))+0.7*exp(-0.5*(double((x-x02)*double(x-x02))/w2x+double((y-y02)*double(y-y02))/w2y)); if (pic[j]>mmax) mmax=pic[j]; } - JKQTPImagePlot_array2image(pic, width, height, img, (JKQTPMathImageColorPalette)i, 0, mmax); + JKQTPImageTools::array2image(pic, width, height, img, static_cast(i), 0, mmax); free(pic); return img; } @@ -1616,16 +1616,16 @@ QImage JKQTPMathImage::drawImage() { QImage img(Nx, Ny, QImage::Format_ARGB32); getDataMinMax(internalDataMin, internalDataMax); switch(datatype) { - case JKQTPMathImageBase::DoubleArray: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::FloatArray: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::UInt8Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::UInt16Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::UInt32Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::UInt64Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::Int8Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::Int16Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::Int32Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; - case JKQTPMathImageBase::Int64Array: JKQTPImagePlot_array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::DoubleArray: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::FloatArray: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::UInt8Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::UInt16Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::UInt32Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::UInt64Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::Int8Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::Int16Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::Int32Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; + case JKQTPMathImageBase::Int64Array: JKQTPImageTools::array2image(static_cast(data), Nx, Ny, img, palette, internalDataMin, internalDataMax, rangeMinFailAction, rangeMaxFailAction, rangeMinFailColor, rangeMaxFailColor, nanColor, infColor); break; } modifyImage(img); return img; diff --git a/lib/jkqtplotter/graphs/jkqtpimage.h b/lib/jkqtplotter/graphs/jkqtpimage.h index d222f0f2a8..577e8245d2 100644 --- a/lib/jkqtplotter/graphs/jkqtpimage.h +++ b/lib/jkqtplotter/graphs/jkqtpimage.h @@ -552,6 +552,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase { /*! \copydoc palette */ void setPalette(const JKQTPMathImageColorPalette & __value); /*! \copydoc palette */ + void setPalette(int pal); + /*! \copydoc palette */ JKQTPMathImageColorPalette getPalette() const; /*! \copydoc rangeMinFailAction */ void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value); @@ -654,7 +656,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase { /*! \copydoc modifierMax */ double getModifierMax() const; - void setPalette(int pal); + /*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...) diff --git a/lib/jkqtplotter/graphs/jkqtpimagergb.cpp b/lib/jkqtplotter/graphs/jkqtpimagergb.cpp index fde195b34b..2877136d95 100644 --- a/lib/jkqtplotter/graphs/jkqtpimagergb.cpp +++ b/lib/jkqtplotter/graphs/jkqtpimagergb.cpp @@ -290,15 +290,15 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS if (rgbMode==JKQTPRGBMathImageModeRGBMode) { d.palette=JKQTPMathImageRED; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeCMYMode) { d.palette=JKQTPMathImageINVERTED_CYANWHITE; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeHSVMode || rgbMode==JKQTPRGBMathImageModeHSLMode) { d.palette=JKQTPMathImageHSV; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } l<(pd, 1, pd_size, d.paletteImage, d.palette, 0, 199); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, 199); if (rgbMode==JKQTPRGBMathImageModeRGBMode) { d.palette=JKQTPMathImageGREEN; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeCMYMode) { d.palette=JKQTPMathImageINVERTED_MAGENTAWHITE; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeHSVMode) { d.palette=JKQTPMathImageGRAY; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - //JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); + //JKQTPImageTools::JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); QRgb* line=reinterpret_cast(d.paletteImage.scanLine(0)); for (int i=0; i(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); + //JKQTPImageTools::JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); QRgb* line=reinterpret_cast(d.paletteImage.scanLine(0)); for (int i=0; i(pd, 1, pd_size, d.paletteImage, d.palette, 0, 199); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, 199); if (rgbMode==JKQTPRGBMathImageModeRGBMode) { d.palette=JKQTPMathImageBLUE; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeCMYMode) { d.palette=JKQTPMathImageINVERTED_YELLOWWHITE; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); + JKQTPImageTools::array2image(pd, 1, pd_size, d.paletteImage, d.palette, 0, pd_size-1); } else if (rgbMode==JKQTPRGBMathImageModeHSVMode) { d.palette=JKQTPMathImageGRAY; d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32); - //JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); + //JKQTPImageTools::JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); QRgb* line=reinterpret_cast(d.paletteImage.scanLine(0)); for (int i=0; i(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); + //JKQTPImageTools::JKQTPImagePlot_array2image(pd, 1, pd_size, d.paletteImage, l[li].palette, 0, pd_size-1); QRgb* line=reinterpret_cast(d.paletteImage.scanLine(0)); for (int i=0; i(colorval, 2, 1, img, getPalette(), double(0.0), double(1.0)); + JKQTPImageTools::array2image(colorval, 2, 1, img, getPalette(), double(0.0), double(1.0)); color1=img.pixel(0,0); color2=img.pixel(1,0); } @@ -852,7 +852,7 @@ QColor JKQTPXYParametrizedScatterGraph::getLocalColor(int i) const colMin=intColMin; colMax=intColMax; } - JKQTPImagePlot_array2image(&colorval, 1, 1, img, palette, colMin, colMax); + JKQTPImageTools::array2image(&colorval, 1, 1, img, palette, colMin, colMax); return img.pixel(0,0); } diff --git a/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp b/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp index 5c7f6b82b7..ad2a26f7b9 100644 --- a/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp +++ b/lib/jkqtplotter/gui/jkqtpcomboboxes.cpp @@ -31,10 +31,10 @@ JKQTPMathImageColorPaletteComboBox::JKQTPMathImageColorPaletteComboBox(QWidget * QComboBox(parent) { setIconSize(QSize(JKQTPImageTools::PALETTE_ICON_WIDTH,16)); - QStringList pal=JKQTPImagePlot_getPredefinedPalettes(); + QStringList pal=JKQTPImageTools::getPredefinedPalettes(); clear(); for (int i=0; i &f, const QString &name) +{ + size_t col=addImageColumn(cols, rows, name); + JKQTPColumn& colref = columns[col]; + for (size_t y=0; y &f, const QString &name) { diff --git a/lib/jkqtplotter/jkqtpdatastorage.h b/lib/jkqtplotter/jkqtpdatastorage.h index 5244dff385..17dc5e9527 100644 --- a/lib/jkqtplotter/jkqtpdatastorage.h +++ b/lib/jkqtplotter/jkqtpdatastorage.h @@ -1229,6 +1229,21 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPDatastore{ * \see addColumnCalculatedFromColumn(), \ref JKQTPlotterBasicJKQTPDatastore */ size_t addCalculatedColumn(size_t rows, const std::function& f, const QString& name=QString("")); + /** \brief add an image column with width \a cols and height \a rows (i.e. \a rows * \a cols entries), that is calculated by calling \a f for each entry + * + * Pseudocode: + * \code + * for (y=0; y& f, const QString& name=QString("")); /** \brief add a column with the same number of entries, as in the other column \a otherColumn , that are calculated by calling \a f for each entry in \a otherColumn * * Pseudocode: diff --git a/lib/jkqtplotter/jkqtpimagetools.cpp b/lib/jkqtplotter/jkqtpimagetools.cpp index 1ab4f0094a..35c06e4ff4 100644 --- a/lib/jkqtplotter/jkqtpimagetools.cpp +++ b/lib/jkqtplotter/jkqtpimagetools.cpp @@ -131,7 +131,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa } } QImage b(h, 200, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(d, h, 200, b, palette, 0, 199); + JKQTPImageTools::array2image(d, h, 200, b, palette, 0, 199); QSizeF names=cbParent->getTextSizeSize(imageNameFontName, imageNameFontSize*cbParent->getFontSizeMultiplier(), imageName, painter); @@ -183,7 +183,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa } } QImage b(h,200, QImage::Format_ARGB32); - JKQTPImagePlot_array2image(d,h,200, b, palette, 0, 199); + JKQTPImageTools::array2image(d,h,200, b, palette, 0, 199); QSizeF names=cbParent->getTextSizeSize(imageNameFontName, imageNameFontSize*cbParent->getFontSizeMultiplier(), imageName, painter); @@ -229,7 +229,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa QStringList JKQTPColorPaletteStyleAndToolsMixin::getPalettes() { - return JKQTPImagePlot_getPredefinedPalettes(); + return JKQTPImageTools::getPredefinedPalettes(); } int JKQTPColorPaletteStyleAndToolsMixin::getPalettesCount() @@ -261,7 +261,7 @@ QImage JKQTPColorPaletteStyleAndToolsMixin::getPaletteImage(int i, int width) for (int j=0; j(pic, width, 1, img, (JKQTPMathImageColorPalette)i, 0, width-1); + JKQTPImageTools::array2image(pic, width, 1, img, static_cast(i), 0, width-1); free(pic); return img; } @@ -310,7 +310,7 @@ QImage JKQTPColorPaletteStyleAndToolsMixin::getPaletteKeyImage(int i, int width, pic[j]=exp(-0.5*(double((x-x01)*double(x-x01))/w1x+double((y-y01)*double(y-y01))/w1y))+0.7*exp(-0.5*(double((x-x02)*double(x-x02))/w2x+double((y-y02)*double(y-y02))/w2y)); if (pic[j]>mmax) mmax=pic[j]; } - JKQTPImagePlot_array2image(pic, width, height, img, (JKQTPMathImageColorPalette)i, 0, mmax); + JKQTPImageTools::array2image(pic, width, height, img, static_cast(i), 0, mmax); free(pic); return img; } @@ -322,7 +322,7 @@ QImage JKQTPColorPaletteStyleAndToolsMixin::getPaletteKeyImage(JKQTPMathImageCol void JKQTPColorPaletteStyleAndToolsMixin::setPalette(int pal) { - palette=(JKQTPMathImageColorPalette)pal; + palette=static_cast(pal); } void JKQTPColorPaletteStyleAndToolsMixin::cbSetParent(JKQTBasePlotter* parent) { diff --git a/screenshots/imageplot_userpal.png b/screenshots/imageplot_userpal.png new file mode 100644 index 0000000000..89633d32df Binary files /dev/null and b/screenshots/imageplot_userpal.png differ diff --git a/screenshots/imageplot_userpal_1_linear.png b/screenshots/imageplot_userpal_1_linear.png new file mode 100644 index 0000000000..7dfc7fd1da Binary files /dev/null and b/screenshots/imageplot_userpal_1_linear.png differ diff --git a/screenshots/imageplot_userpal_2_linear.png b/screenshots/imageplot_userpal_2_linear.png new file mode 100644 index 0000000000..f2ca1e0c68 Binary files /dev/null and b/screenshots/imageplot_userpal_2_linear.png differ diff --git a/screenshots/imageplot_userpal_palsimple.png b/screenshots/imageplot_userpal_palsimple.png new file mode 100644 index 0000000000..9ea21cfc4a Binary files /dev/null and b/screenshots/imageplot_userpal_palsimple.png differ diff --git a/screenshots/imageplot_userpal_palsteps2.png b/screenshots/imageplot_userpal_palsteps2.png new file mode 100644 index 0000000000..89633d32df Binary files /dev/null and b/screenshots/imageplot_userpal_palsteps2.png differ diff --git a/screenshots/imageplot_userpal_program.png b/screenshots/imageplot_userpal_program.png new file mode 100644 index 0000000000..1cbecc7f53 Binary files /dev/null and b/screenshots/imageplot_userpal_program.png differ diff --git a/screenshots/imageplot_userpal_program_small.png b/screenshots/imageplot_userpal_program_small.png new file mode 100644 index 0000000000..1cdf1b2672 Binary files /dev/null and b/screenshots/imageplot_userpal_program_small.png differ