r18628 by fschmid - XPS-Importer: handle rotations in transforms correctly

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 8 17:32:32 UTC 2013


Author: fschmid
Date: Sun Dec  8 17:32:32 2013
New Revision: 18628

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18628
Log:
XPS-Importer: handle rotations in transforms correctly

Modified:
    trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
    trunk/Scribus/scribus/plugins/import/xps/importxps.h

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18628&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.cpp Sun Dec  8 17:32:32 2013
@@ -714,6 +714,8 @@
 	obState.patternMask = "";
 	obState.CapStyle = Qt::FlatCap;
 	obState.JoinStyle = Qt::MiterJoin;
+	obState.DashOffset = 0;
+	obState.DashPattern.clear();
 	QString itemName = "";
 	QString itemTarget = "";
 	if (dpg.hasAttribute("Name"))
@@ -767,6 +769,22 @@
 			obState.JoinStyle = Qt::BevelJoin;
 		else
 			obState.JoinStyle = Qt::MiterJoin;
+	}
+	if (dpg.hasAttribute("StrokeDashOffset"))
+		obState.DashOffset = dpg.attribute("StrokeDashOffset", "0.0").toDouble();
+	if (dpg.hasAttribute("StrokeDashArray"))
+	{
+		QString trans = dpg.attribute("StrokeDashArray", "");
+		if (!trans.isEmpty())
+		{
+			ScTextStream list(&trans, QIODevice::ReadOnly);
+			while (!list.atEnd())
+			{
+				double d;
+				list >> d;
+				obState.DashPattern.append(d);
+			}
+		}
 	}
 	if (dpg.hasAttribute("Clip"))
 	{
@@ -1218,6 +1236,11 @@
 					retObj->setMaskVector(obState.maskStart.x() - xp, obState.maskStart.y() - yp, obState.maskEnd.x() - xp, obState.maskEnd.y() - yp, obState.maskFocus.x() - xp, obState.maskFocus.y() - yp, obState.maskScale, 0);
 					retObj->setMaskType(obState.maskTyp);
 				}
+				if ((obState.transform.m12() != 0.0) || (obState.transform.m21() != 0))
+				{
+					QLineF line = obState.transform.map(QLineF(0.0, 0.0, 1.0, 0.0));
+					retObj->setRotation(-line.angle(), true);
+				}
 				retObj->OwnPage = m_Doc->OnPage(retObj);
 				m_Doc->GroupOnPage(retObj);
 				m_Doc->Items->removeLast();
@@ -1754,6 +1777,16 @@
 	}
 	if (!obState.patternStroke.isEmpty())
 		item->setStrokePattern(obState.patternStroke);
+	if (!obState.DashPattern.isEmpty())
+	{
+		item->setDashOffset(obState.DashOffset);
+		QVector<double> pattern(obState.DashPattern.count());
+		for (int i = 0; i < obState.DashPattern.count(); ++i)
+		{
+			pattern[i] = obState.DashPattern[i] * obState.LineW;
+		}
+		item->setDashes(pattern);
+	}
 }
 
 QString XpsPlug::handleColor(QString rgbColor, double &opacity)

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18628&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.h (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.h Sun Dec  8 17:32:32 2013
@@ -100,6 +100,8 @@
 		int itemType;
 		Qt::PenCapStyle CapStyle;
 		Qt::PenJoinStyle JoinStyle;
+		QVector<double> DashPattern;
+		double DashOffset;
 	};
 	bool convert(QString fn);
 	void parseDocSequence(QString designMap);




More information about the scribus-commit mailing list