mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
changed JKQTPColorDerivationMode from an ENUM to a STRUCT, which extends its capabilities significantly
This commit is contained in:
parent
cf27b77b6b
commit
03497b6c31
@ -28,6 +28,7 @@ Copyright (c) 2008-2020 Jan W. Krieger (<jan@jkrieger.de>)
|
||||
#include <QSet>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QGuiApplication>
|
||||
#include <QKeyEvent>
|
||||
#include <QAction>
|
||||
#include <QLocale>
|
||||
@ -502,6 +503,18 @@ static const struct RGBData {
|
||||
|
||||
static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
|
||||
|
||||
const QStringList& jkqtp_listNamedColors() {
|
||||
static QStringList sl;
|
||||
if (sl.size()==0) {
|
||||
sl.reserve(rgbTblSize);
|
||||
for (int i=0; i<rgbTblSize; i++) {
|
||||
sl.push_back(rgbTbl[i].name);
|
||||
|
||||
}
|
||||
}
|
||||
return sl;
|
||||
}
|
||||
|
||||
QString jkqtp_rgbtostring(unsigned char r, unsigned char g, unsigned char b, unsigned char a, bool useSpecialTransparencySyntax) {
|
||||
if (a==255) {// only for non-transparent colors
|
||||
for (int i=0; i<rgbTblSize; i++) {
|
||||
@ -530,42 +543,89 @@ QString jkqtp_QColor2String(QColor color, bool useSpecialTransparencySyntax) {
|
||||
useSpecialTransparencySyntax);
|
||||
}
|
||||
|
||||
|
||||
QColor jkqtp_lookupQColorName(const QString &color) {
|
||||
const QString col=color.toLower().trimmed();
|
||||
if (col=="window") return QGuiApplication::palette().color(QPalette::Window);
|
||||
if (col=="windowtext") return QGuiApplication::palette().color(QPalette::WindowText);
|
||||
if (col=="button") return QGuiApplication::palette().color(QPalette::Button);
|
||||
if (col=="light") return QGuiApplication::palette().color(QPalette::Light);
|
||||
if (col=="midlight") return QGuiApplication::palette().color(QPalette::Midlight);
|
||||
if (col=="dark") return QGuiApplication::palette().color(QPalette::Dark);
|
||||
if (col=="mid") return QGuiApplication::palette().color(QPalette::Mid);
|
||||
if (col=="text") return QGuiApplication::palette().color(QPalette::Text);
|
||||
if (col=="brightttext") return QGuiApplication::palette().color(QPalette::BrightText);
|
||||
if (col=="base") return QGuiApplication::palette().color(QPalette::Base);
|
||||
if (col=="window") return QGuiApplication::palette().color(QPalette::Window);
|
||||
if (col=="shadow") return QGuiApplication::palette().color(QPalette::Shadow);
|
||||
if (col=="highlight") return QGuiApplication::palette().color(QPalette::Highlight);
|
||||
if (col=="highlightedtext") return QGuiApplication::palette().color(QPalette::HighlightedText);
|
||||
if (col=="link") return QGuiApplication::palette().color(QPalette::Link);
|
||||
if (col=="linkvisited") return QGuiApplication::palette().color(QPalette::LinkVisited);
|
||||
if (col=="alternatebase") return QGuiApplication::palette().color(QPalette::AlternateBase);
|
||||
if (col=="norole") return QGuiApplication::palette().color(QPalette::NoRole);
|
||||
if (col=="tooltipbase") return QGuiApplication::palette().color(QPalette::ToolTipBase);
|
||||
if (col=="tooltiptext") return QGuiApplication::palette().color(QPalette::ToolTipText);
|
||||
if (col=="placeholdertext") return QGuiApplication::palette().color(QPalette::PlaceholderText);
|
||||
|
||||
|
||||
for (int i=0; i<rgbTblSize; i++) {
|
||||
if (col==rgbTbl[i].name) return QColor(rgbTbl[i].value);
|
||||
}
|
||||
return QColor(color);
|
||||
}
|
||||
|
||||
QColor jkqtp_String2QColor(const QString &color)
|
||||
{
|
||||
#if (QT_VERSION>=QT_VERSION_CHECK(6, 0, 0))
|
||||
QRegularExpression rxP("(.+)\\s*,\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegularExpression rxNP("(.+)\\s*,\\s*([\\d]+)");
|
||||
QRegularExpression rxP("(.+)\\s*,\\s*t?\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegularExpression rxAP("(.+)\\s*,\\s*a\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegularExpression rxNP("(.+)\\s*,\\s*a?\\s*([\\d]+)");
|
||||
const auto mP=rxP.match(color);
|
||||
if (mP.hasMatch()) {
|
||||
QColor col(mP.captured(1));
|
||||
QColor col=jkqtp_lookupQColorName(mP.captured(1));
|
||||
double a=QLocale::c().toDouble(mP.captured(2));
|
||||
col.setAlphaF(1.0-a/100.0);
|
||||
return col;
|
||||
}
|
||||
const auto mAP=rxAP.match(color);
|
||||
if (mAP.hasMatch()) {
|
||||
QColor col=jkqtp_lookupQColorName(mAP.captured(1));
|
||||
double a=QLocale::c().toDouble(mAP.captured(2));
|
||||
col.setAlphaF(a/100.0);
|
||||
return col;
|
||||
}
|
||||
const auto mNP=rxNP.match(color);
|
||||
if (mNP.hasMatch()) {
|
||||
QColor col(mNP.captured(1));
|
||||
QColor col=jkqtp_lookupQColorName(mNP.captured(1));
|
||||
double a=QLocale::c().toInt(mNP.captured(2));
|
||||
col.setAlphaF(a/255.0);
|
||||
return col;
|
||||
}
|
||||
#else
|
||||
QRegExp rxP("(.+)\\s*,\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegExp rxNP("(.+)\\s*,\\s*([\\d]+)");
|
||||
QRegExp rxP("(.+)\\s*,\\s*t?\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegExp rxAP("(.+)\\s*,\\s*a\\s*(\\d+\\.?\\d+)\\%");
|
||||
QRegExp rxNP("(.+)\\s*,\\s*a?\\s*([\\d]+)");
|
||||
if (rxP.exactMatch(color)) {
|
||||
QColor col(rxP.cap(1));
|
||||
QColor col=jkqtp_lookupQColorName(rxP.cap(1));
|
||||
double a=QLocale::c().toDouble(rxP.cap(2));
|
||||
col.setAlphaF(1.0-a/100.0);
|
||||
return col;
|
||||
}
|
||||
if (rxAP.exactMatch(color)) {
|
||||
QColor col=jkqtp_lookupQColorName(rxAP.cap(1));
|
||||
double a=QLocale::c().toDouble(rxAP.cap(2));
|
||||
col.setAlphaF(a/100.0);
|
||||
return col;
|
||||
}
|
||||
if (rxNP.exactMatch(color)) {
|
||||
QColor col(rxNP.cap(1));
|
||||
QColor col=jkqtp_lookupQColorName(rxNP.cap(1));
|
||||
double a=QLocale::c().toInt(rxNP.cap(2));
|
||||
col.setAlphaF(a/255.0);
|
||||
return col;
|
||||
}
|
||||
#endif
|
||||
return QColor(color);
|
||||
return jkqtp_lookupQColorName(color);
|
||||
}
|
||||
|
||||
std::string jkqtp_to_valid_variable_name(const std::string& input) {
|
||||
|
@ -36,7 +36,8 @@ JKQTCOMMON_LIB_EXPORT QString jkqtp_QPenStyle2String(Qt::PenStyle style);
|
||||
* \ingroup jkqtptools_string
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT Qt::PenStyle jkqtp_String2QPenStyle(const QString& style);
|
||||
/** \brief converts a QT::BrushStyle into a string
|
||||
|
||||
/** \brief converts a Qt::BrushStyle into a string
|
||||
* \ingroup jkqtptools_string
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT QString jkqtp_QBrushStyle2String(Qt::BrushStyle style);
|
||||
@ -172,6 +173,11 @@ JKQTCOMMON_LIB_EXPORT std::string jkqtp_booltostr(bool data);
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT QString jkqtp_rgbtostring(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255, bool useSpecialTransparencySyntax=true);
|
||||
|
||||
/** \brief list the (machine-readable) names of all predefined colors
|
||||
* \ingroup jkqtptools_string
|
||||
*
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT const QStringList& jkqtp_listNamedColors();
|
||||
/** \brief converts a QColor into a string using the jkqtp_rgbtostring() method.
|
||||
* \ingroup jkqtptools_string
|
||||
*
|
||||
@ -179,10 +185,20 @@ JKQTCOMMON_LIB_EXPORT QString jkqtp_rgbtostring(unsigned char r, unsigned char g
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT QString jkqtp_QColor2String(QColor color, bool useSpecialTransparencySyntax=true);
|
||||
|
||||
/** \brief converts a QString into a QColor, does not support the ,alpha%-notation, use jkqtp_String2QColor() for a full conversion!
|
||||
* \ingroup jkqtptools_string
|
||||
*
|
||||
* This returns a QString which contains the name of named colors and the RGBA values in a QT readable form othertwise.
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT QColor jkqtp_lookupQColorName(const QString& color);
|
||||
|
||||
/** \brief converts a QString into a QColor, compatible with jkqtp_QColor2String(QColor color);
|
||||
* \ingroup jkqtptools_string
|
||||
*
|
||||
* This returns a QString which contains the name of named colors and the RGBA values in a QT readable form othertwise.
|
||||
* This function allows to add the alpha-value as \c "<color_name>,<alpha>" as integer betwee 0 and 255
|
||||
* or as \c "<color_name>,<transparency_percent>%" in the range of 0..100 % (i.e. (1-transparency_percent/100)*255).
|
||||
* Also \c "<color_name>,a<alpha_percent>%" in the range of 0..100 % (i.e. alpha_percent/100*255).
|
||||
*/
|
||||
JKQTCOMMON_LIB_EXPORT QColor jkqtp_String2QColor(const QString& color);
|
||||
|
||||
|
@ -308,7 +308,7 @@ JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTBasePlotter
|
||||
gridDeltaX=1;
|
||||
gridDeltaY=1;
|
||||
gridSymbolFractionSize=0.9;
|
||||
symbolFillDerivationMode=JKQTPFFCMLighterColor;
|
||||
symbolFillDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMLighterColor;
|
||||
if (parent) {
|
||||
symbolFillDerivationMode=parent->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode;
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ JKQTGraphsSpecificStyleProperties::JKQTGraphsSpecificStyleProperties(JKQTPPlotSt
|
||||
defaultHeadDecoratorStyle(JKQTPLineDecoratorStyle::JKQTPDefaultLineDecorator),
|
||||
defaultHeadDecoratorSizeFactor(8.0),
|
||||
errorFillStyle(Qt::SolidPattern),
|
||||
graphColorDerivationMode(JKQTPFFCMSameColor),
|
||||
fillColorDerivationMode(JKQTPFFCMLighterColor),
|
||||
errorColorDerivationMode(JKQTPFFCMDarkerColor),
|
||||
errorFillColorDerivationMode(JKQTPFFCMLighterAndTransparentColor),
|
||||
symbolFillColorDerivationMode(JKQTPFFCMLighterColor)
|
||||
graphColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMSameColor),
|
||||
fillColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMLighterColor),
|
||||
errorColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMDarkerColor),
|
||||
errorFillColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMLighterAndTransparentColor),
|
||||
symbolFillColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMLighterColor)
|
||||
{
|
||||
modifyForDefaultStyle(type);
|
||||
}
|
||||
@ -36,28 +36,28 @@ void JKQTGraphsSpecificStyleProperties::modifyForDefaultStyle(JKQTPPlotStyleType
|
||||
case JKQTPPlotStyleType::Default:
|
||||
break;
|
||||
case JKQTPPlotStyleType::Filled:
|
||||
fillColorDerivationMode=JKQTPFFCMLighterAndTransparentColor;
|
||||
fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMLighterAndTransparentColor;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Impulses:
|
||||
defaultLineWidth=3;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Barchart:
|
||||
defaultLineWidth=0;
|
||||
graphColorDerivationMode=JKQTPFFCMLighterColor;
|
||||
fillColorDerivationMode=JKQTPFFCMLighterColor;
|
||||
graphColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMLighterColor;
|
||||
fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMLighterColor;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Boxplot:
|
||||
defaultLineWidth=1;
|
||||
fillColorDerivationMode=JKQTPFFCMWhite;
|
||||
graphColorDerivationMode=JKQTPFFCMSameNonTransparentColor;
|
||||
fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMWhite;
|
||||
graphColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMSameNonTransparentColor;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Annotation:
|
||||
graphColorDerivationMode=JKQTPFFCMSameNonTransparentColor;
|
||||
graphColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMSameNonTransparentColor;
|
||||
defaultSymbolSize=16;
|
||||
break;
|
||||
case JKQTPPlotStyleType::Geometric:
|
||||
graphColorDerivationMode=JKQTPFFCMSameNonTransparentColor;
|
||||
fillColorDerivationMode=JKQTPFFCMFullyTransparentColor;
|
||||
graphColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMSameNonTransparentColor;
|
||||
fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMFullyTransparentColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -376,153 +376,352 @@ bool JKQTPCADrawModeHasAxisLabel(JKQTPCADrawMode pos)
|
||||
return (pos==JKQTPCADMcomplete) || (pos==JKQTPCADMTicksTickLabelsAxisLabel) || (pos==JKQTPCADMTickLabelsAxisLabel);
|
||||
}
|
||||
|
||||
QString JKQTPColorDerivationMode2String(JKQTPColorDerivationMode mode)
|
||||
|
||||
JKQTPColorDerivationMode::JKQTPColorDerivationMode(PredefinedModes mode):
|
||||
colorModification(ColorChangeMode::SameColor),
|
||||
targetColor("black"),
|
||||
colorModificationStrength(200),
|
||||
transparencyModification(TransparencyChangeMode::SameTransparency),
|
||||
targetTransparency(0.5),
|
||||
transparencyModficationStrength(0.66)
|
||||
{
|
||||
switch(mode) {
|
||||
case JKQTPFFCMFullyTransparentColor: return "transparent";
|
||||
case JKQTPFFCMBlack: return "black";
|
||||
case JKQTPFFCMWhite: return "white";
|
||||
case JKQTPFFCMGrey25: return "grey25";
|
||||
case JKQTPFFCMGrey50: return "grey50";
|
||||
case JKQTPFFCMGrey75: return "grey75";
|
||||
case JKQTPFFCMBlackTransparent: return "black_transparent";
|
||||
case JKQTPFFCMWhiteTransparent: return "white_transparent";
|
||||
case JKQTPFFCMGrey25Transparent: return "grey25_transparent";
|
||||
case JKQTPFFCMGrey50Transparent: return "grey50_transparent";
|
||||
case JKQTPFFCMGrey75Transparent: return "grey75_transparent";
|
||||
case JKQTPFFCMSameColor: return "same";
|
||||
case JKQTPFFCMInvertedColor: return "inverted";
|
||||
case JKQTPFFCMInvertedTransparentColor: return "inverted_transparent";
|
||||
case JKQTPFFCMInvertedNonTransparentColor: return "inverted_non_transparent";
|
||||
case JKQTPFFCMLighterColor: return "lighter";
|
||||
case JKQTPFFCMEvenLighterColor: return "even_lighter";
|
||||
case JKQTPFFCMDarkerColor: return "darker";
|
||||
case JKQTPFFCMEvenDarkerColor: return "even_darker";
|
||||
case JKQTPFFCMLighterAndTransparentColor: return "lighter_transparent";
|
||||
case JKQTPFFCMEvenLighterAndTransparentColor: return "even_lighter_transparent";
|
||||
case JKQTPFFCMDarkerAndTransparentColor: return "darker_transparent";
|
||||
case JKQTPFFCMEvenDarkerAndTransparentColor: return "even_darker_transparent";
|
||||
case JKQTPFFCMLighterAndNonTransparentColor: return "lighter_non_transparent";
|
||||
case JKQTPFFCMEvenLighterAndNonTransparentColor: return "even_lighter_non_transparent";
|
||||
case JKQTPFFCMDarkerAndNonTransparentColor: return "darker_non_transparent";
|
||||
case JKQTPFFCMEvenDarkerAndNonTransparentColor: return "even_darker_non_transparent";
|
||||
case JKQTPFFCMSameMoreTransparentColor: return "same_more_transparent";
|
||||
case JKQTPFFCMSameEvenMoreTransparentColor: return "same_even_more_transparent";
|
||||
case JKQTPFFCMSameLessTransparentColor: return "same_less_transparent";
|
||||
case JKQTPFFCMSameEvenLessTransparentColor: return "same_even_less_transparent";
|
||||
case JKQTPFFCMSameNonTransparentColor: return "same_non_transparent";
|
||||
case JKQTPFFCMFullyTransparentColor:
|
||||
targetColor=QColor(Qt::transparent);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMBlack:
|
||||
targetColor=QColor(Qt::black);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMWhite:
|
||||
targetColor=QColor(Qt::white);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey25:
|
||||
targetColor=QColor(64,64,64);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey50:
|
||||
targetColor=QColor(127,127,127);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey75:
|
||||
targetColor=QColor(191,191,191);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMBlackTransparent:
|
||||
targetColor=QColor(0,0,0,175);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMWhiteTransparent:
|
||||
targetColor=QColor(255,255,255,175);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey25Transparent:
|
||||
targetColor=QColor(64,64,64,175);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey50Transparent:
|
||||
targetColor=QColor(127,127,127,175);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMGrey75Transparent:
|
||||
targetColor=QColor(191,191,191,175);
|
||||
colorModification=ColorChangeMode::ReplaceColorAndTransparency;
|
||||
break;
|
||||
case JKQTPFFCMSameColor:
|
||||
break;
|
||||
case JKQTPFFCMSameNonTransparentColor:
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
case JKQTPFFCMSameMoreTransparentColor:
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMSameEvenMoreTransparentColor:
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.66;
|
||||
break;
|
||||
case JKQTPFFCMSameLessTransparentColor:
|
||||
transparencyModification=TransparencyChangeMode::LessTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMSameEvenLessTransparentColor:
|
||||
transparencyModification=TransparencyChangeMode::LessTransparent;
|
||||
transparencyModficationStrength=0.66;
|
||||
|
||||
case JKQTPFFCMInvertedColor:
|
||||
colorModification=ColorChangeMode::InvertColor;
|
||||
break;
|
||||
case JKQTPFFCMInvertedTransparentColor:
|
||||
colorModification=ColorChangeMode::InvertColor;
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMInvertedNonTransparentColor:
|
||||
colorModification=ColorChangeMode::InvertColor;
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
|
||||
case JKQTPFFCMLighterColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=150;
|
||||
break;
|
||||
case JKQTPFFCMLighterAndTransparentColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=150;
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMLighterAndNonTransparentColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=150;
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
|
||||
case JKQTPFFCMEvenLighterColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=200;
|
||||
break;
|
||||
case JKQTPFFCMEvenLighterAndTransparentColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=200;
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMEvenLighterAndNonTransparentColor:
|
||||
colorModification=ColorChangeMode::LighterColor;
|
||||
colorModificationStrength=200;
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
|
||||
|
||||
case JKQTPFFCMDarkerColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=200;
|
||||
break;
|
||||
case JKQTPFFCMDarkerAndTransparentColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=200;
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMDarkerAndNonTransparentColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=200;
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
|
||||
case JKQTPFFCMEvenDarkerColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=300;
|
||||
break;
|
||||
case JKQTPFFCMEvenDarkerAndTransparentColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=300;
|
||||
transparencyModification=TransparencyChangeMode::MoreTransparent;
|
||||
transparencyModficationStrength=0.33;
|
||||
break;
|
||||
case JKQTPFFCMEvenDarkerAndNonTransparentColor:
|
||||
colorModification=ColorChangeMode::DarkerColor;
|
||||
colorModificationStrength=300;
|
||||
transparencyModification=TransparencyChangeMode::ReplaceTransparency;
|
||||
targetTransparency=0.0;
|
||||
break;
|
||||
}
|
||||
return "same";
|
||||
}
|
||||
|
||||
JKQTPColorDerivationMode::JKQTPColorDerivationMode(const QString &mode):
|
||||
JKQTPColorDerivationMode()
|
||||
{
|
||||
*this=fromString(mode);
|
||||
}
|
||||
|
||||
QString JKQTPColorDerivationMode::toString() const
|
||||
{
|
||||
// some shortcut strings
|
||||
if (*this == JKQTPFFCMFullyTransparentColor) return "transparent";
|
||||
if (*this == JKQTPFFCMSameColor) return "same";
|
||||
if (*this == JKQTPFFCMInvertedColor) return "inverted";
|
||||
if (*this == JKQTPFFCMWhite) return "white";
|
||||
if (*this == JKQTPFFCMSameNonTransparentColor) return "same_non_transparent";
|
||||
if (*this == JKQTPFFCMLighterColor) return "lighter";
|
||||
if (*this == JKQTPFFCMDarkerColor) return "darker";
|
||||
if (*this == JKQTPFFCMLighterAndTransparentColor) return "lighter_transparent";
|
||||
if (*this == JKQTPFFCMDarkerAndTransparentColor) return "darker_transparent";
|
||||
|
||||
QString name;
|
||||
switch (colorModification) {
|
||||
case ColorChangeMode::SameColor:
|
||||
name="same_color";
|
||||
break;
|
||||
case ColorChangeMode::ReplaceColorNotTransparency:
|
||||
name="replace_color_not_transparency("+jkqtp_QColor2String(targetColor)+")";
|
||||
break;
|
||||
case ColorChangeMode::ReplaceColorAndTransparency:
|
||||
name="replace_color_and_transparency("+jkqtp_QColor2String(targetColor)+")";
|
||||
break;
|
||||
case ColorChangeMode::DarkerColor:
|
||||
name="darker_color("+QString::number(colorModificationStrength)+")";
|
||||
break;
|
||||
case ColorChangeMode::LighterColor:
|
||||
name="lighter_color("+QString::number(colorModificationStrength)+")";
|
||||
break;
|
||||
case ColorChangeMode::InvertColor:
|
||||
name="inverted_color";
|
||||
break;
|
||||
}
|
||||
|
||||
// alpha=0: transparent, alpha=1: ppaque
|
||||
switch (transparencyModification) {
|
||||
case TransparencyChangeMode::SameTransparency:
|
||||
break;
|
||||
case TransparencyChangeMode::ReplaceTransparency:
|
||||
name+=",transparency("+QString::number(targetTransparency*100,'f',1)+")";
|
||||
break;
|
||||
case TransparencyChangeMode::MoreTransparent:
|
||||
name+=",more_transparent("+QString::number(transparencyModficationStrength,'f',3)+")";
|
||||
break;
|
||||
case TransparencyChangeMode::LessTransparent:
|
||||
name+=",less_transparent("+QString::number(transparencyModficationStrength,'f',3)+")";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
JKQTPColorDerivationMode JKQTPColorDerivationMode::fromString(const QString &mode)
|
||||
{
|
||||
const QString m=mode.trimmed().toLower();
|
||||
|
||||
// legacy strings
|
||||
if (m=="transparent" || m=="no_color" || m=="none") return JKQTPColorDerivationMode(JKQTPFFCMFullyTransparentColor);
|
||||
if (m=="same"||m=="same_color") return JKQTPColorDerivationMode(JKQTPFFCMSameColor);
|
||||
if (m=="black") return JKQTPColorDerivationMode(JKQTPFFCMBlack);
|
||||
if (m=="white") return JKQTPColorDerivationMode(JKQTPFFCMWhite);
|
||||
if (m=="grey25") return JKQTPColorDerivationMode(JKQTPFFCMGrey25);
|
||||
if (m=="grey50") return JKQTPColorDerivationMode(JKQTPFFCMGrey50);
|
||||
if (m=="grey75") return JKQTPColorDerivationMode(JKQTPFFCMGrey75);
|
||||
if (m=="transparent_black" || m=="black_transparent") return JKQTPColorDerivationMode(JKQTPFFCMBlackTransparent);
|
||||
if (m=="transparent_white" || m=="white_transparent") return JKQTPColorDerivationMode(JKQTPFFCMWhiteTransparent);
|
||||
if (m=="transparent_grey25" || m=="grey25_transparent") return JKQTPColorDerivationMode(JKQTPFFCMGrey25Transparent);
|
||||
if (m=="transparent_grey50" || m=="grey50_transparent") return JKQTPColorDerivationMode(JKQTPFFCMGrey50Transparent);
|
||||
if (m=="transparent_grey75" || m=="grey75_transparent") return JKQTPColorDerivationMode(JKQTPFFCMGrey75Transparent);
|
||||
if (m=="inverted") return JKQTPColorDerivationMode(JKQTPFFCMInvertedColor);
|
||||
if (m=="transparent_inverted" || m=="inverted_transparent") return JKQTPColorDerivationMode(JKQTPFFCMInvertedTransparentColor);
|
||||
if (m=="non_transparent_inverted" || m=="inverted_non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMInvertedNonTransparentColor);
|
||||
if (m=="lighter") return JKQTPColorDerivationMode(JKQTPFFCMLighterColor);
|
||||
if (m=="even_lighter") return JKQTPColorDerivationMode(JKQTPFFCMEvenLighterColor);
|
||||
if (m=="darker") return JKQTPColorDerivationMode(JKQTPFFCMDarkerColor);
|
||||
if (m=="even_darker") return JKQTPColorDerivationMode(JKQTPFFCMEvenDarkerColor);
|
||||
if (m=="lighter_transparent"||m=="lighter_and_transparent") return JKQTPColorDerivationMode(JKQTPFFCMLighterAndTransparentColor);
|
||||
if (m=="even_lighter_transparent"||m=="even_lighter_and_transparent") return JKQTPColorDerivationMode(JKQTPFFCMEvenLighterAndTransparentColor);
|
||||
if (m=="darker_transparent"||m=="darker_and_transparent") return JKQTPColorDerivationMode(JKQTPFFCMDarkerAndTransparentColor);
|
||||
if (m=="even_darker_transparent"||m=="even_darker_and_transparent") return JKQTPColorDerivationMode(JKQTPFFCMEvenDarkerAndTransparentColor);
|
||||
if (m=="lighter_non_transparent"||m=="lighter_and_non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMLighterAndNonTransparentColor);
|
||||
if (m=="even_lighter_non_transparent"||m=="even_lighter_and_non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMEvenLighterAndNonTransparentColor);
|
||||
if (m=="darker_non_transparent"||m=="darker_and_non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMDarkerAndNonTransparentColor);
|
||||
if (m=="even_darker_non_transparent"||m=="even_darker_and_non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMEvenDarkerAndNonTransparentColor);
|
||||
if (m=="same_more_transparent"||m=="more_transparent") return JKQTPColorDerivationMode(JKQTPFFCMSameMoreTransparentColor);
|
||||
if (m=="same_even_more_transparent"||m=="even_more_transparent") return JKQTPColorDerivationMode(JKQTPFFCMSameEvenMoreTransparentColor);
|
||||
if (m=="same_less_transparent"||m=="less_transparent") return JKQTPColorDerivationMode(JKQTPFFCMSameLessTransparentColor);
|
||||
if (m=="same_even_less_transparent"||m=="even_less_transparent") return JKQTPColorDerivationMode(JKQTPFFCMSameEvenLessTransparentColor);
|
||||
if (m=="same_non_transparent" || m=="non_transparent") return JKQTPColorDerivationMode(JKQTPFFCMSameNonTransparentColor);
|
||||
|
||||
// cleanly analyze string
|
||||
|
||||
|
||||
return JKQTPColorDerivationMode();
|
||||
}
|
||||
|
||||
QColor JKQTPColorDerivationMode::apply(const QColor& basecolor) const
|
||||
{
|
||||
QColor c=basecolor;
|
||||
switch (colorModification) {
|
||||
case ColorChangeMode::SameColor:
|
||||
c=basecolor;
|
||||
break;
|
||||
case ColorChangeMode::ReplaceColorNotTransparency:
|
||||
c=targetColor;
|
||||
c.setAlphaF(basecolor.alphaF());
|
||||
break;
|
||||
case ColorChangeMode::ReplaceColorAndTransparency:
|
||||
c=targetColor;
|
||||
break;
|
||||
case ColorChangeMode::DarkerColor:
|
||||
c=c.darker(static_cast<int>(colorModificationStrength));
|
||||
break;
|
||||
case ColorChangeMode::LighterColor:
|
||||
c=c.lighter(static_cast<int>(colorModificationStrength));
|
||||
break;
|
||||
case ColorChangeMode::InvertColor:
|
||||
c=QColor(255-c.red(), 255-c.green(), 255-c.blue(), c.alpha());
|
||||
break;
|
||||
}
|
||||
|
||||
// alpha=0: transparent, alpha=1: ppaque
|
||||
switch (transparencyModification) {
|
||||
case TransparencyChangeMode::SameTransparency:
|
||||
c.setAlphaF(c.alphaF());
|
||||
break;
|
||||
case TransparencyChangeMode::ReplaceTransparency:
|
||||
c.setAlphaF(1.0-targetTransparency);
|
||||
break;
|
||||
case TransparencyChangeMode::MoreTransparent:
|
||||
c.setAlphaF(c.alphaF()-transparencyModficationStrength*c.alphaF());
|
||||
break;
|
||||
case TransparencyChangeMode::LessTransparent:
|
||||
c.setAlphaF(c.alphaF()+(1.0-c.alphaF())*transparencyModficationStrength);
|
||||
break;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
bool JKQTPColorDerivationMode::operator==(const JKQTPColorDerivationMode &other) const
|
||||
{
|
||||
if (colorModification!=other.colorModification) return false;
|
||||
else {
|
||||
if (colorModification==ColorChangeMode::ReplaceColorNotTransparency || colorModification==ColorChangeMode::ReplaceColorAndTransparency) {
|
||||
if (targetColor!=other.targetColor) return false;
|
||||
} else if (colorModification==ColorChangeMode::DarkerColor || colorModification==ColorChangeMode::LighterColor) {
|
||||
if (colorModificationStrength!=other.colorModificationStrength) return false;
|
||||
}
|
||||
}
|
||||
if (transparencyModification!=other.transparencyModification) return false;
|
||||
else {
|
||||
if (transparencyModification==TransparencyChangeMode::ReplaceTransparency) {
|
||||
if (targetTransparency!=other.targetTransparency) return false;
|
||||
} else if (transparencyModification==TransparencyChangeMode::MoreTransparent || transparencyModification==TransparencyChangeMode::LessTransparent) {
|
||||
if (transparencyModficationStrength!=other.transparencyModficationStrength) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JKQTPColorDerivationMode::operator==(const JKQTPColorDerivationMode::PredefinedModes &other) const
|
||||
{
|
||||
return operator==(JKQTPColorDerivationMode(other));
|
||||
}
|
||||
|
||||
|
||||
QString JKQTPColorDerivationMode2String(JKQTPColorDerivationMode mode)
|
||||
{
|
||||
return mode.toString();
|
||||
}
|
||||
|
||||
JKQTPColorDerivationMode String2JKQTPColorDerivationMode(const QString &mode)
|
||||
{
|
||||
const QString m=mode.trimmed().toLower();
|
||||
if (m=="transparent" || m=="no_color" || m=="none") return JKQTPFFCMFullyTransparentColor;
|
||||
if (m=="same"||m=="same_color") return JKQTPFFCMSameColor;
|
||||
if (m=="black") return JKQTPFFCMBlack;
|
||||
if (m=="white") return JKQTPFFCMWhite;
|
||||
if (m=="grey25") return JKQTPFFCMGrey25;
|
||||
if (m=="grey50") return JKQTPFFCMGrey50;
|
||||
if (m=="grey75") return JKQTPFFCMGrey75;
|
||||
if (m=="transparent_black" || m=="black_transparent") return JKQTPFFCMBlackTransparent;
|
||||
if (m=="transparent_white" || m=="white_transparent") return JKQTPFFCMWhiteTransparent;
|
||||
if (m=="transparent_grey25" || m=="grey25_transparent") return JKQTPFFCMGrey25Transparent;
|
||||
if (m=="transparent_grey50" || m=="grey50_transparent") return JKQTPFFCMGrey50Transparent;
|
||||
if (m=="transparent_grey75" || m=="grey75_transparent") return JKQTPFFCMGrey75Transparent;
|
||||
if (m=="inverted") return JKQTPFFCMInvertedColor;
|
||||
if (m=="transparent_inverted" || m=="inverted_transparent") return JKQTPFFCMInvertedTransparentColor;
|
||||
if (m=="non_transparent_inverted" || m=="inverted_non_transparent") return JKQTPFFCMInvertedNonTransparentColor;
|
||||
if (m=="lighter") return JKQTPFFCMLighterColor;
|
||||
if (m=="even_lighter") return JKQTPFFCMEvenLighterColor;
|
||||
if (m=="darker") return JKQTPFFCMDarkerColor;
|
||||
if (m=="even_darker") return JKQTPFFCMEvenDarkerColor;
|
||||
if (m=="lighter_transparent"||m=="lighter_and_transparent") return JKQTPFFCMLighterAndTransparentColor;
|
||||
if (m=="even_lighter_transparent"||m=="even_lighter_and_transparent") return JKQTPFFCMEvenLighterAndTransparentColor;
|
||||
if (m=="darker_transparent"||m=="darker_and_transparent") return JKQTPFFCMDarkerAndTransparentColor;
|
||||
if (m=="even_darker_transparent"||m=="even_darker_and_transparent") return JKQTPFFCMEvenDarkerAndTransparentColor;
|
||||
if (m=="lighter_non_transparent"||m=="lighter_and_non_transparent") return JKQTPFFCMLighterAndNonTransparentColor;
|
||||
if (m=="even_lighter_non_transparent"||m=="even_lighter_and_non_transparent") return JKQTPFFCMEvenLighterAndNonTransparentColor;
|
||||
if (m=="darker_non_transparent"||m=="darker_and_non_transparent") return JKQTPFFCMDarkerAndNonTransparentColor;
|
||||
if (m=="even_darker_non_transparent"||m=="even_darker_and_non_transparent") return JKQTPFFCMEvenDarkerAndNonTransparentColor;
|
||||
if (m=="same_more_transparent"||m=="more_transparent") return JKQTPFFCMSameMoreTransparentColor;
|
||||
if (m=="same_even_more_transparent"||m=="even_more_transparent") return JKQTPFFCMSameEvenMoreTransparentColor;
|
||||
if (m=="same_less_transparent"||m=="less_transparent") return JKQTPFFCMSameLessTransparentColor;
|
||||
if (m=="same_even_less_transparent"||m=="even_less_transparent") return JKQTPFFCMSameEvenLessTransparentColor;
|
||||
if (m=="same_non_transparent" || m=="non_transparent") return JKQTPFFCMSameNonTransparentColor;
|
||||
return JKQTPFFCMSameColor;
|
||||
return JKQTPColorDerivationMode::fromString(mode);
|
||||
}
|
||||
|
||||
QColor JKQTPGetDerivedColor(JKQTPColorDerivationMode mode, const QColor &basecolor)
|
||||
{
|
||||
switch(mode) {
|
||||
case JKQTPFFCMFullyTransparentColor: return QColor(Qt::transparent);
|
||||
case JKQTPFFCMBlack: return QColor(Qt::black);
|
||||
case JKQTPFFCMWhite: return QColor(Qt::white);
|
||||
case JKQTPFFCMGrey25: return QColor(64,64,64);
|
||||
case JKQTPFFCMGrey50: return QColor(127,127,127);
|
||||
case JKQTPFFCMGrey75: return QColor(191,191,191);
|
||||
case JKQTPFFCMBlackTransparent: return QColor(0,0,0,175);
|
||||
case JKQTPFFCMWhiteTransparent: return QColor(255,255,255,175);
|
||||
case JKQTPFFCMGrey25Transparent: return QColor(64,64,64,175);
|
||||
case JKQTPFFCMGrey50Transparent: return QColor(127,127,127,175);
|
||||
case JKQTPFFCMGrey75Transparent: return QColor(191,191,191,175);
|
||||
case JKQTPFFCMSameColor:
|
||||
case JKQTPFFCMSameNonTransparentColor: {
|
||||
QColor c=basecolor;
|
||||
if (mode==JKQTPFFCMSameNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMSameMoreTransparentColor: { QColor c=basecolor; c.setAlphaF(0.66*c.alphaF()); return c; }
|
||||
case JKQTPFFCMSameEvenMoreTransparentColor: { QColor c=basecolor; c.setAlphaF(0.33*c.alphaF()); return c; }
|
||||
case JKQTPFFCMSameLessTransparentColor: { QColor c=basecolor; c.setAlphaF(c.alphaF()+(1.0-c.alphaF())*0.33); return c; }
|
||||
case JKQTPFFCMSameEvenLessTransparentColor: { QColor c=basecolor; c.setAlphaF(c.alphaF()+(1.0-c.alphaF())*0.66); return c; }
|
||||
case JKQTPFFCMInvertedColor:
|
||||
case JKQTPFFCMInvertedTransparentColor:
|
||||
case JKQTPFFCMInvertedNonTransparentColor: {
|
||||
QColor c(255-basecolor.red(), 255-basecolor.green(), 255-basecolor.blue(), basecolor.alpha());
|
||||
if (mode==JKQTPFFCMInvertedTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
if (mode==JKQTPFFCMInvertedNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMLighterColor:
|
||||
case JKQTPFFCMLighterAndTransparentColor:
|
||||
case JKQTPFFCMLighterAndNonTransparentColor: {
|
||||
QColor c=basecolor.lighter();
|
||||
if (basecolor==QColor("black")) c=QColor(64,64,64);
|
||||
if (mode==JKQTPFFCMLighterAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
if (mode==JKQTPFFCMLighterAndNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMEvenLighterColor:
|
||||
case JKQTPFFCMEvenLighterAndTransparentColor:
|
||||
case JKQTPFFCMEvenLighterAndNonTransparentColor: {
|
||||
QColor c=basecolor.lighter().lighter();
|
||||
if (basecolor==QColor("black")) c=QColor(127,127,127);
|
||||
if (mode==JKQTPFFCMEvenLighterAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
if (mode==JKQTPFFCMEvenLighterAndNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMDarkerColor:
|
||||
case JKQTPFFCMDarkerAndTransparentColor:
|
||||
case JKQTPFFCMDarkerAndNonTransparentColor: {
|
||||
QColor c=basecolor.darker();
|
||||
if (basecolor==QColor("white")) c= QColor(191,191,191);
|
||||
if (mode==JKQTPFFCMDarkerAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
if (mode==JKQTPFFCMDarkerAndNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
case JKQTPFFCMEvenDarkerColor:
|
||||
case JKQTPFFCMEvenDarkerAndTransparentColor:
|
||||
case JKQTPFFCMEvenDarkerAndNonTransparentColor: {
|
||||
QColor c=basecolor.darker().darker();
|
||||
if (basecolor==QColor("white")) c= QColor(127,127,127);
|
||||
if (mode==JKQTPFFCMEvenDarkerAndTransparentColor) c.setAlphaF(0.66*c.alphaF());
|
||||
if (mode==JKQTPFFCMEvenDarkerAndNonTransparentColor) c.setAlphaF(1.0);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return basecolor;
|
||||
return mode.apply(basecolor);
|
||||
}
|
||||
|
||||
QString JKQTPUserActionMarkerType2String(JKQTPUserActionMarkerType act)
|
||||
|
@ -251,40 +251,92 @@ typedef JKQTPMouseMoveActionsHashMap::const_iterator JKQTPMouseMoveActionsHashMa
|
||||
* \ingroup jkqtpplotter_styling
|
||||
|
||||
*/
|
||||
enum JKQTPColorDerivationMode {
|
||||
JKQTPFFCMFullyTransparentColor, /*!< \brief fully transparent color */
|
||||
JKQTPFFCMNoColor=JKQTPFFCMFullyTransparentColor, /*!< \brief fully transparent color */
|
||||
JKQTPFFCMBlack, /*!< \brief fill with black */
|
||||
JKQTPFFCMGrey75, /*!< \brief fill with 75% grey */
|
||||
JKQTPFFCMGrey50, /*!< \brief fill with 50% grey */
|
||||
JKQTPFFCMGrey25, /*!< \brief fill with 25% grey */
|
||||
JKQTPFFCMWhite, /*!< \brief fill with white */
|
||||
JKQTPFFCMBlackTransparent, /*!< \brief fill with black, slightly transparent */
|
||||
JKQTPFFCMGrey75Transparent, /*!< \brief fill with 75% grey, slightly transparent */
|
||||
JKQTPFFCMGrey50Transparent, /*!< \brief fill with 50% grey, slightly transparent */
|
||||
JKQTPFFCMGrey25Transparent, /*!< \brief fill with 25% grey, slightly transparent */
|
||||
JKQTPFFCMWhiteTransparent, /*!< \brief fill with white, slightly transparent */
|
||||
JKQTPFFCMSameColor, /*!< \brief fill with the same color */
|
||||
JKQTPFFCMSameNonTransparentColor, /*!< \brief fill with the same color, but remove any transparency (if any) */
|
||||
JKQTPFFCMSameMoreTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
JKQTPFFCMSameEvenMoreTransparentColor, /*!< \brief fill with the a more transparent color than JKQTPFFCMMoreTransparentColor */
|
||||
JKQTPFFCMSameLessTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
JKQTPFFCMSameEvenLessTransparentColor, /*!< \brief fill with the a more transparent color than JKQTPFFCMLessTransparentColor*/
|
||||
JKQTPFFCMInvertedColor, /*!< \brief fill with the inverted color */
|
||||
JKQTPFFCMInvertedTransparentColor, /*!< \brief fill with the inverted color, slightly transparent */
|
||||
JKQTPFFCMInvertedNonTransparentColor, /*!< \brief fill with the inverted color, non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMLighterColor, /*!< \brief fill with the a lighter color */
|
||||
JKQTPFFCMEvenLighterColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor */
|
||||
JKQTPFFCMDarkerColor, /*!< \brief fill with the a darker color */
|
||||
JKQTPFFCMEvenDarkerColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor */
|
||||
JKQTPFFCMLighterAndTransparentColor, /*!< \brief fill with the a lighter color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenLighterAndTransparentColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMDarkerAndTransparentColor, /*!< \brief fill with the a darker color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenDarkerAndTransparentColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMLighterAndNonTransparentColor, /*!< \brief fill with the a lighter color, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMEvenLighterAndNonTransparentColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMDarkerAndNonTransparentColor, /*!< \brief fill with the a darker color, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMEvenDarkerAndNonTransparentColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is non-transparent (even if the basecolor had some transparency) */
|
||||
struct JKQTPLOTTER_LIB_EXPORT JKQTPColorDerivationMode {
|
||||
public:
|
||||
enum PredefinedModes {
|
||||
JKQTPFFCMFullyTransparentColor, /*!< \brief fully transparent color */
|
||||
JKQTPFFCMNoColor=JKQTPFFCMFullyTransparentColor, /*!< \brief fully transparent color */
|
||||
JKQTPFFCMBlack, /*!< \brief fill with black */
|
||||
JKQTPFFCMGrey75, /*!< \brief fill with 75% grey */
|
||||
JKQTPFFCMGrey50, /*!< \brief fill with 50% grey */
|
||||
JKQTPFFCMGrey25, /*!< \brief fill with 25% grey */
|
||||
JKQTPFFCMWhite, /*!< \brief fill with white */
|
||||
JKQTPFFCMBlackTransparent, /*!< \brief fill with black, slightly transparent */
|
||||
JKQTPFFCMGrey75Transparent, /*!< \brief fill with 75% grey, slightly transparent */
|
||||
JKQTPFFCMGrey50Transparent, /*!< \brief fill with 50% grey, slightly transparent */
|
||||
JKQTPFFCMGrey25Transparent, /*!< \brief fill with 25% grey, slightly transparent */
|
||||
JKQTPFFCMWhiteTransparent, /*!< \brief fill with white, slightly transparent */
|
||||
JKQTPFFCMSameColor, /*!< \brief fill with the same color */
|
||||
JKQTPFFCMSameNonTransparentColor, /*!< \brief fill with the same color, but remove any transparency (if any) */
|
||||
JKQTPFFCMSameMoreTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
JKQTPFFCMSameEvenMoreTransparentColor, /*!< \brief fill with the a more transparent color than JKQTPFFCMMoreTransparentColor */
|
||||
JKQTPFFCMSameLessTransparentColor, /*!< \brief fill with the a partly transparent color */
|
||||
JKQTPFFCMSameEvenLessTransparentColor, /*!< \brief fill with the a more transparent color than JKQTPFFCMLessTransparentColor*/
|
||||
JKQTPFFCMInvertedColor, /*!< \brief fill with the inverted color */
|
||||
JKQTPFFCMInvertedTransparentColor, /*!< \brief fill with the inverted color, slightly transparent */
|
||||
JKQTPFFCMInvertedNonTransparentColor, /*!< \brief fill with the inverted color, non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMLighterColor, /*!< \brief fill with the a lighter color */
|
||||
JKQTPFFCMEvenLighterColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor */
|
||||
JKQTPFFCMDarkerColor, /*!< \brief fill with the a darker color */
|
||||
JKQTPFFCMEvenDarkerColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor */
|
||||
JKQTPFFCMLighterAndTransparentColor, /*!< \brief fill with the a lighter color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenLighterAndTransparentColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMDarkerAndTransparentColor, /*!< \brief fill with the a darker color, that is in addition a bit transparent */
|
||||
JKQTPFFCMEvenDarkerAndTransparentColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is in addition a bit transparent */
|
||||
JKQTPFFCMLighterAndNonTransparentColor, /*!< \brief fill with the a lighter color, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMEvenLighterAndNonTransparentColor, /*!< \brief fill with the an even lighter color than JKQTPFFCMLighterColor, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMDarkerAndNonTransparentColor, /*!< \brief fill with the a darker color, that is non-transparent (even if the basecolor had some transparency) */
|
||||
JKQTPFFCMEvenDarkerAndNonTransparentColor, /*!< \brief fill with the an even darker color than JKQTPFFCMDarkerColor, that is non-transparent (even if the basecolor had some transparency) */
|
||||
|
||||
JKQTPFFCMmax=JKQTPFFCMEvenDarkerAndNonTransparentColor
|
||||
};
|
||||
/** \brief for compatibility: use one of several predefined settings to iitialize object */
|
||||
JKQTPColorDerivationMode(PredefinedModes mode=JKQTPFFCMSameColor);
|
||||
/** \brief initialize object from a string (calls fromString() ) */
|
||||
JKQTPColorDerivationMode(const QString& mode);
|
||||
|
||||
enum ColorChangeMode {
|
||||
SameColor,
|
||||
ReplaceColorAndTransparency,
|
||||
ReplaceColorNotTransparency,
|
||||
DarkerColor,
|
||||
LighterColor,
|
||||
InvertColor
|
||||
};
|
||||
/** \brif specifies how the color should change */
|
||||
ColorChangeMode colorModification;
|
||||
/** \brief replacement color when colorModification==ColorChangeMode::ReplaceColor */
|
||||
QColor targetColor;
|
||||
/** \brief strength of colorModification-settings, such as ColorChangeMode::DarkerColor or ColorChangeMode::LighterColor */
|
||||
float colorModificationStrength;
|
||||
|
||||
enum TransparencyChangeMode {
|
||||
SameTransparency,
|
||||
ReplaceTransparency,
|
||||
MoreTransparent,
|
||||
LessTransparent
|
||||
};
|
||||
|
||||
/** \brief specifies how the transparency of the color chould change */
|
||||
TransparencyChangeMode transparencyModification;
|
||||
/** \brief target transparency (0:non-transparennt .. 1:fully-transparent, i.e. 1-alphaF!!!) for TransparencyChangeMode::ReplaceTransparency */
|
||||
float targetTransparency;
|
||||
/** \brief strength of transparencyModification-settings, such as TransparencyChangeMode::MoreTransparent or TransparencyChangeMode::LessTransparent */
|
||||
float transparencyModficationStrength;
|
||||
|
||||
/** \brief convert object contents into a string */
|
||||
QString toString() const;
|
||||
/** \brief read values from a string */
|
||||
static JKQTPColorDerivationMode fromString(const QString& mode);
|
||||
/** \brief apply the modifications encoded in this object to a given color */
|
||||
QColor apply(const QColor& basecolor) const;
|
||||
|
||||
/** \brief compares two objects for equality */
|
||||
bool operator==(const JKQTPColorDerivationMode& other) const;
|
||||
|
||||
/** \brief determines whether the current object equals a default-initialized object with the given parameter, i.e. this is equivalent to calling \code operato==(JKQTPColorDerivationMode(other)) \endcode */
|
||||
bool operator==(const PredefinedModes& other) const;
|
||||
|
||||
};
|
||||
|
||||
/** \brief use a JKQTPColorDerivationMode to derive a color from \a col as specified
|
||||
@ -343,7 +395,9 @@ enum JKQTPCADrawMode {
|
||||
JKQTPCADMTickLabelsAxisLabel, /*!< \brief draw axis tick labels and axisLabel */
|
||||
JKQTPCADMTickLabels, /*!< \brief draw axis tick labels */
|
||||
JKQTPCADMTicks, /*!< \brief draw axis with ticks */
|
||||
JKQTPCADMnone /*!< \brief draw no axis */
|
||||
JKQTPCADMnone, /*!< \brief draw no axis */
|
||||
|
||||
JKQTPCADMmax=JKQTPCADMnone
|
||||
};
|
||||
|
||||
/** \brief determines whether JKQTPCADrawMode has the line
|
||||
@ -388,6 +442,8 @@ enum JKQTPCALabelType {
|
||||
JKQTPCALTdate, /*!< \brief show numbers as dates \image html JKQTPCALTdate.png */
|
||||
JKQTPCALTtime, /*!< \brief show numbers as times \image html JKQTPCALTtime.png*/
|
||||
JKQTPCALTdatetime, /*!< \brief show numbers as times */
|
||||
|
||||
JKQTPCALTmax=JKQTPCALTdatetime
|
||||
};
|
||||
|
||||
|
||||
@ -398,6 +454,8 @@ enum JKQTPLabelTickMode {
|
||||
JKQTPLTMLinOrPower=0, /*!< \brief linear, or log, depending on whether the axis is log */
|
||||
JKQTPLTMLin, /*!< \brief always linear (even for log-axes) */
|
||||
JKQTPLTMPower, /*!< \brief powers (of the log-base) */
|
||||
|
||||
JKQTPLTMmax=JKQTPLTMPower
|
||||
};
|
||||
|
||||
/** \brief converts a JKQTPLabelTickMode variable into a human-readable string
|
||||
@ -427,7 +485,8 @@ JKQTPLOTTER_LIB_EXPORT JKQTPCALabelType String2JKQTPCALabelType(const QString& p
|
||||
enum JKQTPLabelPosition {
|
||||
JKQTPLabelMin=0, /*!< \brief the axis label is near the min value of the axis (left/bottom) */
|
||||
JKQTPLabelMax, /*!< \brief the axis label is near the max value of the axis (right/top) */
|
||||
JKQTPLabelCenter /*!< \brief the label is at the center of the axis */
|
||||
JKQTPLabelCenter, /*!< \brief the label is at the center of the axis */
|
||||
JKQTPLabelPositionMax=JKQTPLabelCenter
|
||||
};
|
||||
|
||||
|
||||
@ -456,7 +515,9 @@ enum JKQTPKeyPosition {
|
||||
JKQTPKeyInsideTopRight, /*!< \brief the key is positioned inside on the right side of the graph, but inside the graph*/
|
||||
JKQTPKeyInsideTopLeft, /*!< \brief the key is positioned inside on the left side of the graph */
|
||||
JKQTPKeyInsideBottomLeft, /*!< \brief the key is positioned inside on the upper bound of the graph */
|
||||
JKQTPKeyInsideBottomRight /*!< \brief the key is positioned inside on the lower bound of the graph */
|
||||
JKQTPKeyInsideBottomRight, /*!< \brief the key is positioned inside on the lower bound of the graph */
|
||||
|
||||
JKQTPKeyPositionMax=JKQTPKeyInsideBottomRight
|
||||
};
|
||||
|
||||
|
||||
@ -474,9 +535,11 @@ JKQTPLOTTER_LIB_EXPORT JKQTPKeyPosition String2JKQTPKeyPosition(const QString& p
|
||||
* \ingroup jkqtpplottersupprt
|
||||
*/
|
||||
enum JKQTPKeyLayout {
|
||||
JKQTPKeyLayoutOneColumn, /*!< \brief the key consists of one column */
|
||||
JKQTPKeyLayoutOneColumn=0, /*!< \brief the key consists of one column */
|
||||
JKQTPKeyLayoutOneRow, /*!< \brief the key consists of one row */
|
||||
JKQTPKeyLayoutMultiColumn, /*!< \brief the key consists of multiple columns */
|
||||
|
||||
JKQTPKeyLayoutMax=JKQTPKeyLayoutMultiColumn
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user