[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Calligra] f603b94: Improved ooxml saturation calculation & improved c
From: Lassi Nieminen <lassniem () gmail ! com>
Date: 2011-01-07 10:48:58
Message-ID: 20110107104858.BEF1FA6090 () git ! kde ! org
[Download RAW message or body]
commit f603b948596784ef6b6675703df3e10ed4006c8b
branch master
Author: Lassi Nieminen <lassniem@gmail.com>
Date: Fri Jan 7 12:48:34 2011 +0200
Improved ooxml saturation calculation & improved capabilities or random shapes in \
VML.
diff --git a/filters/libmsooxml/MsooXmlUtils.cpp \
b/filters/libmsooxml/MsooXmlUtils.cpp index 8232314..64c2d0b 100644
--- a/filters/libmsooxml/MsooXmlUtils.cpp
+++ b/filters/libmsooxml/MsooXmlUtils.cpp
@@ -1590,6 +1590,19 @@ MSOOXML_EXPORT void Utils::modifyColor(QColor& color, qreal \
tint, qreal shade, q
// SatMod can be for example 3.5 so converting RGB -> HSL is not an option
// ADD INFO: MS document does not say that when calculating TINT and SHADE
// That whether one should use normal RGB or linear RGB, check it!
+
+
+ // This method is used temporarily, it seems to produce visually better results \
than the lower one. + if (satMod > 0) {
+ QColor temp = QColor(red, green, blue);
+ qreal saturationFromFull = 1.0 - temp.saturationF();
+ temp = QColor::fromHsvF(temp.hueF(), temp.saturationF() + saturationFromFull \
/ 10 * satMod, temp.valueF()); + red = temp.red();
+ green = temp.green();
+ blue = temp.blue();
+ }
+
+ /*
if (satMod > 0) {
red = red * satMod;
green = green * satMod;
@@ -1604,6 +1617,7 @@ MSOOXML_EXPORT void Utils::modifyColor(QColor& color, qreal \
tint, qreal shade, q blue = 255;
}
}
+ */
color = QColor(red, green, blue);
}
diff --git a/filters/libmsooxml/MsooXmlVmlReaderImpl.h \
b/filters/libmsooxml/MsooXmlVmlReaderImpl.h index 7546464..9ec7f39 100644
--- a/filters/libmsooxml/MsooXmlVmlReaderImpl.h
+++ b/filters/libmsooxml/MsooXmlVmlReaderImpl.h
@@ -1066,6 +1066,16 @@ KoFilter::ConversionStatus MSOOXML_CURRENT_CLASS::read_f()
eqn = eqn.trimmed();
eqn.replace('#', '$'); // value reference
eqn.replace('@', "?f"); // function reference
+ eqn.replace("pixelWidth", "width");
+ eqn.replace("pixelHeight", "height");
+ eqn.replace("emuWidth", "width");
+ eqn.replace("emuHeight", "height");
+ eqn.replace("emuWidth2", "(width/2)");
+ eqn.replace("emuHeight2", "(height/2)");
+ eqn.replace("lineDrawn", "hasstroke");
+ eqn.replace("pixelLineWidth", "1");
+ eqn.replace("xcenter", "(width/2)");
+ eqn.replace("ycenter", "(height/2)");
int commandIndex = eqn.indexOf(' ');
QString command = eqn.left(commandIndex);
eqn = eqn.mid(commandIndex + 1);
@@ -1098,7 +1108,37 @@ KoFilter::ConversionStatus MSOOXML_CURRENT_CLASS::read_f()
m_shapeTypeString += QString("max(%1, \
%2)").arg(parameters.at(0)).arg(parameters.at(1)); }
else if (command == "if") {
- m_shapeTypeString += QString("if(%1, %2, \
%3)").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + \
m_shapeTypeString += QString("if(max(%1, 0), %2, \
%3)").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + }
+ else if (command == "sqrt") {
+ m_shapeTypeString += QString("sqrt(%1)").arg(parameters.at(0));
+ }
+ else if (command == "mod") {
+ m_shapeTypeString += QString("sqrt(%1 * %1 + %2 * %2 + %3 * \
%3)").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + }
+ else if (command == "ellipse") {
+ m_shapeTypeString += QString("%3 - sqrt(1 - \
(%1/%2)*(%1/%2))").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); \
+ } + else if (command == "atan2") {
+ m_shapeTypeString += QString("atan2(%2, \
%1)").arg(parameters.at(0)).arg(parameters.at(1)); + }
+ else if (command == "cosatan2") {
+ m_shapeTypeString += QString("%1 * cos(atan2(%3, \
%2))").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + }
+ else if (command == "sinatan2") {
+ m_shapeTypeString += QString("%1 * sin(atan2(%3, \
%2))").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + }
+ else if (command == "sumangle") {
+ m_shapeTypeString += QString("%1 + %2 * 65536 - %3 * \
65536").arg(parameters.at(0)).arg(parameters.at(1)).arg(parameters.at(2)); + }
+ else if (command == "sin") {
+ m_shapeTypeString += QString("%1 * sin(%2 * \
65536)").arg(parameters.at(0)).arg(parameters.at(1)); + }
+ else if (command == "cos") {
+ m_shapeTypeString += QString("%1 * cos(%2 * \
65536)").arg(parameters.at(0)).arg(parameters.at(1)); + }
+ else if (command == "tan") {
+ m_shapeTypeString += QString("%1 * tan(%2 * \
65536)").arg(parameters.at(0)).arg(parameters.at(1)); }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic