/* Copyright (c) 2008-2019 Jan W. Krieger () This software is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (LGPL) for more details. You should have received a copy of the GNU Lesser General Public License (LGPL) along with this program. If not, see . */ #ifndef JKQTPIMAGETOOLS_H #define JKQTPIMAGETOOLS_H #include #include #include #include #include "jkqtplottertools/jkqtp_imexport.h" #include #include #include #include #include "jkqtplottertools/jkqtptools.h" #ifndef NO_JKQTPLOTTER #include "jkqtplottertools/jkqtptools.h" class JKQTPVerticalIndependentAxis; // forward class JKQTPHorizontalIndependentAxis; // forward class JKQTBasePlotter; // forward #endif /*! \brief Width of the Palette-Icons, generated e.g. by JKQTPMathImageGetPaletteIcon() \ingroup jkqtptools_qt */ #define jkqtp_PALETTE_ICON_WIDTH 64 /*! \brief Height of the Palette-Icons, generated e.g. by JKQTPMathImageGetPaletteIcon() \ingroup jkqtptools_qt */ #define jkqtp_PALETTE_IMAGEICON_HEIGHT 64 /*! \brief available palettes for coloring an image \ingroup jkqtplotter_imagelots_tools */ enum JKQTPMathImageColorPalette { JKQTPMathImageGRAY=0, /*!< \image html palettes/palette_gray.png */ JKQTPMathImageINVERTEDGRAY, /*!< \image html palettes/palette_invgray.png */ JKQTPMathImageRED, /*!< \image html palettes/palette_red.png */ JKQTPMathImageINVERTEDRED, /*!< \image html palettes/palette_invred.png */ JKQTPMathImageGREEN, /*!< \image html palettes/palette_green.png */ JKQTPMathImageINVERTEDGREEN, /*!< \image html palettes/palette_invgreen.png */ JKQTPMathImageBLUE, /*!< \image html palettes/palette_blue.png */ JKQTPMathImageINVERTEDBLUE, /*!< \image html palettes/palette_invblue.png */ JKQTPMathImageCYAN, /*!< \image html palettes/palette_cyan.png */ JKQTPMathImageINVERTED_CYAN, /*!< \image html palettes/palette_invcyan.png */ JKQTPMathImageYELLOW, /*!< \image html palettes/palette_yellow.png */ JKQTPMathImageINVERTED_YELLOW, /*!< \image html palettes/palette_invyellow.png */ JKQTPMathImageMAGENTA, /*!< \image html palettes/palette_magenta.png */ JKQTPMathImageINVERTED_MAGENTA, /*!< \image html palettes/palette_invmagenta.png */ JKQTPMathImageMATLAB, /*!< \image html palettes/palette_Matlab.png */ JKQTPMathImageINVERTED_MATLAB, /*!< \image html palettes/palette_invMatlab.png */ JKQTPMathImageRYGB, /*!< \image html palettes/palette_RYGB.png */ JKQTPMathImageINVERTED_RYGB, /*!< \image html palettes/palette_invRYGB.png */ JKQTPMathImageHSV, /*!< \image html palettes/palette_HSV.png */ JKQTPMathImageINVERTED_HSV, /*!< \image html palettes/palette_invHSV.png */ JKQTPMathImageRAINBOW, /*!< \image html palettes/palette_rainbow.png */ JKQTPMathImageINVERTED_RAINBOW, /*!< \image html palettes/palette_invrainbow.png */ JKQTPMathImageHOT, /*!< \image html palettes/palette_AFMhot.png */ JKQTPMathImageINVERTED_HOT, /*!< \image html palettes/palette_invAFMhot.png */ JKQTPMathImageOCEAN, /*!< \image html palettes/palette_ocean.png */ JKQTPMathImageINVERTED_OCEAN, /*!< \image html palettes/palette_invocean.png */ JKQTPMathImageTRAFFICLIGHT, /*!< \image html palettes/palette_trafficlight.png */ JKQTPMathImageINVERTED_TRAFFICLIGHT, /*!< \image html palettes/palette_invtrafficlight.png */ JKQTPMathImageBLUEMAGENTAYELLOW, /*!< \image html palettes/palette_BlMaYe.png */ JKQTPMathImageINVERTED_BLUEMAGENTAYELLOW, /*!< \image html palettes/palette_YeMaBl.png */ JKQTPMathImageBLUEYELLOW, /*!< \image html palettes/palette_BlYe.png */ JKQTPMathImageINVERTED_BLUEYELLOW, /*!< \image html palettes/palette_YeBl.png */ JKQTPMathImageBLUEWHITERED, /*!< \image html palettes/palette_bluewhitered.png */ JKQTPMathImageREDWHITEBLUE, /*!< \image html palettes/palette_redwhiteblue.png */ JKQTPMathImageBLACKBLUEREDYELLOW, /*!< \image html palettes/palette_BBlRdYe.png */ JKQTPMathImageGREENREDVIOLET, /*!< \image html palettes/palette_GnRdVi.png */ JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE, /*!< \image html palettes/palette_BWprint.png */ JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK, /*!< \image html palettes/palette_invBWprint.png */ JKQTPMathImageBR_GR, /*!< \image html palettes/palette_BrBG.png */ JKQTPMathImagePU_OR, /*!< \image html palettes/palette_PuOr.png */ JKQTPMathImageGN_BU, /*!< \image html palettes/palette_greenblue.png */ JKQTPMathImageBU_GN, /*!< \image html palettes/palette_bluegreen.png */ 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 */ JKQTPMathImageGN_BU_STEP, /*!< \image html palettes/palette_stepsGnBl.png */ JKQTPMathImageBU_GN_STEP, /*!< \image html palettes/palette_stepsBlGn.png */ JKQTPMathImageYL_GN_BU_STEP, /*!< \image html palettes/palette_stepsYeGnBu.png */ JKQTPMathImageCYANWHITE, /*!< \image html palettes/palette_cyanwhite.png */ JKQTPMathImageINVERTED_CYANWHITE, /*!< \image html palettes/palette_whitecyan.png */ JKQTPMathImageYELLOWWHITE, /*!< \image html palettes/palette_yellowwhite.png */ JKQTPMathImageINVERTED_YELLOWWHITE, /*!< \image html palettes/palette_whiteyellow.png */ JKQTPMathImageMAGENTAWHITE, /*!< \image html palettes/palette_magentawhite.png */ JKQTPMathImageINVERTED_MAGENTAWHITE, /*!< \image html palettes/palette_whitemagenta.png */ JKQTPMathImageBlueGreenRed, /*!< \image html palettes/palette_bluegreenred.png */ JKQTPMathImageRedGreenBlue, /*!< \image html palettes/palette_redgreenblue.png */ JKQTPMathImagePREDEFINED_PALETTES_COUNT, JKQTPMathImageUSER_PALETTE=65000, JKQTPMathImageALPHA=JKQTPMathImageUSER_PALETTE-2, JKQTPMathImageINVERTED_ALPHA=JKQTPMathImageUSER_PALETTE-1 }; /*! \brief modes available for image pixels that are above/below the pixel value range \ingroup jkqtplotter_imagelots_tools */ enum JKQTPMathImageColorRangeFailAction { JKQTPMathImageLastPaletteColor=0, /*!< set to last color in the palette */ JKQTPMathImageGivenColor=1, /*!< set to the provided min/max color */ JKQTPMathImageTransparent=2 /*!< set transparent */ }; /*! \brief modes available for RGB images \ingroup jkqtplotter_imagelots_tools */ enum JKQTPRGBMathImageRGBMode { JKQTPRGBMathImageModeRGBMode=0, JKQTPRGBMathImageModeHSVMode=1, JKQTPRGBMathImageModeHSLMode=2, JKQTPRGBMathImageModeCMYMode=3 }; /*! \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 */ template inline QVector JKQTPImagePlot_arrayToDVector(const T* input, int N) { if (!input || N<=0) return QVector(); QVector out(N, 0.0); for (int i=0; i JKQTPImagePlot_BarrayToDVector(const bool* input, int N) { if (!input || N<=0) return QVector(); QVector out(N, 0.0); for (int i=0; i inline double JKQTPImagePlot_getImageMin(T* dbl, int width, int height) { if (!dbl || width<=0 || height<=0) return 0; double min = 0; double max = 0; 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; } } } return min; }; /*! \brief fin the maximum pixel value in the given image \a dbl with width \a width and height \a height \ingroup jkqtplotter_imagelots_tools */ template inline double JKQTPImagePlot_getImageMax(T* dbl, int width, int height) { if (!dbl || width<=0 || height<=0) return 0; double min = 0; double max = 0; 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; } } } return max; }; /*! \brief convert a 2D image (as 1D array) into a QImage and puts the image values into one color channel (set by \a channel).The other color channels are not changed! So a repeated call to this function for the SAME QImage will result in a step-by-step buildup of an image. \ingroup jkqtplotter_imagelots_tools \note All calls (except channel>=3, i.e. alpha) set alpha to 255. Only the call with channel==3 (alpha) sets alpha to the desired value. Calls with channel==4 (saturation), channel==5 (value) leave alpha as it is. */ template inline void JKQTPImagePlot_array2RGBimage(T* dbl_in, int width, int height, QImage &img, int channel, T minColor, T maxColor, JKQTPRGBMathImageRGBMode rgbMode=JKQTPRGBMathImageModeRGBMode, bool logScale=false, double logBase=10.0) { if (!dbl_in || width<=0 || height<=0) return; double min = *dbl_in; double max = *dbl_in; bool first=true; if (minColor == maxColor) { for (int i=1; i(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; } T* dbl=dbl_in; if (logScale) { double logB=log10(logBase); dbl=(T*)malloc(width*height*sizeof(T)); //memcpy(dbl, dbl_in, width*height*sizeof(T)); for (int i=0; i 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"r: "< 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"g: "< 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"b: "< 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"r: "< 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"g: "< 255) ? 255 : v); const QRgb l=line[i]; //if (j==5) qDebug()<<"b: "< 360) ? 360 : v); QColor l=QColor::fromRgb(line[i]); //if (i<10 && j==5) qDebug()<<"hi: "< 255) ? 255 : v); QColor l=QColor::fromRgb(line[i]); //if (i<10 && j==5) qDebug()<<"si: "< 255) ? 255 : v); QColor l=QColor::fromRgb(line[i]); //if (i<10 && j==5) qDebug()<<"vi: "< 360) ? 360 : v); QColor l=line[i]; l.setHsl(v, l.saturation(), l.lightness()); line[i]=l.rgb(); } } } else if (channel==1) { for (int j=0; j 255) ? 255 : v); QColor l=line[i]; l.setHsl(l.hue(), v, l.lightness()); line[i]=l.rgb(); } } } else if (channel==2) { for (int j=0; j 255) ? 255 : v); QColor l=line[i]; l.setHsl(l.hue(), l.saturation(), v); line[i]=l.rgb(); } } } } if (channel==3) { for (int j=0; j 255) ? 255 : v); const QRgb l=line[i]; line[i]=qRgba(qRed(l),qGreen(l),qBlue(l),v); } } } else if (channel==4) { for (int j=0; j 255) ? 255 : v); QColor c=QColor::fromRgba(line[i]); c.setHsv(c.hue(), v, c.value(), c.alpha()); line[i]=c.rgba(); } } } else if (channel==5) { for (int j=0; j 255) ? 255 : v); QColor c=QColor::fromRgba(line[i]); c.setHsv(c.hue(), c.saturation(), v, c.alpha()); line[i]=c.rgba(); } } } } if (logScale) free(dbl); } /*! \brief Generate a QList with \a N entries of the value \a defaultValue \ingroup jkqtptools_qt */ template inline QList JKQTPImagePlot_makeQList(const T& defaultVal, int N=1) { QList l; for (int i=0; i > items, int lut_size=JKQTPImagePlot_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 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 ... JKQTPImagePlot_LUTSIZE. \a lut needs to have \c JKQTPImagePlot_LUTSIZE) entries */ void 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 LIB_EXPORT JKQTPImagePlot_buildDefinedPalette(int* lut, int N, ...); /*! \brief return a list of all globally available LUTs \ingroup jkqtplotter_imagelots_tools */ QStringList 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 */ LIB_EXPORT int* JKQTPImagePlot_getCreateLUT(QList &lutstore, JKQTPMathImageColorPalette palette); /*! \brief frees a list of LUTs \ingroup jkqtplotter_imagelots_tools \internal */ void LIB_EXPORT JKQTPImagePlot_freeLUTs(QList &lutstore); /*! \brief internal global storage object for lookup-tables \ingroup jkqtplotter_imagelots_tools \internal */ extern LIB_EXPORT QList global_jkqtpimagetools_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 JKQTPImagePlot_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] im 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 */ template inline void JKQTPImagePlot_array2image(const T* dbl_in, int width, int height, QImage &img, JKQTPMathImageColorPalette palette, T minColor, T 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); }; /*! \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 JKQTPImagePlot_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] im 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 */ template inline void JKQTPImagePlot_array2image(const T* dbl_in, int width, int height, QImage &img, const int* lutUser, int lutUserSize, T minColor, T 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); } /*! \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 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 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 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 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 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 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 LIB_EXPORT JKQTPMathImageGetPaletteIcon(int i) ; /*! \brief generates a QIcon for a specific JKQTPMathImageColorPalette \ingroup jkqtplotter_imagelots_tools */ QIcon LIB_EXPORT JKQTPMathImageGetPaletteIcon(JKQTPMathImageColorPalette palette) ; #ifndef NO_JKQTPLOTTER /*! \brief if a class is derived from this class, it may use color bars \ingroup jkqtplotter_imagelots_tools */ class LIB_EXPORT JKQTPColorPaletteTools { public: JKQTPColorPaletteTools(JKQTBasePlotter *parent); virtual ~JKQTPColorPaletteTools(); /*! \brief get list with all available palettes */ static QStringList getPalettes() ; /*! \brief get list with all available palettes */ static int getPalettesCount() ; /*! \brief get QIcon representing the given palette */ static QIcon getPaletteIcon(int i) ; /*! \brief get QIcon representing the given palette */ static QIcon getPaletteIcon(JKQTPMathImageColorPalette palette) ; /*! \brief get QIcon representing the given palette */ static QImage getPaletteImage(int i, int width) ; /*! \brief get QIcon representing the given palette */ static QImage getPaletteImage(JKQTPMathImageColorPalette palette, int width) ; /*! \brief get QIcon representing the given palette */ static QIcon getPaletteKeyIcon(int i) ; /*! \brief get QIcon representing the given palette */ static QIcon getPaletteKeyIcon(JKQTPMathImageColorPalette palette) ; /*! \brief get QIcon representing the given palette */ static QImage getPaletteKeyImage(int i, int width, int height) ; /*! \brief get QIcon representing the given palette */ static QImage getPaletteKeyImage(JKQTPMathImageColorPalette palette, int width, int height) ; void set_palette(int pal); /*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...) \note If you want to draw outside, then you'll also have to implement drawOutside() */ void cbGetOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace); /*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...) \note If you want to draw outside, then you'll also have to implement getOutsideSize(), so enough space is reserved The four value supplied tell the method where to draw (inside one of the rectangles). */ void cbDrawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace); void cbSetParent(JKQTBasePlotter* parent); /** \brief determine min/max data value of the image */ virtual void cbGetDataMinMax(double& imin, double& imax)=0; virtual double getInternalDataMin() const ; virtual double getInternalDataMax() const ; protected: JKQTBasePlotter* cbParent; /** \brief top color bar visible */ bool colorBarTopVisible; /** \brief right color bar visible */ bool colorBarRightVisible; /** \brief name of the image displayed above color bar (may contain LaTeX markup!) */ QString imageName; /** \brief font name when displaying imageName */ QString imageNameFontName; /** \brief font size in points when displaying imageName */ double imageNameFontSize; /** \brief palette for plotting an image */ JKQTPMathImageColorPalette palette; /** \brief indicate whether to display a color bar */ bool showColorBar; /** \brief width of the color bar */ int colorBarWidth; /** \brief height of the color bar, as multiple of plotHeight */ double colorBarRelativeHeight; /** \brief indicates whether to estimate min/max of the image automatically */ bool autoImageRange; /** \brief image value range minimum */ double imageMin; /** \brief image value range maximum */ double imageMax; /** \brief offset between outside space border and color bar */ int colorBarOffset; /** \brief which action to take if a color is below \a imageMin and \a autoImageRange \c ==false */ JKQTPMathImageColorRangeFailAction rangeMinFailAction; /** \brief which action to take if a color is above \a imageMax and \a autoImageRange \c ==false */ JKQTPMathImageColorRangeFailAction rangeMaxFailAction; /** \brief color to use for some settings of \a rangeMinFailAction */ QColor rangeMinFailColor; /** \brief color to use for some settings of \a rangeMaxFailAction */ QColor rangeMaxFailColor; /** \brief color to use for a not-a-number value */ QColor nanColor; /** \brief color to use for an infinity value */ QColor infColor; /** \brief object used for color bar axes * * \note this axis has some kind of a special role. It is used to format color bar axes */ JKQTPVerticalIndependentAxis* colorBarRightAxis; JKQTPHorizontalIndependentAxis* colorBarTopAxis; public: /*! \brief sets the property palette to the specified \a __value. \details Description of the parameter palette is:
\copydoc palette
\see palette for more information */ inline virtual void set_palette(const JKQTPMathImageColorPalette & __value) { this->palette = __value; } /*! \brief returns the property palette. \details Description of the parameter palette is:
\copydoc palette
\see palette for more information */ inline virtual JKQTPMathImageColorPalette get_palette() const { return this->palette; } /*! \brief sets the property rangeMinFailAction to the specified \a __value. \details Description of the parameter rangeMinFailAction is:
\copydoc rangeMinFailAction
\see rangeMinFailAction for more information */ inline virtual void set_rangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value) { this->rangeMinFailAction = __value; } /*! \brief returns the property rangeMinFailAction. \details Description of the parameter rangeMinFailAction is:
\copydoc rangeMinFailAction
\see rangeMinFailAction for more information */ inline virtual JKQTPMathImageColorRangeFailAction get_rangeMinFailAction() const { return this->rangeMinFailAction; } /*! \brief sets the property rangeMaxFailAction to the specified \a __value. \details Description of the parameter rangeMaxFailAction is:
\copydoc rangeMaxFailAction
\see rangeMaxFailAction for more information */ inline virtual void set_rangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value) { this->rangeMaxFailAction = __value; } /*! \brief returns the property rangeMaxFailAction. \details Description of the parameter rangeMaxFailAction is:
\copydoc rangeMaxFailAction
\see rangeMaxFailAction for more information */ inline virtual JKQTPMathImageColorRangeFailAction get_rangeMaxFailAction() const { return this->rangeMaxFailAction; } /*! \brief sets the property rangeMinFailColor to the specified \a __value. \details Description of the parameter rangeMinFailColor is:
\copydoc rangeMinFailColor
\see rangeMinFailColor for more information */ inline virtual void set_rangeMinFailColor(const QColor & __value) { this->rangeMinFailColor = __value; } /*! \brief returns the property rangeMinFailColor. \details Description of the parameter rangeMinFailColor is:
\copydoc rangeMinFailColor
\see rangeMinFailColor for more information */ inline virtual QColor get_rangeMinFailColor() const { return this->rangeMinFailColor; } /*! \brief sets the property rangeMaxFailColor to the specified \a __value. \details Description of the parameter rangeMaxFailColor is:
\copydoc rangeMaxFailColor
\see rangeMaxFailColor for more information */ inline virtual void set_rangeMaxFailColor(const QColor & __value) { this->rangeMaxFailColor = __value; } /*! \brief returns the property rangeMaxFailColor. \details Description of the parameter rangeMaxFailColor is:
\copydoc rangeMaxFailColor
\see rangeMaxFailColor for more information */ inline virtual QColor get_rangeMaxFailColor() const { return this->rangeMaxFailColor; } /*! \brief sets the property nanColor to the specified \a __value. \details Description of the parameter nanColor is:
\copydoc nanColor
\see nanColor for more information */ inline virtual void set_nanColor(const QColor & __value) { this->nanColor = __value; } /*! \brief returns the property nanColor. \details Description of the parameter nanColor is:
\copydoc nanColor
\see nanColor for more information */ inline virtual QColor get_nanColor() const { return this->nanColor; } /*! \brief sets the property infColor to the specified \a __value. \details Description of the parameter infColor is:
\copydoc infColor
\see infColor for more information */ inline virtual void set_infColor(const QColor & __value) { this->infColor = __value; } /*! \brief returns the property infColor. \details Description of the parameter infColor is:
\copydoc infColor
\see infColor for more information */ inline virtual QColor get_infColor() const { return this->infColor; } /*! \brief sets the property showColorBar to the specified \a __value. \details Description of the parameter showColorBar is:
\copydoc showColorBar
\see showColorBar for more information */ inline virtual void set_showColorBar(bool __value) { this->showColorBar = __value; } /*! \brief returns the property showColorBar. \details Description of the parameter showColorBar is:
\copydoc showColorBar
\see showColorBar for more information */ inline virtual bool get_showColorBar() const { return this->showColorBar; } /*! \brief sets the property colorBarWidth to the specified \a __value. \details Description of the parameter colorBarWidth is:
\copydoc colorBarWidth
\see colorBarWidth for more information */ inline virtual void set_colorBarWidth(int __value) { this->colorBarWidth = __value; } /*! \brief returns the property colorBarWidth. \details Description of the parameter colorBarWidth is:
\copydoc colorBarWidth
\see colorBarWidth for more information */ inline virtual int get_colorBarWidth() const { return this->colorBarWidth; } /*! \brief sets the property colorBarOffset to the specified \a __value. \details Description of the parameter colorBarOffset is:
\copydoc colorBarOffset
\see colorBarOffset for more information */ inline virtual void set_colorBarOffset(int __value) { this->colorBarOffset = __value; } /*! \brief returns the property colorBarOffset. \details Description of the parameter colorBarOffset is:
\copydoc colorBarOffset
\see colorBarOffset for more information */ inline virtual int get_colorBarOffset() const { return this->colorBarOffset; } /*! \brief sets the property colorBarRelativeHeight to the specified \a __value. \details Description of the parameter colorBarRelativeHeight is:
\copydoc colorBarRelativeHeight
\see colorBarRelativeHeight for more information */ inline virtual void set_colorBarRelativeHeight(double __value) { this->colorBarRelativeHeight = __value; } /*! \brief returns the property colorBarRelativeHeight. \details Description of the parameter colorBarRelativeHeight is:
\copydoc colorBarRelativeHeight
\see colorBarRelativeHeight for more information */ inline virtual double get_colorBarRelativeHeight() const { return this->colorBarRelativeHeight; } /*! \brief sets the property imageMin to the specified \a __value. \details Description of the parameter imageMin is:
\copydoc imageMin
\see imageMin for more information */ inline virtual void set_imageMin(double __value) { this->imageMin = __value; } /*! \brief returns the property imageMin. \details Description of the parameter imageMin is:
\copydoc imageMin
\see imageMin for more information */ inline virtual double get_imageMin() const { return this->imageMin; } /*! \brief sets the property imageMax to the specified \a __value. \details Description of the parameter imageMax is:
\copydoc imageMax
\see imageMax for more information */ inline virtual void set_imageMax(double __value) { this->imageMax = __value; } /*! \brief returns the property imageMax. \details Description of the parameter imageMax is:
\copydoc imageMax
\see imageMax for more information */ inline virtual double get_imageMax() const { return this->imageMax; } /*! \brief sets the property autoImageRange to the specified \a __value. \details Description of the parameter autoImageRange is:
\copydoc autoImageRange
\see autoImageRange for more information */ inline virtual void set_autoImageRange(bool __value) { this->autoImageRange = __value; } /*! \brief returns the property autoImageRange. \details Description of the parameter autoImageRange is:
\copydoc autoImageRange
\see autoImageRange for more information */ inline virtual bool get_autoImageRange() const { return this->autoImageRange; } /*! \brief sets the property imageName to the specified \a __value. \details Description of the parameter imageName is:
\copydoc imageName
\see imageName for more information */ inline virtual void set_imageName(const QString & __value) { this->imageName = __value; } /*! \brief returns the property imageName. \details Description of the parameter imageName is:
\copydoc imageName
\see imageName for more information */ inline virtual QString get_imageName() const { return this->imageName; } /*! \brief sets the property imageNameFontName to the specified \a __value. \details Description of the parameter imageNameFontName is:
\copydoc imageNameFontName
\see imageNameFontName for more information */ inline virtual void set_imageNameFontName(const QString & __value) { this->imageNameFontName = __value; } /*! \brief returns the property imageNameFontName. \details Description of the parameter imageNameFontName is:
\copydoc imageNameFontName
\see imageNameFontName for more information */ inline virtual QString get_imageNameFontName() const { return this->imageNameFontName; } /*! \brief sets the property imageNameFontSize to the specified \a __value. \details Description of the parameter imageNameFontSize is:
\copydoc imageNameFontSize
\see imageNameFontSize for more information */ inline virtual void set_imageNameFontSize(double __value) { this->imageNameFontSize = __value; } /*! \brief returns the property imageNameFontSize. \details Description of the parameter imageNameFontSize is:
\copydoc imageNameFontSize
\see imageNameFontSize for more information */ inline virtual double get_imageNameFontSize() const { return this->imageNameFontSize; } /*! \brief returns the property colorBarRightAxis. \details Description of the parameter colorBarRightAxis is:
\copydoc colorBarRightAxis
. \see colorBarRightAxis for more information */ inline JKQTPVerticalIndependentAxis* get_colorBarRightAxis() const { return this->colorBarRightAxis; } /*! \brief returns the property colorBarTopAxis. \details Description of the parameter colorBarTopAxis is:
\copydoc colorBarTopAxis
. \see colorBarTopAxis for more information */ inline JKQTPHorizontalIndependentAxis* get_colorBarTopAxis() const { return this->colorBarTopAxis; } /*! \brief sets the property colorBarTopVisible to the specified \a __value. \details Description of the parameter colorBarTopVisible is:
\copydoc colorBarTopVisible
\see colorBarTopVisible for more information */ inline virtual void set_colorBarTopVisible(bool __value) { this->colorBarTopVisible = __value; } /*! \brief returns the property colorBarTopVisible. \details Description of the parameter colorBarTopVisible is:
\copydoc colorBarTopVisible
\see colorBarTopVisible for more information */ inline virtual bool get_colorBarTopVisible() const { return this->colorBarTopVisible; } /*! \brief sets the property colorBarRightVisible to the specified \a __value. \details Description of the parameter colorBarRightVisible is:
\copydoc colorBarRightVisible
\see colorBarRightVisible for more information */ inline virtual void set_colorBarRightVisible(bool __value) { this->colorBarRightVisible = __value; } /*! \brief returns the property colorBarRightVisible. \details Description of the parameter colorBarRightVisible is:
\copydoc colorBarRightVisible
\see colorBarRightVisible for more information */ inline virtual bool get_colorBarRightVisible() const { return this->colorBarRightVisible; } }; #endif #endif // JKQTPIMAGETOOLS_H