r14276 by fschmid - Fixed Bug-Nr. 4637: "Option to mirror patterns"
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 10 15:31:40 CET 2009
Revision: 14276
Author: fschmid
Date: 2009-11-10T07:45:27.976274Z
Commit message: Fixed Bug-Nr. 4637: "Option to mirror patterns"
Changeset:
M /trunk/Scribus/scribus/scpainter.cpp
M /trunk/Scribus/scribus/ui/propertiespalette.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/scribusXml.cpp
M /trunk/Scribus/scribus/scpainter.h
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/pageitem.h
M /trunk/Scribus/scribus/pageitem_line.cpp
M /trunk/Scribus/scribus/plugins/tools/lenseffects/lensdialog.cpp
M /trunk/Scribus/scribus/scribusview.cpp
M /trunk/Scribus/scribus/scribusdoc.h
M /trunk/Scribus/scribus/pageitem_polyline.cpp
M /trunk/Scribus/scribus/scribusstructs.h
M /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
M /trunk/Scribus/scribus/pdflib_core.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/pslib.cpp
M /trunk/Scribus/scribus/pageitem_textframe.cpp
M /trunk/Scribus/scribus/pageitem_pathtext.cpp
M /trunk/Scribus/scribus/ui/cpalette.cpp
M /trunk/Scribus/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
M /trunk/Scribus/scribus/ui/cpalette.h
M /trunk/Scribus/scribus/pageitem_desaxe.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 14275)
+++ scribus/pdflib_core.cpp (revision 14276)
@@ -5679,16 +5679,27 @@
mpa.rotate(-currItem->rotation());
}
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ bool mirrorX, mirrorY;
if (stroke)
+ {
currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ currItem->strokePatternFlip(mirrorX, mirrorY);
+ }
else
+ {
currItem->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ currItem->patternFlip(mirrorX, mirrorY);
+ }
mpa.translate(-currItem->lineWidth() / 2.0, currItem->lineWidth() / 2.0);
mpa.translate(patternOffsetX, -patternOffsetY);
mpa.rotate(-patternRotation);
mpa.shear(patternSkewX, -patternSkewY);
mpa.scale(pat->scaleX, pat->scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
PutDoc("/XStep "+FToStr(pat->width)+"\n");
PutDoc("/YStep "+FToStr(pat->height)+"\n");
@@ -6279,11 +6290,17 @@
}
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
currItem->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ currItem->patternFlip(mirrorX, mirrorY);
mpa.translate(patternOffsetX, -patternOffsetY);
mpa.rotate(-patternRotation);
mpa.shear(patternSkewX, -patternSkewY);
mpa.scale(pat->scaleX, pat->scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
PutDoc("/Matrix ["+FToStr(mpa.m11())+" "+FToStr(mpa.m12())+" "+FToStr(mpa.m21())+" "+FToStr(mpa.m22())+" "+FToStr(mpa.dx())+" "+FToStr(mpa.dy())+"]\n");
PutDoc("/XStep "+FToStr(pat->width)+"\n");
PutDoc("/YStep "+FToStr(pat->height)+"\n");
Index: scribus/pageitem_line.cpp
===================================================================
--- scribus/pageitem_line.cpp (revision 14275)
+++ scribus/pageitem_line.cpp (revision 14276)
@@ -60,7 +60,7 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
}
else if (GrTypeStroke > 0)
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14275)
+++ scribus/scribusdoc.cpp (revision 14276)
@@ -5789,7 +5789,7 @@
}
}
-void ScribusDoc::itemSelection_SetItemPatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void ScribusDoc::itemSelection_SetItemPatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
@@ -5800,6 +5800,7 @@
{
currItem = m_Selection->itemAt(a);
currItem->setPatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY);
+ currItem->setPatternFlip(mirrorX, mirrorY);
currItem->update();
}
m_updateManager.setUpdatesEnabled();
@@ -5825,7 +5826,7 @@
}
}
-void ScribusDoc::itemSelection_SetItemStrokePatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void ScribusDoc::itemSelection_SetItemStrokePatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
uint selectedItemCount=m_Selection->count();
if (selectedItemCount != 0)
@@ -5836,6 +5837,7 @@
{
currItem = m_Selection->itemAt(a);
currItem->setStrokePatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY);
+ currItem->setStrokePatternFlip(mirrorX, mirrorY);
currItem->update();
}
m_updateManager.setUpdatesEnabled();
Index: scribus/pageitem_polyline.cpp
===================================================================
--- scribus/pageitem_polyline.cpp (revision 14275)
+++ scribus/pageitem_polyline.cpp (revision 14276)
@@ -99,7 +99,7 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
}
else if (GrTypeStroke > 0)
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp (revision 14275)
+++ scribus/scribusXml.cpp (revision 14276)
@@ -179,6 +179,8 @@
OB->patternRotation = attrAsDbl(attrs, "pRotation", 0.0);
OB->patternSkewX = attrAsDbl(attrs, "pSkewX", 0.0);
OB->patternSkewY = attrAsDbl(attrs, "pSkewY", 0.0);
+ OB->patternMirrorX = attrAsBool(attrs, "pMirrorX", false);
+ OB->patternMirrorY = attrAsBool(attrs, "pMirrorY", false);
}
else
{
@@ -1227,6 +1229,8 @@
double patternRotationS;
double patternSkewXS;
double patternSkewYS;
+ bool patternMirrorX;
+ bool patternMirrorY;
QString gradNameS;
while(!sReader.atEnd() && !sReader.hasError())
{
@@ -1314,6 +1318,8 @@
patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
+ patternMirrorX = attrAsBool(attrs, "pMirrorXS", false);
+ patternMirrorY = attrAsBool(attrs, "pMirrorYS", false);
}
if (inItem && sReader.isStartElement() && tagName == "ITEXT")
{
@@ -1478,6 +1484,7 @@
Neu->doOverprint = doOverprint;
Neu->setStrokePattern(StrokePattern);
Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS);
+ Neu->setStrokePatternFlip(patternMirrorX, patternMirrorY);
storyText.setDefaultStyle(Neu->itemText.defaultStyle());
if (Neu->asLatexFrame())
{
@@ -1654,6 +1661,8 @@
double patternRotationS;
double patternSkewXS;
double patternSkewYS;
+ bool patternMirrorXS;
+ bool patternMirrorYS;
QString gradNameS;
int lowResType = 1;
int actualPageNumber = 0;
@@ -1685,6 +1694,8 @@
patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
+ patternMirrorXS = attrAsBool(attrs, "pMirrorXS", false);
+ patternMirrorYS = attrAsBool(attrs, "pMirrorYS", false);
inlineF = attrAsBool(attrs1, "isInlineImage", false);
inlineImageData.resize(0);
QString dat = attrAsString(attrs1, "ImageData", "");
@@ -1829,6 +1840,7 @@
Neu->setStrokeGradient(gradNameS);
Neu->setStrokePattern(StrokePattern);
Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS);
+ Neu->setStrokePatternFlip(patternMirrorXS, patternMirrorYS);
Neu->setXYPos(Neu->xPos() - doc->currentPage()->xOffset(), Neu->yPos() - doc->currentPage()->yOffset(), true);
storyText.setDefaultStyle(Neu->itemText.defaultStyle());
Neu->itemText = storyText;
@@ -2403,6 +2415,8 @@
writer.writeAttribute("pattern", item->pattern());
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ item->patternFlip(mirrorX, mirrorY);
writer.writeAttribute("pScaleX" , patternScaleX);
writer.writeAttribute("pScaleY" , patternScaleY);
writer.writeAttribute("pOffsetX" , patternOffsetX);
@@ -2410,6 +2424,8 @@
writer.writeAttribute("pRotation", patternRotation);
writer.writeAttribute("pSkewX" , patternSkewX);
writer.writeAttribute("pSkewY" , patternSkewY);
+ writer.writeAttribute("pMirrorX" , mirrorX);
+ writer.writeAttribute("pMirrorY" , mirrorY);
}
else
{
@@ -2453,6 +2469,8 @@
writer.writeAttribute("patternS", item->strokePattern());
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ item->strokePatternFlip(mirrorX, mirrorY);
writer.writeAttribute("pScaleXS", patternScaleX);
writer.writeAttribute("pScaleYS", patternScaleY);
writer.writeAttribute("pOffsetXS", patternOffsetX);
@@ -2460,6 +2478,8 @@
writer.writeAttribute("pRotationS", patternRotation);
writer.writeAttribute("pSkewXS" , patternSkewX);
writer.writeAttribute("pSkewYS" , patternSkewY);
+ writer.writeAttribute("pMirrorXS" , mirrorX);
+ writer.writeAttribute("pMirrorYS" , mirrorY);
}
if (item->asLatexFrame())
{
Index: scribus/pageitem_pathtext.cpp
===================================================================
--- scribus/pageitem_pathtext.cpp (revision 14275)
+++ scribus/pageitem_pathtext.cpp (revision 14276)
@@ -106,7 +106,7 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
}
else if (GrTypeStroke > 0)
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h (revision 14275)
+++ scribus/pageitem.h (revision 14276)
@@ -707,6 +707,8 @@
* @brief Set the fill pattern transformation of the object.
*/
void setPatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ void setPatternFlip(bool flipX, bool flipY);
+ void patternFlip(bool &flipX, bool &flipY);
/** @brief Get the (name of the) fill color of the object */
QString fillColor() const { return fillColorVal; }
@@ -788,6 +790,8 @@
* @brief Set the stroke pattern transformation of the object.
*/
void setStrokePatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ void setStrokePatternFlip(bool flipX, bool flipY);
+ void strokePatternFlip(bool &flipX, bool &flipY);
/** @brief Set the QColor for the line */
void setLineQColor();
@@ -1162,6 +1166,8 @@
double patternRotation;
double patternSkewX;
double patternSkewY;
+ bool patternMirrorX;
+ bool patternMirrorY;
/**
* @brief Fill color name
@@ -1352,6 +1358,8 @@
double patternStrokeRotation;
double patternStrokeSkewX;
double patternStrokeSkewY;
+ bool patternStrokeMirrorX;
+ bool patternStrokeMirrorY;
/**
@@ -1383,7 +1391,7 @@
void rotation(double); //Degrees rotation
void colors(QString, QString, double, double); //lineColor, fillColor, lineShade, fillShade
void gradientType(int); //Normal, horizontal, vertical, etc.
- void patternFill(QString, double, double, double, double, double, double, double);
+ void patternFill(QString, double, double, double, double, double, double, double, bool, bool);
void gradientColorUpdate(double, double, double, double, double, double); //Cpal updatespecialgradient
void transparency(double, double); //fillTransparency, lineTransparency
void blendmode(int, int); //fillBlendmode, lineBlendmode
Index: scribus/scribusstructs.h
===================================================================
--- scribus/scribusstructs.h (revision 14275)
+++ scribus/scribusstructs.h (revision 14276)
@@ -83,6 +83,8 @@
double patternRotation;
double patternSkewX;
double patternSkewY;
+ bool patternMirrorX;
+ bool patternMirrorY;
double GrStartX;
double GrStartY;
double GrEndX;
Index: scribus/scpainter.cpp
===================================================================
--- scribus/scpainter.cpp (revision 14275)
+++ scribus/scpainter.cpp (revision 14276)
@@ -930,7 +930,7 @@
{
}
-void ScPainter::setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void ScPainter::setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
m_pattern = pattern;
patternScaleX = scaleX / 100.0;
@@ -940,6 +940,8 @@
patternRotation = rotation;
patternSkewX = skewX;
patternSkewY = skewY;
+ patternMirrorX = mirrorX;
+ patternMirrorY = mirrorY;
}
#ifdef HAVE_CAIRO
@@ -1050,6 +1052,10 @@
qmatrix.shear(-patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX, patternScaleY);
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+ if (patternMirrorX)
+ qmatrix.scale(-1, 1);
+ if (patternMirrorY)
+ qmatrix.scale(1, -1);
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
cairo_matrix_invert(&matrix);
cairo_pattern_set_matrix (m_pat, &matrix);
@@ -1100,6 +1106,10 @@
qmatrix.shear(-patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX, patternScaleY);
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+ if (patternMirrorX)
+ qmatrix.scale(-1, 1);
+ if (patternMirrorY)
+ qmatrix.scale(1, -1);
cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
cairo_matrix_invert(&matrix);
cairo_pattern_set_matrix (m_pat, &matrix);
@@ -1210,6 +1220,10 @@
qmatrix.shear(-patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX, patternScaleY);
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+ if (patternMirrorX)
+ qmatrix.scale(-1, 1);
+ if (patternMirrorY)
+ qmatrix.scale(1, -1);
QBrush brush = QBrush(*m_pattern->getPattern());
brush.setTransform(qmatrix);
// painter.rotate(0.0001); // hack to get Qt-4's strange pattern rendering working
@@ -1264,6 +1278,10 @@
qmatrix.shear(-patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX, patternScaleY);
qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+ if (patternMirrorX)
+ qmatrix.scale(-1, 1);
+ if (patternMirrorY)
+ qmatrix.scale(1, -1);
QBrush brush = QBrush(*m_pattern->getPattern());
brush.setTransform(qmatrix);
// painter.rotate(0.0001); // hack to get Qt-4's strange pattern rendering working
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14275)
+++ scribus/pageitem.cpp (revision 14276)
@@ -191,6 +191,8 @@
patternRotation(other.patternRotation),
patternSkewX(other.patternSkewX),
patternSkewY(other.patternSkewY),
+ patternMirrorX(other.patternMirrorX),
+ patternMirrorY(other.patternMirrorY),
fillColorVal(other.fillColorVal),
lineColorVal(other.lineColorVal),
lineShadeVal(other.lineShadeVal),
@@ -251,6 +253,8 @@
patternStrokeRotation(other.patternStrokeRotation),
patternStrokeSkewX(other.patternStrokeSkewX),
patternStrokeSkewY(other.patternStrokeSkewY),
+ patternStrokeMirrorX(other.patternStrokeMirrorX),
+ patternStrokeMirrorY(other.patternStrokeMirrorY),
gradientStrokeVal(other.gradientStrokeVal),
stroke_gradient(other.stroke_gradient),
GrTypeStroke(other.GrTypeStroke),
@@ -341,6 +345,8 @@
patternRotation = 0;
patternSkewX = 0;
patternSkewY = 0;
+ patternMirrorX = false;
+ patternMirrorY = false;
patternStrokeVal = "";
patternStrokeScaleX = 100;
patternStrokeScaleY = 100;
@@ -349,6 +355,8 @@
patternStrokeRotation = 0;
patternStrokeSkewX = 0;
patternStrokeSkewY = 0;
+ patternStrokeMirrorX = false;
+ patternStrokeMirrorY = false;
m_lineWidth = w2;
Oldm_lineWidth = w2;
PLineArt = Qt::PenStyle(m_Doc->itemToolPrefs.shapeLineStyle);
@@ -1116,7 +1124,7 @@
}
else
{
- p->setPattern(&m_Doc->docPatterns[patternVal], patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternVal], patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternMirrorX, patternMirrorY);
p->setFillMode(ScPainter::Pattern);
}
}
@@ -1252,7 +1260,7 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
p->strokePath();
}
@@ -2409,7 +2417,7 @@
patternSkewY = skewY;
}
-void PageItem::patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const
+void PageItem::patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const
{
scaleX = patternScaleX;
scaleY = patternScaleY;
@@ -2420,6 +2428,18 @@
skewY = patternSkewY;
}
+void PageItem::setPatternFlip(bool flipX, bool flipY)
+{
+ patternMirrorX = flipX;
+ patternMirrorY = flipY;
+}
+
+void PageItem::patternFlip(bool &flipX, bool &flipY)
+{
+ flipX = patternMirrorX;
+ flipY = patternMirrorY;
+}
+
void PageItem::setFillColor(const QString &newColor)
{
QString tmp = newColor;
@@ -2611,8 +2631,20 @@
patternStrokeSkewY = skewY;
}
-void PageItem::strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const
+void PageItem::setStrokePatternFlip(bool flipX, bool flipY)
{
+ patternStrokeMirrorX = flipX;
+ patternStrokeMirrorY = flipY;
+}
+
+void PageItem::strokePatternFlip(bool &flipX, bool &flipY)
+{
+ flipX = patternStrokeMirrorX;
+ flipY = patternStrokeMirrorY;
+}
+
+void PageItem::strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const
+{
scaleX = patternStrokeScaleX;
scaleY = patternStrokeScaleY;
offsetX = patternStrokeOffsetX;
@@ -5172,7 +5204,7 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setFillMode(ScPainter::Pattern);
p->fillPath();
}
@@ -5501,7 +5533,7 @@
//CB unused in 135 connect(this, SIGNAL(colors(QString, QString, double, double)), m_Doc->scMW(), SLOT(setCSMenu()));
// connect(this, SIGNAL(colors(QString, QString, double, double)), pp->Cpal, SLOT(setActFarben(QString, QString, int, int)));
// connect(this, SIGNAL(gradientType(int)), pp->Cpal, SLOT(setActGradient(int)));
- connect(this, SIGNAL(patternFill(QString, double, double, double, double, double, double, double)), pp->Cpal, SLOT(setActPattern(QString, double, double, double, double, double, double, double)));
+ connect(this, SIGNAL(patternFill(QString, double, double, double, double, double, double, double, bool, bool)), pp->Cpal, SLOT(setActPattern(QString, double, double, double, double, double, double, double, bool, bool)));
// connect(this, SIGNAL(gradientColorUpdate(double, double, double, double, double, double)), pp->Cpal, SLOT(setSpecialGradient(double, double, double, double, double, double)));
connect(this, SIGNAL(rotation(double)), pp, SLOT(setR(double)));
// connect(this, SIGNAL(transparency(double, double)), pp->Cpal, SLOT(setActTrans(double, double)));
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 14275)
+++ scribus/scribusdoc.h (revision 14276)
@@ -1222,9 +1222,9 @@
void itemSelection_SetItemBrushShade(int sha);
void itemSelection_SetItemGradFill(int typ);
void itemSelection_SetItemPatternFill(QString pattern);
- void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
void itemSelection_SetItemStrokePattern(QString pattern);
- void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
void undoRedoBegin();
void undoRedoDone();
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp (revision 14275)
+++ scribus/scribusview.cpp (revision 14276)
@@ -3831,6 +3831,7 @@
currItem->setPattern(Buffer->pattern);
currItem->GrType = Buffer->GrType;
currItem->setPatternTransform(Buffer->patternScaleX, Buffer->patternScaleY, Buffer->patternOffsetX, Buffer->patternOffsetY, Buffer->patternRotation, Buffer->patternSkewX, Buffer->patternSkewY);
+ currItem->setPatternFlip(Buffer->patternMirrorX, Buffer->patternMirrorY);
}
else
{
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp (revision 14275)
+++ scribus/pageitem_textframe.cpp (revision 14276)
@@ -2635,7 +2635,7 @@
}
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY);
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
p->setStrokeMode(ScPainter::Pattern);
p->strokePath();
}
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp (revision 14275)
+++ scribus/ui/cpalette.cpp (revision 14276)
@@ -213,6 +213,23 @@
groupSkewLayout->addWidget( spinYSkew, 1, 1 );
frame3Layout->addWidget( groupSkew );
+ groupFlipLayout = new QHBoxLayout();
+ groupFlipLayout->setSpacing( 2 );
+ groupFlipLayout->setMargin( 3 );
+ textLabel15 = new QLabel( this );
+ groupFlipLayout->addWidget( textLabel15 );
+ QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ groupFlipLayout->addItem( spacer );
+ FlipH = new QToolButton( this );
+ FlipH->setIcon(QIcon(loadIcon("16/flip-object-horizontal.png")));
+ FlipH->setCheckable( true );
+ groupFlipLayout->addWidget( FlipH );
+ FlipV = new QToolButton( this );
+ FlipV->setIcon(QIcon(loadIcon("16/flip-object-vertical.png")));
+ FlipV->setCheckable( true );
+ groupFlipLayout->addWidget( FlipV );
+ frame3Layout->addLayout( groupFlipLayout );
+
buttonLayout = new QHBoxLayout;
buttonLayout->setMargin(0);
buttonLayout->setSpacing(5);
@@ -234,6 +251,8 @@
connect(spinYscaling, SIGNAL(valueChanged(double)), this, SLOT(VChange()));
connect(keepScaleRatio, SIGNAL(clicked()), this, SLOT(ToggleKette()));
connect(spinAngle, SIGNAL(valueChanged(double)), this, SLOT(changePatternProps()));
+ connect(FlipH, SIGNAL(clicked()), this, SLOT(changePatternProps()));
+ connect(FlipV, SIGNAL(clicked()), this, SLOT(changePatternProps()));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
}
@@ -266,7 +285,8 @@
groupSkew->setTitle( tr( "Skewing" ) );
textLabel8->setText( tr( "X-Skew:" ) );
textLabel9->setText( tr( "Y-Skew:" ) );
- textLabel7->setText( tr( "Angle" ) );
+ textLabel7->setText( tr( "Angle:" ) );
+ textLabel15->setText( tr( "Flip:" ) );
buttonOk->setText( tr("Close"));
resize(minimumSizeHint());
}
@@ -277,7 +297,9 @@
double b = M_PI / 180.0 * spinYSkew->value();
double sina = tan(a);
double sinb = tan(b);
- emit NewPatternProps(spinXscaling->value(), spinYscaling->value(), spinXoffset->value(), spinYoffset->value(), spinAngle->value(), sina, sinb);
+ bool fH = FlipH->isChecked();
+ bool fV = FlipV->isChecked();
+ emit NewPatternProps(spinXscaling->value(), spinYscaling->value(), spinXoffset->value(), spinYoffset->value(), spinAngle->value(), sina, sinb, fH, fV);
}
void PatternPropsDialog::ToggleKette()
@@ -743,7 +765,7 @@
emit NewPatternS(c->text());
}
-void Cpalette::setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void Cpalette::setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
disconnect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
QList<QListWidgetItem*> itl = patternBoxStroke->findItems(pattern, Qt::MatchExactly);
@@ -761,10 +783,12 @@
m_Pattern_rotationS = rotation;
m_Pattern_skewXS = skewX;
m_Pattern_skewYS = skewY;
+ m_Pattern_mirrorXS = mirrorX;
+ m_Pattern_mirrorYS = mirrorY;
connect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
}
-void Cpalette::setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void Cpalette::setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
QList<QListWidgetItem*> itl = patternBox->findItems(pattern, Qt::MatchExactly);
@@ -782,6 +806,8 @@
m_Pattern_rotation = rotation;
m_Pattern_skewX = skewX;
m_Pattern_skewY = skewY;
+ m_Pattern_mirrorX = mirrorX;
+ m_Pattern_mirrorY = mirrorY;
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
@@ -964,7 +990,9 @@
dia->spinXSkew->setValue(asina / (M_PI / 180.0));
double asinb = atan(m_Pattern_skewY);
dia->spinYSkew->setValue(asinb / (M_PI / 180.0));
- connect(dia, SIGNAL(NewPatternProps(double, double, double, double, double, double, double)), this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double)));
+ dia->FlipH->setChecked(m_Pattern_mirrorX);
+ dia->FlipV->setChecked(m_Pattern_mirrorY);
+ connect(dia, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)));
dia->exec();
m_Pattern_scaleX = dia->spinXscaling->value();
m_Pattern_scaleY = dia->spinYscaling->value();
@@ -977,6 +1005,8 @@
double sinb = tan(b);
m_Pattern_skewX = sina;
m_Pattern_skewY = sinb;
+ m_Pattern_mirrorX = dia->FlipH->isChecked();
+ m_Pattern_mirrorY = dia->FlipV->isChecked();
delete dia;
tabWidget->setCurrentIndex(2);
emit NewGradient(8);
@@ -994,7 +1024,9 @@
dia->spinXSkew->setValue(asina / (M_PI / 180.0));
double asinb = atan(m_Pattern_skewYS);
dia->spinYSkew->setValue(asinb / (M_PI / 180.0));
- connect(dia, SIGNAL(NewPatternProps(double, double, double, double, double double, double)), this, SIGNAL(NewPatternPropsS(double, double, double, double, double double, double)));
+ dia->FlipH->setChecked(m_Pattern_mirrorXS);
+ dia->FlipV->setChecked(m_Pattern_mirrorYS);
+ connect(dia, SIGNAL(NewPatternProps(double, double, double, double, double double, double, bool, bool)), this, SIGNAL(NewPatternPropsS(double, double, double, double, double double, double, bool, bool)));
dia->exec();
m_Pattern_scaleXS = dia->spinXscaling->value();
m_Pattern_scaleYS = dia->spinYscaling->value();
@@ -1007,6 +1039,8 @@
double sinb = tan(b);
m_Pattern_skewXS = sina;
m_Pattern_skewYS = sinb;
+ m_Pattern_mirrorXS = dia->FlipH->isChecked();
+ m_Pattern_mirrorYS = dia->FlipV->isChecked();
delete dia;
}
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h (revision 14275)
+++ scribus/ui/cpalette.h (revision 14276)
@@ -28,6 +28,7 @@
#include <QPointer>
#include <QGroupBox>
#include <QPushButton>
+#include <QToolButton>
#include "scribusapi.h"
#include "gradienteditor.h"
#include "scribusdoc.h"
@@ -90,6 +91,8 @@
ScrSpinBox* spinAngle;
ScrSpinBox* spinXSkew;
ScrSpinBox* spinYSkew;
+ QToolButton* FlipH;
+ QToolButton* FlipV;
public slots:
void languageChange();
@@ -99,7 +102,7 @@
void VChange();
signals:
- void NewPatternProps(double, double, double, double, double, double, double);
+ void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
protected:
QGroupBox* groupOffset;
@@ -114,6 +117,7 @@
QGroupBox* groupSkew;
QLabel* textLabel8;
QLabel* textLabel9;
+ QLabel* textLabel15;
QVBoxLayout* frame3Layout;
QHBoxLayout* groupOffsetLayout;
QGridLayout* groupScaleLayout;
@@ -121,6 +125,7 @@
QHBoxLayout* groupRotationLayout;
QPushButton* buttonOk;
QHBoxLayout* buttonLayout;
+ QHBoxLayout* groupFlipLayout;
};
class SCRIBUS_API Cpalette : public QWidget, Ui::colorPalette
@@ -158,8 +163,8 @@
void selectPatternS(QListWidgetItem *c);
void updatePatternList();
void updateGradientList();
- void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
- void setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
+ void setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
void setActFarben(QString p, QString b, int shp, int shb);
void selectColorS(QListWidgetItem *c);
void selectColorF(QListWidgetItem *c);
@@ -184,9 +189,9 @@
void NewGradient(int);
void NewGradientS(int);
void NewPattern(QString);
- void NewPatternProps(double, double, double, double, double, double, double);
+ void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
void NewPatternS(QString);
- void NewPatternPropsS(double, double, double, double, double, double, double);
+ void NewPatternPropsS(double, double, double, double, double, double, double, bool, bool);
void NewSpecial(double, double, double, double);
void NewTrans(double);
void NewTransS(double);
@@ -212,6 +217,8 @@
double m_Pattern_rotation;
double m_Pattern_skewX;
double m_Pattern_skewY;
+ bool m_Pattern_mirrorX;
+ bool m_Pattern_mirrorY;
double m_Pattern_scaleXS;
double m_Pattern_scaleYS;
double m_Pattern_offsetXS;
@@ -219,6 +226,8 @@
double m_Pattern_rotationS;
double m_Pattern_skewXS;
double m_Pattern_skewYS;
+ bool m_Pattern_mirrorXS;
+ bool m_Pattern_mirrorYS;
int currentUnit;
bool editStrokeGradient;
};
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (revision 14275)
+++ scribus/ui/propertiespalette.cpp (revision 14276)
@@ -1870,10 +1870,10 @@
disconnect(this->Cpal, SIGNAL(NewBlend(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewBlendS(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewPattern(QString)), 0, 0);
- disconnect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double)), 0, 0);
+ disconnect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewOverprint(int)), 0, 0);
disconnect(this->Cpal, SIGNAL(NewPatternS(QString)), 0, 0);
- disconnect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double)), 0, 0);
+ disconnect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, bool, bool)), 0, 0);
doc = d;
CurItem = NULL;
@@ -1948,10 +1948,10 @@
connect(this->Cpal, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradFill(int)));
connect(this->Cpal, SIGNAL(NewGradientS(int)), doc, SLOT(itemSelection_SetItemGradStroke(int)));
connect(this->Cpal, SIGNAL(NewPattern(QString)), doc, SLOT(itemSelection_SetItemPatternFill(QString)));
- connect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double)), doc, SLOT(itemSelection_SetItemPatternProps(double, double, double, double, double, double, double)));
+ connect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemPatternProps(double, double, double, double, double, double, double, bool, bool)));
connect(this->Cpal, SIGNAL(NewOverprint(int)), this, SLOT(handleOverprint(int)));
connect(this->Cpal, SIGNAL(NewPatternS(QString)), doc, SLOT(itemSelection_SetItemStrokePattern(QString)));
- connect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double, double, double, double, double, double, double)));
+ connect(this->Cpal, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double, double, double, double, double, double, double, bool, bool)));
}
void PropertiesPalette::unsetDoc()
@@ -2232,10 +2232,13 @@
// setScaleAndOffset(i->imageXScale(), i->imageYScale(), i->imageXOffset(), i->imageYOffset());
setTextToFrameDistances(i->textToFrameDistLeft(),i->textToFrameDistTop(),i->textToFrameDistBottom(),i->textToFrameDistRight());
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ bool mirrorX, mirrorY;
i->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
- Cpal->setActPattern(i->pattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ i->patternFlip(mirrorX, mirrorY);
+ Cpal->setActPattern(i->pattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
i->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
- Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ i->strokePatternFlip(mirrorX, mirrorY);
+ Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
//CB TODO reconnect PP signals from here
connect(Xpos, SIGNAL(valueChanged(double)), this, SLOT(NewX()));
Index: scribus/plugins/tools/lenseffects/lensdialog.cpp
===================================================================
--- scribus/plugins/tools/lenseffects/lensdialog.cpp (revision 14275)
+++ scribus/plugins/tools/lenseffects/lensdialog.cpp (revision 14276)
@@ -340,6 +340,12 @@
qmatrix.rotate(patternRotation);
qmatrix.shear(patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX / 100.0, patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ currItem->patternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ qmatrix.scale(-1, 1);
+ if (mirrorY)
+ qmatrix.scale(1, -1);
QImage pat = *doc->docPatterns[currItem->pattern()].getPattern();
QBrush brush = QBrush(pat);
brush.setTransform(qmatrix);
@@ -367,6 +373,12 @@
qmatrix.rotate(patternRotation);
qmatrix.shear(patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX / 100.0, patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ currItem->strokePatternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ qmatrix.scale(-1, 1);
+ if (mirrorY)
+ qmatrix.scale(1, -1);
QImage pat = *doc->docPatterns[currItem->strokePattern()].getPattern();
QBrush brush = QBrush(pat);
brush.setTransform(qmatrix);
Index: scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
===================================================================
--- scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (revision 14275)
+++ scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (revision 14276)
@@ -227,6 +227,12 @@
qmatrix.rotate(patternRotation);
qmatrix.shear(patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX / 100.0, patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ currItem->patternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ qmatrix.scale(-1, 1);
+ if (mirrorY)
+ qmatrix.scale(1, -1);
QImage pat = *doc->docPatterns[currItem->pattern()].getPattern();
QBrush brush = QBrush(pat);
brush.setTransform(qmatrix);
@@ -254,6 +260,12 @@
qmatrix.rotate(patternRotation);
qmatrix.shear(patternSkewX, patternSkewY);
qmatrix.scale(patternScaleX / 100.0, patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ currItem->strokePatternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ qmatrix.scale(-1, 1);
+ if (mirrorY)
+ qmatrix.scale(1, -1);
QImage pat = *doc->docPatterns[currItem->strokePattern()].getPattern();
QBrush brush = QBrush(pat);
brush.setTransform(qmatrix);
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14275)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14276)
@@ -1171,6 +1171,8 @@
docu.writeAttribute("pattern", item->pattern());
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ item->patternFlip(mirrorX, mirrorY);
docu.writeAttribute("pScaleX", patternScaleX);
docu.writeAttribute("pScaleY", patternScaleY);
docu.writeAttribute("pOffsetX", patternOffsetX);
@@ -1178,6 +1180,8 @@
docu.writeAttribute("pRotation", patternRotation);
docu.writeAttribute("pSkewX", patternSkewX);
docu.writeAttribute("pSkewY", patternSkewY);
+ docu.writeAttribute("pMirrorX" , mirrorX);
+ docu.writeAttribute("pMirrorY" , mirrorY);
}
else
{
@@ -1203,6 +1207,8 @@
docu.writeAttribute("patternS", item->strokePattern());
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ item->strokePatternFlip(mirrorX, mirrorY);
docu.writeAttribute("pScaleXS", patternScaleX);
docu.writeAttribute("pScaleYS", patternScaleY);
docu.writeAttribute("pOffsetXS", patternOffsetX);
@@ -1210,6 +1216,8 @@
docu.writeAttribute("pRotationS", patternRotation);
docu.writeAttribute("pSkewXS", patternSkewX);
docu.writeAttribute("pSkewYS", patternSkewY);
+ docu.writeAttribute("pMirrorXS" , mirrorX);
+ docu.writeAttribute("pMirrorYS" , mirrorY);
}
if (item->itemText.defaultStyle().hasParent())
docu.writeAttribute("PSTYLE", item->itemText.defaultStyle().parent());
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14275)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14276)
@@ -2764,6 +2764,9 @@
double patternSkewX = attrs.valueAsDouble("pSkewX", 0.0);
double patternSkewY = attrs.valueAsDouble("pSkewY", 0.0);
currItem->setPatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX = attrs.valueAsBool("pMirrorX", false);
+ bool mirrorY = attrs.valueAsBool("pMirrorY", false);
+ currItem->setPatternFlip(mirrorX, mirrorY);
}
else
{
@@ -2819,6 +2822,9 @@
double patternSkewX = attrs.valueAsDouble("pSkewXS", 0.0);
double patternSkewY = attrs.valueAsDouble("pSkewYS", 0.0);
currItem->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX = attrs.valueAsBool("pMirrorXS", false);
+ bool mirrorY = attrs.valueAsBool("pMirrorYS", false);
+ currItem->setPatternFlip(mirrorX, mirrorY);
currItem->stroke_gradient.clearStops();
currItem->GrTypeStroke = attrs.valueAsInt("GRTYPS", 0);
currItem->GrStrokeStartX = attrs.valueAsDouble("GRSTARTXS", 0.0);
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14275)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14276)
@@ -1293,6 +1293,8 @@
patt.setAttribute("patternUnits", "userSpaceOnUse");
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
mpa.translate(-Item->lineWidth() / 2.0, -Item->lineWidth() / 2.0);
mpa.translate(patternOffsetX, patternOffsetY);
@@ -1300,6 +1302,10 @@
mpa.shear(-patternSkewX, patternSkewY);
mpa.scale(pa.scaleX, pa.scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
patt.setAttribute("patternTransform", MatrixToStr(mpa));
patt.setAttribute("xlink:href", "#"+Item->strokePattern());
globalDefs.appendChild(patt);
@@ -1442,6 +1448,8 @@
patt.setAttribute("patternUnits", "userSpaceOnUse");
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
mpa.translate(-Item->lineWidth() / 2.0, -Item->lineWidth() / 2.0);
mpa.translate(patternOffsetX, patternOffsetY);
@@ -1449,6 +1457,10 @@
mpa.shear(-patternSkewX, patternSkewY);
mpa.scale(pa.scaleX, pa.scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
patt.setAttribute("patternTransform", MatrixToStr(mpa));
patt.setAttribute("xlink:href", "#"+Item->strokePattern());
globalDefs.appendChild(patt);
@@ -1553,12 +1565,18 @@
patt.setAttribute("patternUnits", "userSpaceOnUse");
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
Item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ Item->patternFlip(mirrorX, mirrorY);
QTransform mpa;
mpa.translate(patternOffsetX, patternOffsetY);
mpa.rotate(patternRotation);
mpa.shear(-patternSkewX, patternSkewY);
mpa.scale(pa.scaleX, pa.scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
patt.setAttribute("patternTransform", MatrixToStr(mpa));
patt.setAttribute("xlink:href", "#"+Item->pattern());
globalDefs.appendChild(patt);
@@ -1803,6 +1821,8 @@
patt.setAttribute("patternUnits", "userSpaceOnUse");
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ bool mirrorX, mirrorY;
+ Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
mpa.translate(-Item->lineWidth() / 2.0, -Item->lineWidth() / 2.0);
mpa.translate(patternOffsetX, patternOffsetY);
@@ -1810,6 +1830,10 @@
mpa.shear(-patternSkewX, patternSkewY);
mpa.scale(pa.scaleX, pa.scaleY);
mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ if (mirrorX)
+ mpa.scale(-1, 1);
+ if (mirrorY)
+ mpa.scale(1, -1);
patt.setAttribute("patternTransform", MatrixToStr(mpa));
patt.setAttribute("xlink:href", "#"+Item->strokePattern());
globalDefs.appendChild(patt);
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 14275)
+++ scribus/pslib.cpp (revision 14276)
@@ -3446,6 +3446,12 @@
patternMatrix.shear(patternSkewX, -patternSkewY);
patternMatrix.scale(pat->scaleX, pat->scaleY);
patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ c->strokePatternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ patternMatrix.scale(-1, 1);
+ if (mirrorY)
+ patternMatrix.scale(1, -1);
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");
PutStream("stroke\n");
}
@@ -3489,6 +3495,12 @@
patternMatrix.shear(patternSkewX, -patternSkewY);
patternMatrix.scale(pat->scaleX, pat->scaleY);
patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ c->patternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ patternMatrix.scale(-1, 1);
+ if (mirrorY)
+ patternMatrix.scale(1, -1);
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");
@@ -3737,6 +3749,12 @@
patternMatrix.shear(patternSkewX, -patternSkewY);
patternMatrix.scale(pat->scaleX, pat->scaleY);
patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ c->patternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ patternMatrix.scale(-1, 1);
+ if (mirrorY)
+ patternMatrix.scale(1, -1);
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");
@@ -3840,6 +3858,12 @@
patternMatrix.shear(patternSkewX, -patternSkewY);
patternMatrix.scale(pat->scaleX, pat->scaleY);
patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+ bool mirrorX, mirrorY;
+ ite->strokePatternFlip(mirrorX, mirrorY);
+ if (mirrorX)
+ patternMatrix.scale(-1, 1);
+ if (mirrorY)
+ patternMatrix.scale(1, -1);
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");
Index: scribus/pageitem_desaxe.cpp
===================================================================
--- scribus/pageitem_desaxe.cpp (revision 14275)
+++ scribus/pageitem_desaxe.cpp (revision 14276)
@@ -261,8 +261,10 @@
{
Xml_attr patt;
patt.insert("patternS", strokePattern());
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+// double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+// strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+// bool mirrorX, mirrorY;
+// strokePatternFlip(mirrorX, mirrorY);
patt.insert("pScaleXS", toXMLString(patternScaleX));
patt.insert("pScaleYS", toXMLString(patternScaleY));
patt.insert("pOffsetXS", toXMLString(patternOffsetX));
@@ -270,6 +272,8 @@
patt.insert("pRotationS", toXMLString(patternRotation));
patt.insert("pSkewXS", toXMLString(patternSkewX));
patt.insert("pSkewYS", toXMLString(patternSkewY));
+ patt.insert("pMirrorXS", toXMLString(patternStrokeMirrorX));
+ patt.insert("pMirrorYS", toXMLString(patternStrokeMirrorY));
handler.begin("PatternStroke", patt);
handler.end("PatternStroke");
}
@@ -279,8 +283,10 @@
{
Xml_attr patt;
patt.insert("pattern", pattern());
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+// double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+// patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+// bool mirrorX, mirrorY;
+// patternFlip(mirrorX, mirrorY);
patt.insert("pScaleX", toXMLString(patternScaleX));
patt.insert("pScaleY", toXMLString(patternScaleY));
patt.insert("pOffsetX", toXMLString(patternOffsetX));
@@ -288,6 +294,8 @@
patt.insert("pRotation", toXMLString(patternRotation));
patt.insert("pSkewX", toXMLString(patternSkewX));
patt.insert("pSkewY", toXMLString(patternSkewY));
+ patt.insert("pMirrorX", toXMLString(patternMirrorX));
+ patt.insert("pMirrorY", toXMLString(patternMirrorY));
handler.begin("Pattern", patt);
handler.end("Pattern");
}
@@ -589,8 +597,11 @@
double patternRotation = parseDouble(attr["pRotation"]);
double patternSkewX = parseDouble(attr["pSkewX"]);
double patternSkewY = parseDouble(attr["pSkewY"]);
+ bool mirrorX = parseBool(attr["pMirrorX"]);
+ bool mirrorY = parseBool(attr["pMirrorY"]);
item->setPattern(attr["pattern"]);
item->setPatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ item->setPatternFlip(mirrorX, mirrorY);
}
};
@@ -610,8 +621,11 @@
double patternRotation = parseDouble(attr["pRotationS"]);
double patternSkewX = parseDouble(attr["pSkewXS"]);
double patternSkewY = parseDouble(attr["pSkewYS"]);
+ bool mirrorX = parseBool(attr["pMirrorXS"]);
+ bool mirrorY = parseBool(attr["pMirrorYS"]);
item->setStrokePattern(attr["patternS"]);
item->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ item->setStrokePatternFlip(mirrorX, mirrorY);
}
};
Index: scribus/scpainter.h
===================================================================
--- scribus/scpainter.h (revision 14275)
+++ scribus/scpainter.h (revision 14276)
@@ -70,7 +70,7 @@
virtual void setFillMode( int fill );
virtual void setStrokeMode( int stroke );
virtual void setGradient( VGradient::VGradientType mode, FPoint orig, FPoint vec, FPoint foc = FPoint(0,0));
- virtual void setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
+ virtual void setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
virtual void setClipPath();
virtual void drawImage( QImage *image );
@@ -156,6 +156,8 @@
double patternRotation;
double patternSkewX;
double patternSkewY;
+ bool patternMirrorX;
+ bool patternMirrorY;
/*! \brief Stroking */
QColor m_stroke;
double stroke_trans;
More information about the scribus-commit
mailing list