r21289 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Fri May 6 09:13:21 UTC 2016


Author: fschmid
Date: Fri May  6 09:13:21 2016
New Revision: 21289

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21289
Log:
Fixed Bug #13504: rhomb color gradient is not adjustable in %

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

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21289&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Fri May  6 09:13:21 2016
@@ -7352,6 +7352,19 @@
 	for (uint cst = 0; cst < gradient.Stops(); ++cst)
 	{
 		double actualStop = cstops.at(cst)->rampPoint;
+		if (cst == 0)
+		{
+			StopVec.append(0);
+			colorNames.append(cstops.at(cst)->name);
+			colorShades.append(cstops.at(cst)->shade);
+			TransVec.append(cstops.at(cst)->opacity);
+			if (spotMap.contains(cstops.at(cst)->name))
+			{
+				if (!spotColorSet.contains(cstops.at(cst)->name))
+					spotColorSet.append(cstops.at(cst)->name);
+			}
+			Gcolors.append(SetGradientColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+		}
 		StopVec.append(actualStop);
 		colorNames.append(cstops.at(cst)->name);
 		colorShades.append(cstops.at(cst)->shade);
@@ -7386,7 +7399,7 @@
 		QDataStream vst(&vertStreamT, QIODevice::WriteOnly);
 		vst.setByteOrder(QDataStream::BigEndian);
 		quint8 flg = 0;
-		for (uint offset = 1; offset < gradient.Stops(); ++offset)
+		for (int offset = 1; offset < StopVec.count(); ++offset)
 		{
 			QLineF e1 = edge1;
 			QLineF e1s = edge1;
@@ -7563,7 +7576,7 @@
 	QDataStream vs(&vertStream, QIODevice::WriteOnly);
 	vs.setByteOrder(QDataStream::BigEndian);
 	quint8 flg = 0;
-	for (uint offset = 1; offset < gradient.Stops(); ++offset)
+	for (int offset = 1; offset < StopVec.count(); ++offset)
 	{
 		QLineF e1 = edge1;
 		QLineF e1s = edge1;

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21289&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Fri May  6 09:13:21 2016
@@ -3530,8 +3530,23 @@
 		gradient = c->fill_gradient;
 	gradient.setRepeatMethod(c->getGradientExtend());
 	QList<VColorStop*> colorStops = gradient.colorStops();
+	QList<double> qStopRampPoints;
 	for (uint cst = 0; cst < gradient.Stops(); ++cst)
 	{
+		if (cst == 0)
+		{
+			if (colorStops[cst]->rampPoint > 0)
+			{
+				qStopRampPoints.append(0);
+				cols.append(colorStops.at(cst)->name);
+				colsSh.append(colorStops.at(cst)->shade);
+				if (spotMap.contains(colorStops.at(cst)->name))
+				{
+					if (!spotColorSet.contains(colorStops.at(cst)->name))
+						spotColorSet.append(colorStops.at(cst)->name);
+				}
+			}
+		}
 		cols.append(colorStops.at(cst)->name);
 		colsSh.append(colorStops.at(cst)->shade);
 		if (spotMap.contains(colorStops.at(cst)->name))
@@ -3539,6 +3554,7 @@
 			if (!spotColorSet.contains(colorStops.at(cst)->name))
 				spotColorSet.append(colorStops.at(cst)->name);
 		}
+		qStopRampPoints.append(colorStops.at(cst)->rampPoint);
 	}
 	for (int ac = 0; ac < cols.count(); ac++)
 	{
@@ -3633,7 +3649,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 < gradient.Stops(); ++offset)
+	for (int offset = 1; offset < qStopRampPoints.count(); ++offset)
 	{
 		QLineF e1 = edge1;
 		QLineF e1s = edge1;
@@ -3643,14 +3659,14 @@
 		QLineF e3s = edge3;
 		QLineF e4 = edge4;
 		QLineF e4s = edge4;
-		e1.setLength(edge1.length() * colorStops[ offset ]->rampPoint);
-		e2.setLength(edge2.length() * colorStops[ offset ]->rampPoint);
-		e3.setLength(edge3.length() * colorStops[ offset ]->rampPoint);
-		e4.setLength(edge4.length() * colorStops[ offset ]->rampPoint);
-		e1s.setLength(edge1.length() * colorStops[ offset - 1 ]->rampPoint);
-		e2s.setLength(edge2.length() * colorStops[ offset - 1 ]->rampPoint);
-		e3s.setLength(edge3.length() * colorStops[ offset - 1 ]->rampPoint);
-		e4s.setLength(edge4.length() * colorStops[ offset - 1 ]->rampPoint);
+		e1.setLength(edge1.length() * qStopRampPoints[ offset ]);
+		e2.setLength(edge2.length() * qStopRampPoints[ offset ]);
+		e3.setLength(edge3.length() * qStopRampPoints[ offset ]);
+		e4.setLength(edge4.length() * qStopRampPoints[ offset ]);
+		e1s.setLength(edge1.length() * qStopRampPoints[ offset - 1 ]);
+		e2s.setLength(edge2.length() * qStopRampPoints[ offset - 1 ]);
+		e3s.setLength(edge3.length() * qStopRampPoints[ offset - 1 ]);
+		e4s.setLength(edge4.length() * qStopRampPoints[ offset - 1 ]);
 		if (offset == 1)
 		{
 			PutStream("0\n");

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21289&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp	(original)
+++ trunk/Scribus/scribus/scpainter.cpp	Fri May  6 09:13:21 2016
@@ -838,12 +838,22 @@
 			double r, g, b, a;
 			QList<VColorStop*> colorStops = fill_gradient.colorStops();
 			QList<QColor> qStopColors;
+			QList<double> qStopRampPoints;
 			QColor qStopColor;
 			for( int offset = 0 ; offset < colorStops.count() ; offset++ )
 			{
 				qStopColor = colorStops[ offset ]->color;
 				qStopColor.setAlphaF(colorStops[offset]->opacity);
+				if (offset == 0)
+				{
+					if (colorStops[offset]->rampPoint > 0)
+					{
+						qStopRampPoints.append(0);
+						qStopColors.append(qStopColor);
+					}
+				}
 				qStopColors.append(qStopColor);
+				qStopRampPoints.append(colorStops[offset]->rampPoint);
 			}
 			qStopColors.last().getRgbF(&r, &g, &b, &a);
 			QPointF centerP = QPointF(gradControlP5.x(), gradControlP5.y());
@@ -868,7 +878,7 @@
 			cairo_fill(cr);
 			cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
 			mpat = cairo_pattern_create_mesh();
-			for( int offset = 1 ; offset < colorStops.count() ; offset++ )
+			for( int offset = 1 ; offset < qStopRampPoints.count() ; offset++ )
 			{
 				QLineF e1 = edge1;
 				QLineF e1s = edge1;
@@ -878,14 +888,14 @@
 				QLineF e3s = edge3;
 				QLineF e4 = edge4;
 				QLineF e4s = edge4;
-				e1.setLength(edge1.length() * colorStops[ offset ]->rampPoint);
-				e2.setLength(edge2.length() * colorStops[ offset ]->rampPoint);
-				e3.setLength(edge3.length() * colorStops[ offset ]->rampPoint);
-				e4.setLength(edge4.length() * colorStops[ offset ]->rampPoint);
-				e1s.setLength(edge1.length() * colorStops[ offset - 1 ]->rampPoint);
-				e2s.setLength(edge2.length() * colorStops[ offset - 1 ]->rampPoint);
-				e3s.setLength(edge3.length() * colorStops[ offset - 1 ]->rampPoint);
-				e4s.setLength(edge4.length() * colorStops[ offset - 1 ]->rampPoint);
+				e1.setLength(edge1.length() * qStopRampPoints[ offset ]);
+				e2.setLength(edge2.length() * qStopRampPoints[ offset ]);
+				e3.setLength(edge3.length() * qStopRampPoints[ offset ]);
+				e4.setLength(edge4.length() * qStopRampPoints[ offset ]);
+				e1s.setLength(edge1.length() * qStopRampPoints[ offset - 1 ]);
+				e2s.setLength(edge2.length() * qStopRampPoints[ offset - 1 ]);
+				e3s.setLength(edge3.length() * qStopRampPoints[ offset - 1 ]);
+				e4s.setLength(edge4.length() * qStopRampPoints[ offset - 1 ]);
 				if (offset == 1)
 				{
 #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 4))




More information about the scribus-commit mailing list