r18885 by fschmid - ODG-Importer: apply correct colors to multicolor custom shapes.
scribus-commit
scribus-commit at lists.scribus.net
Fri Mar 7 21:09:54 UTC 2014
Author: fschmid
Date: Fri Mar 7 21:09:54 2014
New Revision: 18885
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18885
Log:
ODG-Importer: apply correct colors to multicolor custom shapes.
Modified:
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.h
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18885&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Fri Mar 7 21:09:54 2014
@@ -874,6 +874,7 @@
texAreaPoints.append(QPointF(ScCLocale::toDoubleC(points[2]), ScCLocale::toDoubleC(points[3])));
texAreaPoints = mat.map(texAreaPoints);
}
+ QString shapeType = p.attribute("draw:type");
QStringList paths = enhPath.split("N", QString::SkipEmptyParts);
if (!paths.isEmpty())
{
@@ -889,6 +890,82 @@
QString fillC = tmpOStyle.CurrColorFill;
if (!filled)
fillC = CommonStrings::None;
+ else
+ {
+ if (shapeType == "can")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, false, 110);
+ }
+ else if (shapeType == "cube")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, false, 110);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 120);
+ }
+ else if (shapeType == "paper")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, true, 120);
+ }
+ else if (shapeType == "smiley")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, true, 120);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 120);
+ }
+ else if (shapeType == "quad-bevel")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, false, 110);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 150);
+ else if (a == 3)
+ fillC = modifyColor(fillC, true, 120);
+ else if (a == 4)
+ fillC = modifyColor(fillC, false, 120);
+ }
+ else if (shapeType == "col-60da8460")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, true, 150);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 300);
+ else if (a == 3)
+ fillC = modifyColor(fillC, false, 120);
+ else if (a == 4)
+ fillC = modifyColor(fillC, false, 120);
+ else if (a == 5)
+ fillC = modifyColor(fillC, false, 120);
+ }
+ else if (shapeType == "col-502ad400")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, false, 110);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 120);
+ else if (a == 3)
+ fillC = modifyColor(fillC, false, 120);
+ else if (a == 4)
+ fillC = modifyColor(fillC, false, 120);
+ }
+ else if (shapeType == "vertical-scroll")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, true, 120);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 120);
+ }
+ else if (shapeType == "horizontal-scroll")
+ {
+ if (a == 1)
+ fillC = modifyColor(fillC, true, 120);
+ else if (a == 2)
+ fillC = modifyColor(fillC, true, 120);
+ }
+ }
QString strokeC = tmpOStyle.CurrColorStroke;
if (!stroked)
strokeC = CommonStrings::None;
@@ -3009,6 +3086,25 @@
return retObj;
}
+QString OdgPlug::modifyColor(QString name, bool darker, int amount)
+{
+ const ScColor& col = m_Doc->PageColors[name];
+ QColor c = ScColorEngine::getShadeColorProof(col, m_Doc, 100);
+ QColor mo;
+ if (darker)
+ mo = c.darker(amount);
+ else
+ mo = c.lighter(amount);
+ ScColor tmp;
+ tmp.fromQColor(mo);
+ tmp.setSpotColor(false);
+ tmp.setRegistrationColor(false);
+ QString fNam = m_Doc->PageColors.tryAddColor("FromOdg"+mo.name(), tmp);
+ if (fNam == "FromOdg"+mo.name())
+ importedColors.append(fNam);
+ return fNam;
+}
+
QColor OdgPlug::parseColorN( const QString &rgbColor )
{
int r, g, b;
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18885&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.h (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.h Fri Mar 7 21:09:54 2014
@@ -344,6 +344,7 @@
double degSweepAngle(double start, double stop, bool clockwise);
void arcTo(QPainterPath &path, QPointF startpoint, double rx, double ry, double startAngle, double sweepAngle);
int arcToCurve(double rx, double ry, double startAngle, double sweepAngle, const QPointF & offset, QPointF * curvePoints);
+ QString modifyColor(QString name, bool darker, int amount);
QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
QString constructFontName(QString fontBaseName, QString fontStyle);
More information about the scribus-commit
mailing list