r17377 by fschmid - Fixed incorrect export of named gradients to pdf and ps.

scribus-commit scribus-commit at lists.scribus.net
Tue Mar 13 21:38:56 UTC 2012


Author: fschmid
Date: Tue Mar 13 21:38:56 2012
New Revision: 17377

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17377
Log:
Fixed incorrect export of named gradients to pdf and ps.

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pslib.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17377&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Tue Mar 13 21:38:56 2012
@@ -6192,7 +6192,10 @@
 		FocalY = currItem->GrMaskFocalY;
 		Gscale = currItem->GrMaskScale;
 		Gskew = currItem->GrMaskSkew;
-		gradient = currItem->mask_gradient;
+		if (!(currItem->gradientMask().isEmpty()) && (doc.docGradients.contains(currItem->gradientMask())))
+			gradient = doc.docGradients[currItem->gradientMask()];
+		else
+			gradient = currItem->mask_gradient;
 		QList<VColorStop*> cstops = gradient.colorStops();
 		StopVec.clear();
 		TransVec.clear();
@@ -7433,7 +7436,10 @@
 	VGradient gradient;
 	bool spotMode = false;
 	bool transparencyFound = false;
-	gradient = c->fill_gradient;
+	if (!(c->gradient().isEmpty()) && (doc.docGradients.contains(c->gradient())))
+		gradient = doc.docGradients[c->gradient()];
+	else
+		gradient = c->fill_gradient;
 	QList<VColorStop*> cstops = gradient.colorStops();
 	StopVec.clear();
 	TransVec.clear();
@@ -7476,7 +7482,7 @@
 		QDataStream vst(&vertStreamT, QIODevice::WriteOnly);
 		vst.setByteOrder(QDataStream::BigEndian);
 		quint8 flg = 0;
-		for (uint offset = 1; offset < c->fill_gradient.Stops(); ++offset)
+		for (uint offset = 1; offset < gradient.Stops(); ++offset)
 		{
 			QLineF e1 = edge1;
 			QLineF e1s = edge1;
@@ -7652,7 +7658,7 @@
 	QDataStream vs(&vertStream, QIODevice::WriteOnly);
 	vs.setByteOrder(QDataStream::BigEndian);
 	quint8 flg = 0;
-	for (uint offset = 1; offset < c->fill_gradient.Stops(); ++offset)
+	for (uint offset = 1; offset < gradient.Stops(); ++offset)
 	{
 		QLineF e1 = edge1;
 		QLineF e1s = edge1;
@@ -7833,7 +7839,7 @@
 	}
 	tmp += putColor(colorNames.last(), colorShades.last(), true);
 	tmp += SetClipPath(c);
-	tmp += "h\n";
+	tmp += (c->fillRule ? "h\nW*\nn\n" : "h\nW\nn\n");
 	tmp += FToStr(c->GrControl1.x())+" "+FToStr(-c->GrControl1.y())+" m\n";
 	tmp += FToStr(c->GrControl2.x())+" "+FToStr(-c->GrControl2.y())+" l\n";
 	tmp += FToStr(c->GrControl3.x())+" "+FToStr(-c->GrControl3.y())+" l\n";
@@ -8184,7 +8190,10 @@
 		FocalY = currItem->GrStrokeFocalY;
 		Gscale = currItem->GrStrokeScale;
 		Gskew = currItem->GrStrokeSkew;
-		gradient = currItem->stroke_gradient;
+		if (!(currItem->strokeGradient().isEmpty()) && (doc.docGradients.contains(currItem->strokeGradient())))
+			gradient = doc.docGradients[currItem->strokeGradient()];
+		else
+			gradient = currItem->stroke_gradient;
 	}
 	else
 	{
@@ -8205,7 +8214,10 @@
 		FocalY = currItem->GrFocalY;
 		Gscale = currItem->GrScale;
 		Gskew = currItem->GrSkew;
-		gradient = currItem->fill_gradient;
+		if (!(currItem->gradient().isEmpty()) && (doc.docGradients.contains(currItem->gradient())))
+			gradient = doc.docGradients[currItem->gradient()];
+		else
+			gradient = currItem->fill_gradient;
 	}
 	QList<VColorStop*> cstops = gradient.colorStops();
 	StopVec.clear();

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17377&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Tue Mar 13 21:38:56 2012
@@ -4444,8 +4444,13 @@
 	QStringList colorValues;
 	QStringList spotColorSet;
 	QList<int> colsSh;
-	QList<VColorStop*> colorStops = c->fill_gradient.colorStops();
-	for (uint cst = 0; cst < c->fill_gradient.Stops(); ++cst)
+	VGradient gradient;
+	if (!(c->gradient().isEmpty()) && (m_Doc->docGradients.contains(c->gradient())))
+		gradient = m_Doc->docGradients[c->gradient()];
+	else
+		gradient = c->fill_gradient;
+	QList<VColorStop*> colorStops = gradient.colorStops();
+	for (uint cst = 0; cst < gradient.Stops(); ++cst)
 	{
 		cols.append(colorStops.at(cst)->name);
 		colsSh.append(colorStops.at(cst)->shade);
@@ -4548,7 +4553,7 @@
 	QLineF edge2 = QLineF(centerP, QPointF(c->GrControl2.x(), -c->GrControl2.y()));
 	QLineF edge3 = QLineF(centerP, QPointF(c->GrControl3.x(), -c->GrControl3.y()));
 	QLineF edge4 = QLineF(centerP, QPointF(c->GrControl4.x(), -c->GrControl4.y()));
-	for (uint offset = 1; offset < c->fill_gradient.Stops(); ++offset)
+	for (uint offset = 1; offset < gradient.Stops(); ++offset)
 	{
 		QLineF e1 = edge1;
 		QLineF e1s = edge1;
@@ -4776,7 +4781,10 @@
 		FocalY = c->GrStrokeFocalY;
 		Gscale = c->GrStrokeScale;
 		Gskew = c->GrStrokeSkew;
-		gradient = c->stroke_gradient;
+		if (!(c->strokeGradient().isEmpty()) && (m_Doc->docGradients.contains(c->strokeGradient())))
+			gradient = m_Doc->docGradients[c->strokeGradient()];
+		else
+			gradient = c->stroke_gradient;
 	}
 	else
 	{
@@ -4789,7 +4797,10 @@
 		FocalY = c->GrFocalY;
 		Gscale = c->GrScale;
 		Gskew = c->GrSkew;
-		gradient = c->fill_gradient;
+		if (!(c->gradient().isEmpty()) && (m_Doc->docGradients.contains(c->gradient())))
+			gradient = m_Doc->docGradients[c->gradient()];
+		else
+			gradient = c->fill_gradient;
 		if (GType == 8)
 		{
 			QTransform patternMatrix;




More information about the scribus-commit mailing list