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

[XaraXtreme-dev] Patch to add Line Join to SVG filter



Attached is a patch to add to the SVG import filter the ability to read
the line join value and set the Xara attribute accordingly. I ran the
svn diff from within the filters/SVGFilter directory.

Have my other patches been considered?

Thanks.
Index: xargenerator.cpp
===================================================================
--- xargenerator.cpp	(revision 1766)
+++ xargenerator.cpp	(working copy)
@@ -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: styles.h
===================================================================
--- styles.h	(revision 1766)
+++ styles.h	(working copy)
@@ -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: svgimporter.cpp
===================================================================
--- svgimporter.cpp	(revision 1766)
+++ svgimporter.cpp	(working copy)
@@ -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);