r14275 by fschmid - Xara Importer:: some more Attributes handled correctly now.

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 10 11:15:24 CET 2009


Revision: 14275
Author: fschmid
Date: 2009-11-10T03:31:48.508772Z
Commit message: Xara Importer:: some more Attributes handled correctly now.

Changeset: 
M  /trunk/Scribus/scribus/plugins/xarimplugin/importxar.h
M  /trunk/Scribus/scribus/plugins/xarimplugin/importxar.cpp

Diffs:
Index: scribus/plugins/xarimplugin/importxar.cpp
===================================================================
--- scribus/plugins/xarimplugin/importxar.cpp	(revision 14274)
+++ scribus/plugins/xarimplugin/importxar.cpp	(revision 14275)
@@ -348,7 +348,7 @@
 	currentLayer = 0;
 	QList<PageItem*> gElements;
 	groupStack.push(gElements);
-	ignoreableTags << 2 << 40 << 41 << 43 << 46 << 47 << 53 << 61 << 62 << 63 << 80 << 90 << 91 << 92 << 93 << 111 << 4031;
+	ignoreableTags << 2 << 40 << 41 << 43 << 46 << 47 << 53 << 61 << 62 << 63 << 80 << 90 << 91 << 92 << 93 << 104 << 111 << 4031;
 	ignoreableTags << 4114 << 4116 << 4124;
 	if(progressDialog)
 	{
@@ -540,6 +540,12 @@
 		handleBitmapFill(ts, dataLen);
 	else if (tag == 166)
 		handleFlatFillTransparency(ts);
+	else if ((tag == 174) || (tag == 175))
+		handleLineEnd(ts);
+	else if (tag == 176)
+		handleLineJoin(ts);
+	else if (tag == 178)
+		handleFillRule(ts);
 	else if (tag == 190)
 		gc->FillCol = CommonStrings::None;
 	else if (tag == 191)
@@ -560,11 +566,49 @@
 		handleMultiGradient(ts, false);
 	else
 	{
-//		qDebug() << QString("OpCode: %1 Data Len %2").arg(tag).arg(dataLen, 8, 16, QLatin1Char('0'));
+//		if (m_gc.count() > 3)
+//			qDebug() << QString("Unhandled OpCode: %1 Data Len %2").arg(tag).arg(dataLen, 8, 16, QLatin1Char('0'));
 		ts.skipRawData(dataLen);
 	}
 }
 
+void XarPlug::handleFillRule(QDataStream &ts)
+{
+	quint8 val;
+	ts >> val;
+	XarStyle *gc = m_gc.top();
+	if (val == 0)
+		gc->fillRule = false;
+	else
+		gc->fillRule = true;
+}
+
+void XarPlug::handleLineEnd(QDataStream &ts)
+{
+	quint8 val;
+	ts >> val;
+	XarStyle *gc = m_gc.top();
+	if (val == 0)
+		gc->PLineEnd = Qt::FlatCap;
+	else if (val == 1)
+		gc->PLineEnd = Qt::RoundCap;
+	else if (val == 2)
+		gc->PLineEnd = Qt::SquareCap;
+}
+
+void XarPlug::handleLineJoin(QDataStream &ts)
+{
+	quint8 val;
+	ts >> val;
+	XarStyle *gc = m_gc.top();
+	if (val == 0)
+		gc->PLineJoin = Qt::MiterJoin;
+	else if (val == 1)
+		gc->PLineJoin = Qt::RoundJoin;
+	else if (val == 2)
+		gc->PLineJoin = Qt::BevelJoin;
+}
+
 void XarPlug::handleQuickShapeSimple(QDataStream &ts, quint32 dataLen)
 {
 	XarStyle *gc = m_gc.top();
@@ -598,6 +642,7 @@
 //	qDebug() << "MinorAxis" << minorAxisX << minorAxisY;
 //	qDebug() << "Matrix" << scaleX << skewX << skewY << scaleY << transX << transY;
 //	qDebug() << "Radii" << r1 << r2 << r3 << r4;
+//	qDebug() << "Flags" << flags;
 //	qDebug() << "Bytes read" << bytesRead << "of" << dataLen;
 	ts.skipRawData(dataLen - bytesRead);
 	int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, gc->LWidth, gc->FillCol, gc->StrokeCol, true);
@@ -717,6 +762,7 @@
 	QPointF tl(tlx, tly);
 	double distX = sqrt(pow(br.x() - bl.x(), 2) + pow(br.y() - bl.y(), 2));
 	double distY = sqrt(pow(tl.x() - bl.x(), 2) + pow(tl.y() - bl.y(), 2));
+	double rot = xy2Deg(brx - blx, bry - bly);
 	if (patternRef.contains(bref))
 	{
 		ScPattern pat = m_Doc->docPatterns[patternRef[bref]];
@@ -725,7 +771,7 @@
 		gc->patternScaleY = distY / pat.height * 100;
 		gc->patternOffsetX = 0.0;
 		gc->patternOffsetY = 0.0;
-		gc->patternRotation = 0.0;
+		gc->patternRotation = -rot;
 		gc->patternSkewX = 0.0;
 		gc->patternSkewY = 0.0;
 	}
@@ -1319,6 +1365,9 @@
 			item->setFillTransparency(gc->FillOpacity);
 			item->setLineWidth(gc->LWidth);
 			item->setLineColor(gc->StrokeCol);
+			item->setLineJoin(gc->PLineJoin);
+			item->setLineEnd(gc->PLineEnd);
+			item->setFillEvenOdd(gc->fillRule);
 			if (!gc->fillPattern.isEmpty())
 			{
 				item->setPattern(gc->fillPattern);
Index: scribus/plugins/xarimplugin/importxar.h
===================================================================
--- scribus/plugins/xarimplugin/importxar.h	(revision 14274)
+++ scribus/plugins/xarimplugin/importxar.h	(revision 14275)
@@ -38,7 +38,7 @@
 		FontStretch("normal"),
 		FontSize(12),
 		FillCol(CommonStrings::None),
-		fillRule("nonzero"),
+		fillRule(true),
 		FillGradient(VGradient::linear),
 		StrokeGradient(VGradient::linear),
 		FillGradientType(0),
@@ -54,7 +54,7 @@
 		LWidth(0.5),
 		PLineArt(Qt::SolidLine),
 		PLineEnd(Qt::FlatCap),
-		PLineJoin(Qt::MiterJoin),
+		PLineJoin(Qt::BevelJoin),
 		StrokeCol("Black"),
 		FillOpacity(0.0),
 		StrokeOpacity(0.0),
@@ -78,7 +78,7 @@
 	QString FontStretch;
 	int FontSize;
 	QString FillCol;
-	QString fillRule;
+	bool fillRule;
 	VGradient FillGradient;
 	VGradient StrokeGradient;
 	int    FillGradientType;
@@ -145,6 +145,9 @@
 	bool convert(QString fn);
 	void parseXar(QDataStream &ts);
 	void handleTags(quint32 tag, quint32 dataLen, QDataStream &ts);
+	void handleFillRule(QDataStream &ts);
+	void handleLineEnd(QDataStream &ts);
+	void handleLineJoin(QDataStream &ts);
 	void handleQuickShapeSimple(QDataStream &ts, quint32 dataLen);
 	void handleFlatFillTransparency(QDataStream &ts);
 	void handleMultiGradient(QDataStream &ts, bool linear);




More information about the scribus-commit mailing list