r23444 by jghali - #16033: workaround round-trip error with QColor rgb <-> hsv conversions by using floating point versions of the functions
scribus-commit
scribus-commit at lists.scribus.net
Sat Jan 11 23:04:21 UTC 2020
Author: jghali
Date: Sat Jan 11 23:04:21 2020
New Revision: 23444
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23444
Log:
#16033: workaround round-trip error with QColor rgb <-> hsv conversions by using floating point versions of the functions
Modified:
branches/Version14x/Scribus/scribus/sccolorengine.cpp
Modified: branches/Version14x/Scribus/scribus/sccolorengine.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23444&path=/branches/Version14x/Scribus/scribus/sccolorengine.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/sccolorengine.cpp (original)
+++ branches/Version14x/Scribus/scribus/sccolorengine.cpp Sat Jan 11 23:04:21 2020
@@ -175,17 +175,17 @@
}
else
{
- int h, s, v, snew, vnew;
+ qreal h, s, v, snew, vnew;
QColor tmpR(color.CR, color.MG, color.YB);
- tmpR.getHsv(&h, &s, &v);
- snew = qRound(s * level / 100.0);
- vnew = 255 - qRound(((255 - v) * level / 100.0));
- tmpR.setHsv(h, snew, vnew);
+ tmpR.getHsvF(&h, &s, &v);
+ snew = s * (level / 100.0);
+ vnew = 1.0 - (1.0 - v) * (level / 100.0);
+ tmpR.setHsvF(h, snew, vnew);
tmpR.getRgb(&rgb.r, &rgb.g, &rgb.b);
//We could also compute rgb shade using rgb directly
- /*rgb.CR = 255 - ((255 - color.CR) * level / 100);
- rgb.MG = 255 - ((255 - color.MG) * level / 100);
- rgb.YB = 255 - ((255 - color.YB) * level / 100);*/
+ /*rgb.CR = 255 - ((255 - color.CR) * level / 100.0);
+ rgb.MG = 255 - ((255 - color.MG) * level / 100.0);
+ rgb.YB = 255 - ((255 - color.YB) * level / 100.0);*/
}
}
More information about the scribus-commit
mailing list