r17889 by fschmid - Fixed bug in the pdf exporter regarding gradient fills in patterns.

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 21 20:22:15 UTC 2012


Author: fschmid
Date: Wed Nov 21 20:22:15 2012
New Revision: 17889

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17889
Log:
Fixed bug in the pdf exporter regarding gradient fills in patterns.

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

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17889&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Wed Nov 21 20:22:15 2012
@@ -2554,8 +2554,12 @@
 								tmpD += "q\n";
 								tmpD +=  "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(ite->height() - embedded->gYpos)+" cm\n";
 								QString output;
+								if (inPattern > 0)
+									patternStackPos.push(QPointF(embedded->gXpos, -(embedded->gYpos - ite->height())));
 								if (!PDF_ProcessItem(output, embedded, pag, pag->pageNr(), true))
 									return "";
+								if (inPattern)
+									patternStackPos.pop();
 								tmpD += output;
 								tmpD += "Q\n";
 							}
@@ -4159,6 +4163,7 @@
 				trans.translate(0.0, -ite->height());
 	//			trans.translate(pat.items.at(0)->gXpos, -pat.items.at(0)->gYpos);
 				tmp += FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n";
+				groupStackPos.push(QPointF(0, ite->height()));
 				for (int em = 0; em < pat.items.count(); ++em)
 				{
 					PageItem* embedded = pat.items.at(em);
@@ -4170,6 +4175,7 @@
 					tmpD += output;
 					tmpD += "Q\n";
 				}
+				groupStackPos.pop();
 				if (Options.Version >= PDFOptions::PDFVersion_14 || Options.Version == PDFOptions::PDFVersion_X4)
 					tmp += Write_TransparencyGroup(ite->fillTransparency(), ite->fillBlendmode(), tmpD, ite);
 				else
@@ -4202,8 +4208,12 @@
 					tmpD += "q\n";
 					tmpD +=  "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(ite->height() - embedded->gYpos)+" cm\n";
 					QString output;
+					if (inPattern > 0)
+						patternStackPos.push(QPointF(embedded->gXpos, -(embedded->gYpos - ite->height())));
 					if (!PDF_ProcessItem(output, embedded, pag, PNr, true))
 						return "";
+					if (inPattern > 0)
+						patternStackPos.pop();
 					tmpD += output;
 					tmpD += "Q\n";
 				}
@@ -6183,12 +6193,14 @@
 		tmp2 += "q\n";
 		tmp2 +=  "1 0 0 1 "+FToStr(item->gXpos)+" "+FToStr(-(item->gYpos - pat->height))+" cm\n";
 		item->setXYPos(item->xPos() + ActPageP->xOffset(), item->yPos() + ActPageP->yOffset(), true);
+		patternStackPos.push(QPointF(item->gXpos, -(item->gYpos - pat->height)));
 		inPattern++;
 		if (!PDF_ProcessItem(tmpOut, item, doc.DocPages.at(0), 0, true, true))
 			return false;
 		tmp2 += tmpOut;
 		item->setXYPos(item->xPos() - ActPageP->xOffset(), item->yPos() - ActPageP->yOffset(), true);
 		inPattern--;
+		patternStackPos.pop();
 		tmp2 += "Q\n";
 	}
 	if (Options.Compress)
@@ -6640,6 +6652,11 @@
 			mpa.rotate(-c->rotation());
 		}
 	}
+	else
+	{
+		if (patternStackPos.count() != 0)
+			mpa.translate(patternStackPos.top().x(), patternStackPos.top().y());
+	}
 	PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
 	PutDoc("/Shading "+QString::number(shadeObject)+" 0 R\n");
 	PutDoc(">>\nendobj\n");
@@ -6960,6 +6977,11 @@
 			mpa.translate(c->xPos() - ActPageP->xOffset(), ActPageP->height() - (c->yPos() - ActPageP->yOffset()));
 			mpa.rotate(-c->rotation());
 		}
+	}
+	else
+	{
+		if (patternStackPos.count() != 0)
+			mpa.translate(patternStackPos.top().x(), patternStackPos.top().y());
 	}
 	PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
 	PutDoc("/Shading "+QString::number(shadeObject)+" 0 R\n");
@@ -7373,6 +7395,11 @@
 			mpa.rotate(-c->rotation());
 		}
 	}
+	else
+	{
+		if (patternStackPos.count() != 0)
+			mpa.translate(patternStackPos.top().x(), patternStackPos.top().y());
+	}
 	PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
 	PutDoc("/Shading "+QString::number(shadeObject)+" 0 R\n");
 	PutDoc(">>\nendobj\n");
@@ -7704,6 +7731,11 @@
 			mpa.rotate(-c->rotation());
 		}
 	}
+	else
+	{
+		if (patternStackPos.count() != 0)
+			mpa.translate(patternStackPos.top().x(), patternStackPos.top().y());
+	}
 	PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
 	PutDoc("/Shading "+QString::number(shadeObject)+" 0 R\n");
 	PutDoc(">>\nendobj\n");
@@ -7827,6 +7859,11 @@
 			mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
 			mpa.rotate(-currItem->rotation());
 		}
+	}
+	else
+	{
+		if (patternStackPos.count() != 0)
+			mpa.translate(patternStackPos.top().x(), patternStackPos.top().y());
 	}
 	if (Gskew == 90)
 		Gskew = 1;

Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17889&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Wed Nov 21 20:22:15 2012
@@ -306,6 +306,7 @@
 	QMap<QString, QMap<uint, uint> > Type3Fonts;
 	QString xmpPacket;
 	QStack<QPointF> groupStackPos;
+	QStack<QPointF> patternStackPos;
 
 protected slots:
 	void cancelRequested();




More information about the scribus-commit mailing list