[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1767
Date       : Fri Jun 15 10:49:18 BST 2007

Changed paths:
   M /Trunk/XaraLX/filters/SVGFilter/styles.h
   M /Trunk/XaraLX/filters/SVGFilter/svgimporter.cpp
   M /Trunk/XaraLX/filters/SVGFilter/xargenerator.cpp

Patch to add to the SVG import filter the ability to read the line join value and set the Xara attribute accordingly.


Diff:
Index: Trunk/XaraLX/filters/SVGFilter/xargenerator.cpp
===================================================================
--- Trunk/XaraLX/filters/SVGFilter/xargenerator.cpp	(revision 1766)
+++ Trunk/XaraLX/filters/SVGFilter/xargenerator.cpp	(revision 1767)
@@ -974,6 +974,29 @@
 		ok = m_pExporter->WriteRecord(&Rec);
 	}
 
+	if (witch & STYLE_STROKE_LINEJOIN && style.IsStrokeLineJoinDefined()) {
+		JointType jt=style.GetStrokeLineJoin();
+		Rec.Reinit(TAG_JOINSTYLE, TAG_JOINSTYLE_SIZE);
+		ok = Rec.WriteBYTE(jt);
+		ok = m_pExporter->WriteRecord(&Rec);
+
+#if SVGDEBUG
+		switch(jt)
+		{
+			case MitreJoin:
+				svgtrace(DBGTRACE_STYLES, "stroke join mitre\n");
+			break;
+			case BevelledJoin:
+				svgtrace(DBGTRACE_STYLES, "stroke join bevel\n");
+			break;
+			case RoundJoin:
+				svgtrace(DBGTRACE_STYLES, "stroke join round\n");
+			break;
+		}
+#endif
+
+	}
+
 	if (witch & STYLE_STROKE_OPACITY && style.IsStrokeOpacityDefined()) {
 		double opacity = style.GetStrokeOpacity();
 		if (opacity < 1.0) {
Index: Trunk/XaraLX/filters/SVGFilter/styles.h
===================================================================
--- Trunk/XaraLX/filters/SVGFilter/styles.h	(revision 1766)
+++ Trunk/XaraLX/filters/SVGFilter/styles.h	(revision 1767)
@@ -207,6 +207,7 @@
 		m_strokeColour = wxColour(0,0,0);
 		m_strokeOpacity = 1.0;
 		m_strokeWidth = 1;
+		m_strokeLineJoin = MitreJoin;
 		m_strokeGradient = NULL;
 		m_opacity = 1.0;
 		m_stopOffset = 0.0;
@@ -228,6 +229,7 @@
 		m_strokeColour = copy.m_strokeColour;
 		m_strokeOpacity = copy.m_strokeOpacity;
 		m_strokeWidth = copy.m_strokeWidth;
+		m_strokeLineJoin = copy.m_strokeLineJoin;
 		m_strokeGradient = copy.m_strokeGradient;
 		m_opacity = copy.m_opacity;
 		m_stopOffset = copy.m_stopOffset;
@@ -284,6 +286,13 @@
 		m_strokeWidth = width;
 	}
 
+	bool IsStrokeLineJoinDefined() const { return m_defined & STYLE_STROKE_LINEJOIN; }
+	JointType GetStrokeLineJoin() const { return m_strokeLineJoin; }
+	void SetStrokeLineJoin(JointType jt ) {
+		m_defined |= STYLE_STROKE_LINEJOIN;
+		m_strokeLineJoin = jt;
+	}
+
 	bool IsStrokeGradientDefined() const { return m_defined & STYLE_STROKE_GRADIENT; }
 	Gradient* GetStrokeGradient() const { return m_strokeGradient; }
 	void SetStrokeGradient(Gradient* value) {
@@ -330,6 +339,7 @@
 	wxColour	m_strokeColour;
 	double		m_strokeOpacity;
 	INT32		m_strokeWidth;
+	JointType	m_strokeLineJoin;
 	Gradient*	m_strokeGradient;
 	double		m_opacity;
 	double		m_stopOffset;
Index: Trunk/XaraLX/filters/SVGFilter/svgimporter.cpp
===================================================================
--- Trunk/XaraLX/filters/SVGFilter/svgimporter.cpp	(revision 1766)
+++ Trunk/XaraLX/filters/SVGFilter/svgimporter.cpp	(revision 1767)
@@ -1515,6 +1515,19 @@
 		style.SetStrokeWidth((INT32)fWidth);
 	}
 
+	sValue = GetStringProperty(cur, "stroke-linejoin");
+	if (!sValue.IsEmpty()) {
+		if(sValue.CmpNoCase(_T("miter"))==0) {
+			style.SetStrokeLineJoin(MitreJoin);
+		}
+		else if(sValue.CmpNoCase(_T("bevel"))==0) {
+			style.SetStrokeLineJoin(BevelledJoin);
+		}
+		else if(sValue.CmpNoCase(_T("round"))==0) {
+			style.SetStrokeLineJoin(RoundJoin);
+		}
+	}
+
 	if (IsPropertyDefined(cur, "opacity")) {
 		double fOpacity = GetClampedDoubleProperty(cur, "opacity");
 		style.SetOpacity(fOpacity);


Xara