r16706 by jghali - - #10098: incorrect pdf export of gradients on master page

scribus-commit scribus-commit at lists.scribus.net
Wed Jul 6 20:29:19 UTC 2011


Author: jghali
Date: Wed Jul  6 20:29:19 2011
New Revision: 16706

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16706
Log:
- #10098: incorrect pdf export of gradients on master page
- some more improvement related to #10034 and gradients

Modified:
    branches/Version135/Scribus/scribus/pdflib_core.cpp
    branches/Version135/Scribus/scribus/pslib.cpp
    branches/Version135/Scribus/scribus/pslib.h

Modified: branches/Version135/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16706&path=/branches/Version135/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pdflib_core.cpp (original)
+++ branches/Version135/Scribus/scribus/pdflib_core.cpp Wed Jul  6 20:29:19 2011
@@ -2005,8 +2005,6 @@
 							if (!PDF_Gradient(tmpOut, ite))
 								return false;
 							PutPage(tmpOut);
-							PutPage(SetClipPath(ite));
-							PutPage(ite->fillRule ? "h\nf*\n" : "h\nf\n");
 						}
 						else
 						{
@@ -2050,8 +2048,6 @@
 								if (!PDF_Gradient(tmpOut, ite))
 									return false;
 								PutPage(tmpOut);
-								PutPage(SetClipPath(ite));
-								PutPage(ite->fillRule ? "h\nf*\n" : "h\nf\n");
 							}
 							else
 							{
@@ -5639,7 +5635,7 @@
 		if ((Options.Version >= PDFOptions::PDFVersion_14) && ((Trans.at(c+1) != 1) || (Trans.at(c) != 1)))
 			tmp += "/"+TRes+" gs\n";
 		tmp += SetClipPath(currItem);
-		tmp += "h\nW* n\n";
+		tmp += (currItem->fillRule ? "h\nW* n\n" : "h\nW n\n");
 		tmp += "/"+ShName+" sh\nQ\n";
 	}
 	return tmp;

Modified: branches/Version135/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16706&path=/branches/Version135/Scribus/scribus/pslib.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pslib.cpp (original)
+++ branches/Version135/Scribus/scribus/pslib.cpp Wed Jul  6 20:29:19 2011
@@ -1018,7 +1018,7 @@
 	PutStream("newpath\n");
 }
 
-void PSLib::PS_MultiRadGradient(double w, double h, double x, double y, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades)
+void PSLib::PS_MultiRadGradient(double w, double h, double x, double y, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades, bool fillRule)
 {
 	bool first = true;
 	bool oneSameSpot = false;
@@ -1031,7 +1031,7 @@
 	int kc = 0;
 	CMYKColor cmykValues;
 	PutStream( "clipsave\n" );
-	PutStream("eoclip\n");
+	PutStream( fillRule ? "eoclip\n" : "clip\n" );
 	for (int c = 0; c < Colors.count()-1; ++c)
 	{
 		oneSameSpot = false;
@@ -1198,7 +1198,7 @@
 	PutStream("cliprestore\n");
 }
 
-void PSLib::PS_MultiLinGradient(double w, double h, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades)
+void PSLib::PS_MultiLinGradient(double w, double h, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades, bool fillRule)
 {
 	bool first = true;
 	bool oneSameSpot = false;
@@ -1211,7 +1211,7 @@
 	int kc = 0;
 	CMYKColor cmykValues;
 	PutStream( "clipsave\n" );
-	PutStream("eoclip\n");
+	PutStream( fillRule ? "eoclip\n" : "clip\n");
 	for (int c = 0; c < Colors.count()-1; ++c)
 	{
 		oneSameSpot = false;
@@ -3330,10 +3330,7 @@
 			patternMatrix.scale(pat->scaleX, pat->scaleY);
 			patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
 			PutStream("Pattern"+QString::number(patHash)+" ["+ToStr(patternMatrix.m11())+" "+ToStr(patternMatrix.m12())+" "+ToStr(patternMatrix.m21())+" "+ToStr(patternMatrix.m22())+" "+ToStr(patternMatrix.dx())+" "+ToStr(patternMatrix.dy())+"] makepattern setpattern\n");
-			if (fillRule)
-				PutStream("eofill\n");
-			else
-				PutStream("fill\n");
+			PutStream(fillRule ? "eofill\n" : "fill\n");
 			return;
 			break;
 	}
@@ -3367,7 +3364,7 @@
 				colorShades.prepend(cstops.at(cst)->shade);
 			}
 		}
-		PS_MultiRadGradient(w, -h, StartX, -StartY, StopVec, Gcolors, colorNames, colorShades);
+		PS_MultiRadGradient(w, -h, StartX, -StartY, StopVec, Gcolors, colorNames, colorShades, c->fillRule);
 	}
 	else
 	{
@@ -3394,7 +3391,7 @@
 				colorShades.append(cstops.at(cst)->shade);
 			}
 		}
-		PS_MultiLinGradient(w, -h, StopVec, Gcolors, colorNames, colorShades);
+		PS_MultiLinGradient(w, -h, StopVec, Gcolors, colorNames, colorShades, c->fillRule);
 	}
 }
 

Modified: branches/Version135/Scribus/scribus/pslib.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16706&path=/branches/Version135/Scribus/scribus/pslib.h
==============================================================================
--- branches/Version135/Scribus/scribus/pslib.h (original)
+++ branches/Version135/Scribus/scribus/pslib.h Wed Jul  6 20:29:19 2011
@@ -106,8 +106,8 @@
 		virtual void PS_strokespot(QString color, double shade);
 		virtual void PS_fill_stroke();
 		virtual void PS_newpath();
-		virtual void PS_MultiRadGradient(double w, double h, double x, double y, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades);
-		virtual void PS_MultiLinGradient(double w, double h, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades);
+		virtual void PS_MultiRadGradient(double w, double h, double x, double y, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades, bool fillRule);
+		virtual void PS_MultiLinGradient(double w, double h, QList<double> Stops, QStringList Colors, QStringList colorNames, QList<int> colorShades, bool fillRule);
 		virtual void PS_show(double x, double y);
 		virtual void PS_showSub(uint chr, QString font, double size, bool stroke);
 		virtual void PS_show_xyG(QString font, uint gl, double x, double y, QString colorName, double shade);




More information about the scribus-commit mailing list