Merge pull request #12 from dtimson/master

Corrections in palette drawing
This commit is contained in:
Jan W. Krieger 2019-09-21 11:12:49 +01:00 committed by GitHub
commit 3aafc48d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View File

@ -121,7 +121,7 @@ There are several modification modes available (see also documentation of JKQTPM
- modify the SATURATION-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifySaturation`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifySaturation.png) - modify the SATURATION-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifySaturation`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifySaturation.png)
- modify the ALPHA/TRANSPARENCY-channel from the RGBA color space `JKQTPMathImageBase::ModifierMode::ModifyAlpha`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyAlpha.png) - modify the ALPHA/TRANSPARENCY-channel from the RGBA color space `JKQTPMathImageBase::ModifierMode::ModifyAlpha`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyAlpha.png)
- modify the LUMINANCE-channel from the HSL color space `JKQTPMathImageBase::ModifierMode::ModifyLuminance`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyLuminance.png) - modify the LUMINANCE-channel from the HSL color space `JKQTPMathImageBase::ModifierMode::ModifyLuminance`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyLuminance.png)
- modify the VALUE-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifyHue`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyHue.png) - modify the HUE-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifyHue`: <br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPMathImageBaseModifyHue.png)

View File

@ -1053,7 +1053,7 @@ enum class JKQTPMathImageModifierMode {
ModifyAlpha=3,/*!< modify the ALPHA/TRANSPARENCY-channel from the RGBA color space \image html JKQTPMathImageBaseModifyAlpha.png */ ModifyAlpha=3,/*!< modify the ALPHA/TRANSPARENCY-channel from the RGBA color space \image html JKQTPMathImageBaseModifyAlpha.png */
ModifyTransparency=ModifyAlpha,/*!< \see ModifyAlpha */ ModifyTransparency=ModifyAlpha,/*!< \see ModifyAlpha */
ModifyLuminance=4,/*!< modify the LUMINANCE-channel from the HSL color space \image html JKQTPMathImageBaseModifyLuminance.png */ ModifyLuminance=4,/*!< modify the LUMINANCE-channel from the HSL color space \image html JKQTPMathImageBaseModifyLuminance.png */
ModifyHue=5,/*!< modify the VALUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyHue.png */ ModifyHue=5,/*!< modify the HUE-channel from the HSV color space \image html JKQTPMathImageBaseModifyHue.png */
}; };
/** \brief convert a ModifierMode to a string /** \brief convert a ModifierMode to a string

View File

@ -1062,12 +1062,12 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou
void JKQTPColumnMathImage::setImageColumn(size_t __value) void JKQTPColumnMathImage::setImageColumn(size_t __value)
{ {
setImageColumn(static_cast<int>(__value)); setImageColumn(static_cast<int>(__value));
} }
void JKQTPColumnMathImage::setModifierColumn(size_t __value) void JKQTPColumnMathImage::setModifierColumn(size_t __value)
{ {
setImageColumn(static_cast<int>(__value)); setModifierColumn(static_cast<int>(__value));
} }
void JKQTPColumnMathImage::setImageColumn(int __value) void JKQTPColumnMathImage::setImageColumn(int __value)
{ {

View File

@ -615,25 +615,26 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
double internalModifierMin=0; double internalModifierMin=0;
double internalModifierMax=0; double internalModifierMax=0;
cbGetDataMinMax(internalDataMin, internalDataMax); cbGetDataMinMax(internalDataMin, internalDataMax);
cbGetModifierDataMinMax(internalDataMin, internalDataMax); cbGetModifierDataMinMax(internalModifierMin, internalModifierMax);
uint8_t h=1; uint8_t h=1;
static const uint8_t dSize = 200*h;
if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) { if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) {
h=50; h=50;
} }
const uint8_t steps=200;
const int dSize = steps*h;
std::vector<double> d(dSize, 0.0); std::vector<double> d(dSize, 0.0);
std::vector<double> dd(dSize, 0.0); std::vector<double> dd(dSize, 0.0);
for (uint8_t i=0; i<dSize; i++) { for (uint8_t i=0; i<steps; i++) {
for (uint8_t j=0; j<h; j++) { for (uint8_t j=0; j<h; j++) {
d[i*h+j]=i; d[i*h+j]=i;
dd[i*h+j]=j; dd[i*h+j]=j;
} }
} }
QImage b(h,200, QImage::Format_ARGB32); QImage b(h, steps, QImage::Format_ARGB32);
JKQTPImageTools::array2image<double>(d.data(),h,dSize/h, b, palette, 0, dSize/h-1); JKQTPImageTools::array2image<double>(d.data(),h, steps, b, palette, 0, steps-1);
if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) { if (modifierMode!=JKQTPMathImageModifierMode::ModifyNone) {
modifyImage(b, dd.data(), JKQTPMathImageDataType::DoubleArray, h,dSize/h, 0, h-1); modifyImage(b, dd.data(), JKQTPMathImageDataType::DoubleArray, h, steps, 0, h-1);
} }
if (colorBarRightVisible) { if (colorBarRightVisible) {