r18734 by jghali - #11884: PDF export ignores master page elements
scribus-commit
scribus-commit at lists.scribus.net
Thu Jan 16 20:49:27 UTC 2014
Author: jghali
Date: Thu Jan 16 20:49:27 2014
New Revision: 18734
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18734
Log:
#11884: PDF export ignores master page elements
Modified:
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/pdflib_core.h
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/pslib.h
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18734&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Thu Jan 16 20:49:27 2014
@@ -2142,12 +2142,8 @@
if (ite->imageFlippedV())
PutPage("1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n");
if (ite->imageClip.size() != 0)
- {
- PutPage(SetClipPathImage(ite));
- PutPage("h\nW*\nn\n");
- }
- PutPage(SetClipPath(ite));
- PutPage("h\nW*\nn\n");
+ PutPage(SetImagePathAndClip(ite));
+ PutPage(SetPathAndClip(ite, true));
if ((ite->PictureIsAvailable) && (!ite->Pfile.isEmpty()))
{
if (!PDF_Image(ite, ite->Pfile, ite->imageXScale(), ite->imageYScale(), ite->imageXOffset(), -ite->imageYOffset(), false, ite->IProfile, ite->UseEmbedded, ite->IRender, &tmpOut))
@@ -2167,7 +2163,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- PutPage(HandleBrushPattern(ite, path, pag, pag->pageNr()));
+ PutPage(handleBrushPattern(ite, path, pag, pag->pageNr()));
}
else
{
@@ -2223,7 +2219,7 @@
QPainterPath path;
path.moveTo(0, 0);
path.lineTo(ite->width(), 0);
- PutPage(HandleBrushPattern(ite, path, pag, pag->pageNr()));
+ PutPage(handleBrushPattern(ite, path, pag, pag->pageNr()));
}
else
{
@@ -2330,7 +2326,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- PutPage(HandleBrushPattern(ite, path, pag, pag->pageNr()));
+ PutPage(handleBrushPattern(ite, path, pag, pag->pageNr()));
}
else
{
@@ -2420,7 +2416,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- PutPage(HandleBrushPattern(ite, path, pag, pag->pageNr()));
+ PutPage(handleBrushPattern(ite, path, pag, pag->pageNr()));
}
else
{
@@ -2508,8 +2504,7 @@
QString tmpD = "";
ScPattern pat = doc.docPatterns[ite->pattern()];
PutPage("q\n");
- PutPage(SetClipPath(ite));
- PutPage(ite->fillRule ? "h W* n\n" : "h W n\n");
+ PutPage(SetPathAndClip(ite));
if (ite->imageFlippedH())
PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
if (ite->imageFlippedV())
@@ -2542,8 +2537,7 @@
{
QString tmpD = "";
PutPage("q\n");
- PutPage(SetClipPath(ite));
- PutPage(ite->fillRule ? "h W* n\n" : "h W n\n");
+ PutPage(SetPathAndClip(ite));
if (ite->imageFlippedH())
PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
if (ite->imageFlippedV())
@@ -2551,7 +2545,7 @@
QTransform trans;
trans.scale(ite->width() / ite->groupWidth, ite->height() / ite->groupHeight);
trans.translate(0.0, -ite->height());
- trans.translate(ite->groupItemList.at(0)->gXpos, -ite->groupItemList.at(0)->gYpos);
+ //trans.translate(ite->groupItemList.at(0)->gXpos, -ite->groupItemList.at(0)->gYpos);
PutPage(FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n");
for (int em = 0; em < ite->groupItemList.count(); ++em)
{
@@ -2561,7 +2555,7 @@
QString output;
if (inPattern > 0)
patternStackPos.push(QPointF(embedded->gXpos, -(embedded->gYpos - ite->height())));
- if (!PDF_ProcessItem(output, embedded, pag, pag->pageNr(), true))
+ if (!PDF_ProcessItem(output, embedded, pag, pag->pageNr(), true, true))
return "";
if (inPattern)
patternStackPos.pop();
@@ -3643,12 +3637,8 @@
if (ite->imageFlippedV())
tmp += "1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n";
if (ite->imageClip.size() != 0)
- {
- tmp += SetClipPathImage(ite);
- tmp += "h\nW*\nn\n";
- }
- tmp += SetClipPath(ite);
- tmp += "h\nW*\nn\n";
+ tmp += SetImagePathAndClip(ite);
+ tmp += SetPathAndClip(ite, true);
if ((ite->PictureIsAvailable) && (!ite->Pfile.isEmpty()))
{
if (!PDF_Image(ite, ite->Pfile, ite->imageXScale(), ite->imageYScale(), ite->imageXOffset(), -ite->imageYOffset(), false, ite->IProfile, ite->UseEmbedded, ite->IRender, &tmpOut))
@@ -3668,7 +3658,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -3773,7 +3763,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -3827,7 +3817,7 @@
QPainterPath path;
path.moveTo(0, 0);
path.lineTo(ite->width(), 0);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -3935,7 +3925,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -4026,7 +4016,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -4121,7 +4111,7 @@
if (ite->patternStrokePath)
{
QPainterPath path = ite->PoLine.toQPainterPath(false);
- tmp += HandleBrushPattern(ite, path, pag, PNr);
+ tmp += handleBrushPattern(ite, path, pag, PNr);
}
else
{
@@ -4181,11 +4171,7 @@
QString tmpD = "";
ScPattern pat = doc.docPatterns[ite->pattern()];
tmp += "q\n";
- tmp += SetClipPath(ite);
- if (ite->fillRule)
- tmp += "h W* n\n";
- else
- tmp += "h W n\n";
+ tmp += SetPathAndClip(ite);
if (ite->imageFlippedH())
tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
if (ite->imageFlippedV())
@@ -4220,11 +4206,7 @@
{
QString tmpD = "";
tmp += "q\n";
- tmp += SetClipPath(ite);
- if (ite->fillRule)
- tmp += "h W* n\n";
- else
- tmp += "h W n\n";
+ tmp += SetPathAndClip(ite);
if (ite->imageFlippedH())
tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
if (ite->imageFlippedV())
@@ -4508,7 +4490,7 @@
return tmp;
}
-QString PDFLibCore::HandleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr)
+QString PDFLibCore::handleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr)
{
QString tmp;
tmp = "";
@@ -5744,129 +5726,153 @@
return tmp;
}
-QString PDFLibCore::SetClipPathImage(PageItem *ite)
-{
- QString tmp("");
- if (ite->imageClip.size() > 3)
- {
- bool nPath = true;
- for (int poi=0; poi<ite->imageClip.size()-3; poi += 4)
- {
- if (ite->imageClip.point(poi).x() > 900000)
- {
- tmp += "h\n";
- nPath = true;
- continue;
- }
- FPoint np, np1, np2, np3;
- if (nPath)
- {
- np = ite->imageClip.point(poi);
- tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
- nPath = false;
- }
- np = ite->imageClip.point(poi);
- np1 = ite->imageClip.point(poi+1);
- np2 = ite->imageClip.point(poi+3);
- np3 = ite->imageClip.point(poi+2);
- if ((np == np1) && (np2 == np3))
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
- else
- {
- tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
- tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
- }
- }
- }
- return tmp;
-}
-
QString PDFLibCore::SetClipPath(PageItem *ite, bool poly)
{
- QString tmp("");
+ QString tmp;
FPoint np, np1, np2, np3, np4, firstP;
bool nPath = true;
bool first = true;
- if (ite->PoLine.size() > 3)
- {
- for (int poi=0; poi<ite->PoLine.size()-3; poi += 4)
- {
- if (ite->PoLine.point(poi).x() > 900000)
- {
- nPath = true;
- continue;
- }
- if (nPath)
- {
- np = ite->PoLine.point(poi);
- if ((!first) && (poly) && (np4 == firstP))
- tmp += "h\n";
- tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
- nPath = false;
- first = false;
- firstP = np;
- np4 = np;
- }
+ if (ite->PoLine.size() <= 3)
+ return tmp;
+
+ for (int poi=0; poi<ite->PoLine.size()-3; poi += 4)
+ {
+ if (ite->PoLine.point(poi).x() > 900000)
+ {
+ nPath = true;
+ continue;
+ }
+ if (nPath)
+ {
np = ite->PoLine.point(poi);
- np1 = ite->PoLine.point(poi+1);
- np2 = ite->PoLine.point(poi+3);
- np3 = ite->PoLine.point(poi+2);
- if ((np == np1) && (np2 == np3))
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
- else
- {
- tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
- tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
- }
- np4 = np3;
- }
+ if ((!first) && (poly) && (np4 == firstP))
+ tmp += "h\n";
+ tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
+ nPath = false;
+ first = false;
+ firstP = np;
+ np4 = np;
+ }
+ np = ite->PoLine.point(poi);
+ np1 = ite->PoLine.point(poi+1);
+ np2 = ite->PoLine.point(poi+3);
+ np3 = ite->PoLine.point(poi+2);
+ if ((np == np1) && (np2 == np3))
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
+ else
+ {
+ tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
+ tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
+ }
+ np4 = np3;
}
return tmp;
}
QString PDFLibCore::SetClipPathArray(FPointArray *ite, bool poly)
{
- QString tmp("");
+ QString tmp;
FPoint np, np1, np2, np3, np4, firstP;
bool nPath = true;
bool first = true;
- if (ite->size() > 3)
- {
- for (int poi=0; poi<ite->size()-3; poi += 4)
- {
- if (ite->point(poi).x() > 900000)
- {
- nPath = true;
- continue;
- }
- if (nPath)
- {
- np = ite->point(poi);
- if ((!first) && (poly) && (np4 == firstP))
- tmp += "h\n";
- tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
- nPath = false;
- first = false;
- firstP = np;
- np4 = np;
- }
+ if (ite->size() <= 3)
+ return tmp;
+
+ for (int poi=0; poi<ite->size()-3; poi += 4)
+ {
+ if (ite->point(poi).x() > 900000)
+ {
+ nPath = true;
+ continue;
+ }
+ if (nPath)
+ {
np = ite->point(poi);
- np1 = ite->point(poi+1);
- np2 = ite->point(poi+3);
- np3 = ite->point(poi+2);
- if ((np == np1) && (np2 == np3))
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
- else
- {
- tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
- tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
- tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
- }
- np4 = np3;
- }
- }
+ if ((!first) && (poly) && (np4 == firstP))
+ tmp += "h\n";
+ tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
+ nPath = false;
+ first = false;
+ firstP = np;
+ np4 = np;
+ }
+ np = ite->point(poi);
+ np1 = ite->point(poi+1);
+ np2 = ite->point(poi+3);
+ np3 = ite->point(poi+2);
+ if ((np == np1) && (np2 == np3))
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
+ else
+ {
+ tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
+ tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
+ }
+ np4 = np3;
+ }
+ return tmp;
+}
+
+QString PDFLibCore::SetClipPathImage(PageItem *ite)
+{
+ QString tmp;
+ if (ite->imageClip.size() <= 3)
+ return tmp;
+
+ bool nPath = true;
+ for (int poi=0; poi<ite->imageClip.size()-3; poi += 4)
+ {
+ if (ite->imageClip.point(poi).x() > 900000)
+ {
+ tmp += "h\n";
+ nPath = true;
+ continue;
+ }
+ FPoint np, np1, np2, np3;
+ if (nPath)
+ {
+ np = ite->imageClip.point(poi);
+ tmp += FToStr(np.x())+" "+FToStr(-np.y())+" m\n";
+ nPath = false;
+ }
+ np = ite->imageClip.point(poi);
+ np1 = ite->imageClip.point(poi+1);
+ np2 = ite->imageClip.point(poi+3);
+ np3 = ite->imageClip.point(poi+2);
+ if ((np == np1) && (np2 == np3))
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" l\n";
+ else
+ {
+ tmp += FToStr(np1.x())+" "+FToStr(-np1.y())+" ";
+ tmp += FToStr(np2.x())+" "+FToStr(-np2.y())+" ";
+ tmp += FToStr(np3.x())+" "+FToStr(-np3.y())+" c\n";
+ }
+ }
+ return tmp;
+}
+
+QString PDFLibCore::SetImagePathAndClip(PageItem *item)
+{
+ QString tmp = SetClipPathImage(item);
+ if (tmp.length() > 0)
+ tmp += "h W* n\n";
+ return tmp;
+}
+
+QString PDFLibCore::SetPathAndClip(PageItem *item)
+{
+ QString tmp = SetClipPath(item);
+ if (tmp.length() > 0)
+ tmp += (item->fillRule ? "h W* n\n" : "h W n\n");
+ return tmp;
+}
+
+QString PDFLibCore::SetPathAndClip(PageItem *item, bool fillRule)
+{
+ QString tmp = SetClipPath(item);
+ if (tmp.length() > 0)
+ tmp += (fillRule ? "h W* n\n" : "h W n\n");
return tmp;
}
@@ -7492,8 +7498,7 @@
tmp += "/"+ShName+" gs\n";
}
tmp += putColor(colorNames.last(), colorShades.last(), true);
- tmp += SetClipPath(c);
- tmp += (c->fillRule ? "h\nW*\nn\n" : "h\nW\nn\n");
+ tmp += SetPathAndClip(c);
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";
@@ -9426,7 +9431,6 @@
Bvie->SetAction(currItem, "/XYZ 0 "+FToStr(ypos)+" 0]");
BookMinUse = true;
}
-
bool PDFLibCore::PDF_EmbeddedPDF(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN, const QString& Profil, bool Embedded, int Intent, ShIm& imgInfo, QString* output)
{
Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18734&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Thu Jan 16 20:49:27 2014
@@ -114,10 +114,15 @@
void CalcUserKey(const QString & User, int Permission);
QString FitKey(const QString & pass);
- QString setStrokeMulti(struct SingleLine *sl);
+ QString SetClipPath(PageItem *ite, bool poly = true);
QString SetClipPathArray(FPointArray *ite, bool poly = true);
QString SetClipPathImage(PageItem *ite);
- QString SetClipPath(PageItem *ite, bool poly = true);
+
+ QString SetImagePathAndClip(PageItem *item);
+ QString SetPathAndClip(PageItem *item);
+ QString SetPathAndClip(PageItem *item, bool fillRule);
+
+ QString setStrokeMulti(struct SingleLine *sl);
QString SetColor(const QString& farbe, double Shade);
QString SetColor(const ScColor& farbe, double Shade);
QString SetGradientColor(const QString& farbe, double Shade);
@@ -150,14 +155,8 @@
QByteArray ComputeRC4Key(int ObjNum);
bool PDF_ProcessItem(QString& output, PageItem* ite, const ScPage* pag, uint PNr, bool embedded = false, bool pattern = false);
- QString paintBorder(const TableBorder& border, const QPointF& start, const QPointF& end, const QPointF& startOffsetFactors, const QPointF& endOffsetFactors);
- QString HandleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr);
- QString drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex);
void PDF_Bookmark(PageItem *currItem, double ypos);
bool PDF_PatternFillStroke(QString& output, PageItem *currItem, int kind = 0, bool forArrow = false);
- quint32 encode32dVal(double val);
- quint16 encode16dVal(double val);
- void encodeColor(QDataStream &vs, QString colName, int colShade, QStringList &spotColorSet, bool spotMode);
bool PDF_MeshGradientFill(QString& output, PageItem *currItem);
bool PDF_PatchMeshGradientFill(QString& output, PageItem *c);
bool PDF_DiamondGradientFill(QString& output, PageItem *currItem);
@@ -171,7 +170,6 @@
void PDF_RadioButtons();
uint PDF_RadioButton(PageItem *ite, uint parent, QString parentName);
bool PDF_Annotation(PageItem *ite, uint PNr);
- QString createBorderAppearance(PageItem *ite);
void PDF_Form(const QString& im);
void PDF_xForm(uint objNr, double w, double h, QString im);
bool PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN = false, const QString& Profil = "", bool Embedded = false, eRenderIntent Intent = Intent_Relative_Colorimetric, QString* output = NULL);
@@ -181,9 +179,17 @@
void copyPoDoFoDirect(const PoDoFo::PdfVariant* obj, QList<PoDoFo::PdfReference>& referencedObjects, QMap<PoDoFo::PdfReference, uint>& importedObjects);
#endif
+ quint32 encode32dVal(double val);
+ quint16 encode16dVal(double val);
+ void encodeColor(QDataStream &vs, QString colName, int colShade, QStringList &spotColorSet, bool spotMode);
+
+ QString drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex);
+ QString createBorderAppearance(PageItem *ite);
+ QString paintBorder(const TableBorder& border, const QPointF& start, const QPointF& end, const QPointF& startOffsetFactors, const QPointF& endOffsetFactors);
+ QString handleBrushPattern(PageItem* ite, QPainterPath &path, const ScPage* pag, uint PNr);
+
void generateXMP(const QString& timeStamp);
int bytesWritten() { return Spool.pos(); }
-
QString Content;
QString ErrorMessage;
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18734&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Thu Jan 16 20:49:27 2014
@@ -1732,14 +1732,8 @@
PS_scale(1, -1);
}
if (c->imageClip.size() != 0)
- {
- SetClipPath(&c->imageClip);
- PS_closepath();
- PS_clip(true);
- }
- SetClipPath(&c->PoLine);
- PS_closepath();
- PS_clip(true);
+ SetPathAndClip(c->imageClip, true);
+ SetPathAndClip(c->PoLine, true);
if ((c->PictureIsAvailable) && (!c->Pfile.isEmpty()))
{
bool imageOk = false;
@@ -2548,9 +2542,7 @@
{
ScPattern pat = m_Doc->docPatterns[c->pattern()];
PS_save();
- SetClipPath(&c->PoLine);
- PS_closepath();
- PS_clip(c->fillRule);
+ SetPathAndClip(c->PoLine, c->fillRule);
if (c->imageFlippedH())
{
PS_translate(c->width(), 0);
@@ -2577,9 +2569,7 @@
break;
case PageItem::Group:
PS_save();
- SetClipPath(&c->PoLine);
- PS_closepath();
- PS_clip(c->fillRule);
+ SetPathAndClip(c->PoLine, c->fillRule);
if (c->imageFlippedH())
{
PS_translate(c->width(), 0);
@@ -5447,36 +5437,46 @@
FPoint np, np1, np2, np3, np4, firstP;
bool nPath = true;
bool first = true;
- if (c->size() > 3)
- {
- for (int poi=0; poi < c->size()-3; poi += 4)
- {
- if (c->point(poi).x() > 900000)
- {
- nPath = true;
- continue;
- }
- if (nPath)
- {
- np = c->point(poi);
- if ((!first) && (poly) && (np4 == firstP))
- PS_closepath();
- PS_moveto(np.x(), -np.y());
- nPath = false;
- first = false;
- firstP = np;
- np4 = np;
- }
+ if (c->size() <= 3)
+ return;
+
+ for (int poi=0; poi < c->size()-3; poi += 4)
+ {
+ if (c->point(poi).x() > 900000)
+ {
+ nPath = true;
+ continue;
+ }
+ if (nPath)
+ {
np = c->point(poi);
- np1 = c->point(poi+1);
- np2 = c->point(poi+3);
- np3 = c->point(poi+2);
- if ((np == np1) && (np2 == np3))
- PS_lineto(np3.x(), -np3.y());
- else
- PS_curve(np1.x(), -np1.y(), np2.x(), -np2.y(), np3.x(), -np3.y());
- np4 = np3;
- }
+ if ((!first) && (poly) && (np4 == firstP))
+ PS_closepath();
+ PS_moveto(np.x(), -np.y());
+ nPath = false;
+ first = false;
+ firstP = np;
+ np4 = np;
+ }
+ np = c->point(poi);
+ np1 = c->point(poi+1);
+ np2 = c->point(poi+3);
+ np3 = c->point(poi+2);
+ if ((np == np1) && (np2 == np3))
+ PS_lineto(np3.x(), -np3.y());
+ else
+ PS_curve(np1.x(), -np1.y(), np2.x(), -np2.y(), np3.x(), -np3.y());
+ np4 = np3;
+ }
+}
+
+void PSLib::SetPathAndClip(FPointArray &path, bool clipRule)
+{
+ if (path.size() > 3)
+ {
+ SetClipPath(&path);
+ PS_closepath();
+ PS_clip(clipRule);
}
}
Modified: trunk/Scribus/scribus/pslib.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18734&path=/trunk/Scribus/scribus/pslib.h
==============================================================================
--- trunk/Scribus/scribus/pslib.h (original)
+++ trunk/Scribus/scribus/pslib.h Thu Jan 16 20:49:27 2014
@@ -128,6 +128,7 @@
virtual void GetBleeds(ScPage* page, double& left, double& right);
virtual void GetBleeds(ScPage* page, double& left, double& right, double& bottom, double& top);
virtual void SetClipPath(FPointArray *c, bool poly = true);
+ virtual void SetPathAndClip(FPointArray &c, bool clipRule);
virtual void HandleBrushPattern(PageItem *c, QPainterPath &path, ScPage* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master);
virtual void HandleStrokePattern(PageItem *c);
virtual void HandleMeshGradient(PageItem* c, bool gcr);
More information about the scribus-commit
mailing list