r14398 by fschmid - First part of "Vector Brushes" + several other small fixes.
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 11 18:01:48 CET 2009
Revision: 14398
Author: fschmid
Date: 2009-12-11T06:01:27.446311Z
Commit message: First part of "Vector Brushes" + several other small fixes.
Changeset:
M /trunk/Scribus/scribus/ui/propertiespalette.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/scribusXml.cpp
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/pageitem_polyline.cpp
M /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
M /trunk/Scribus/scribus/pdflib_core.cpp
M /trunk/Scribus/scribus/plugins/import/ai/importai.cpp
M /trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
M /trunk/Scribus/scribus/pslib.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/pageitem_textframe.cpp
M /trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
M /trunk/Scribus/scribus/pageitem_pathtext.cpp
M /trunk/Scribus/scribus/ui/cpalette.cpp
M /trunk/Scribus/scribus/plugins/import/xar/importxar.h
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
M /trunk/Scribus/scribus/canvasmode_copyproperties.cpp
Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 14397)
+++ scribus/pdflib_core.cpp (revision 14398)
@@ -5958,7 +5958,7 @@
mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
mpa.rotate(-currItem->rotation());
}
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
bool mirrorX, mirrorY;
if (kind == 0)
{
@@ -5967,7 +5967,7 @@
}
else if (kind == 1)
{
- currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
currItem->strokePatternFlip(mirrorX, mirrorY);
}
else if (kind == 2)
Index: scribus/pageitem_line.cpp
===================================================================
--- scribus/pageitem_line.cpp (revision 14397)
+++ scribus/pageitem_line.cpp (revision 14398)
@@ -60,8 +60,44 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
- p->setStrokeMode(ScPainter::Pattern);
+ if (patternStrokePath)
+ {
+ QPainterPath guidePath;
+ guidePath.moveTo(0, 0);
+ guidePath.lineTo(Width, 0);
+ ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+ double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+ double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+ double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+ while (xpos < pLen)
+ {
+ double currPerc = guidePath.percentAtLength(xpos);
+ double currAngle = guidePath.angleAtPercent(currPerc);
+#if QT_VERSION >= 0x040400
+ if (currAngle <= 180.0)
+ currAngle *= -1.0;
+ else
+ currAngle = 360.0 - currAngle;
+#endif
+ QPointF currPoint = guidePath.pointAtPercent(currPerc);
+ p->save();
+ p->translate(currPoint.x(), currPoint.y());
+ p->rotate(currAngle);
+ p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+ p->translate(-pat.width / 2.0, -pat.height / 2.0);
+ p->translate(0.0, patternStrokeOffsetY);
+ p->drawImage(pat.getPattern());
+ xpos += adv;
+ p->restore();
+ }
+ p->newPath();
+ }
+ else
+ {
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+ p->setStrokeMode(ScPainter::Pattern);
+ p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+ }
}
else if (GrTypeStroke > 0)
{
@@ -88,6 +124,7 @@
else
p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
}
+ p->drawLine(FPoint(0, 0), FPoint(Width, 0));
}
else if (lineColor() != CommonStrings::None)
p->setStrokeMode(ScPainter::Solid);
Index: scribus/canvasmode_copyproperties.cpp
===================================================================
--- scribus/canvasmode_copyproperties.cpp (revision 14397)
+++ scribus/canvasmode_copyproperties.cpp (revision 14398)
@@ -154,7 +154,7 @@
SeleItem(m);
if (GetItem(&currItem))
{
- double sx, sy, ex, ey, r, skx, sky, fx, fy, ss, sk;
+ double sx, sy, ex, ey, r, skx, sky, fx, fy, ss, sk, sp;
currItem->ColGap = m_doc->ElemToLink->ColGap;
currItem->Cols = m_doc->ElemToLink->Cols;
currItem->BottomLine = m_doc->ElemToLink->BottomLine;
@@ -187,8 +187,9 @@
m_doc->ElemToLink->patternTransform(sx, sy, ex, ey, r, skx, sky);
currItem->setPatternTransform(sx, sy, ex, ey, r, skx, sky);
currItem->setStrokePattern(m_doc->ElemToLink->strokePattern());
- m_doc->ElemToLink->strokePatternTransform(sx, sy, ex, ey, r, skx, sky);
- currItem->setStrokePatternTransform(sx, sy, ex, ey, r, skx, sky);
+ m_doc->ElemToLink->strokePatternTransform(sx, sy, ex, ey, r, skx, sky, sp);
+ currItem->setStrokePatternTransform(sx, sy, ex, ey, r, skx, sky, sp);
+ currItem->setStrokePatternToPath(m_doc->ElemToLink->isStrokePatternToPath());
// Set Gradient type after all properties
currItem->setGradientType(m_doc->ElemToLink->gradientType());
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14397)
+++ scribus/scribusdoc.cpp (revision 14398)
@@ -5944,7 +5944,7 @@
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = m_Selection->itemAt(a);
- currItem->setStrokePatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY);
+ currItem->setStrokePatternTransform(imageScaleX, imageScaleY, offsetX, offsetY, rotation, skewX, skewY, 1);
currItem->setStrokePatternFlip(mirrorX, mirrorY);
currItem->update();
}
Index: scribus/pageitem_polyline.cpp
===================================================================
--- scribus/pageitem_polyline.cpp (revision 14397)
+++ scribus/pageitem_polyline.cpp (revision 14398)
@@ -99,8 +99,42 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
- p->setStrokeMode(ScPainter::Pattern);
+ if (patternStrokePath)
+ {
+ QPainterPath guidePath = PoLine.toQPainterPath(false);
+ ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+ double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+ double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+ double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+ while (xpos < pLen)
+ {
+ double currPerc = guidePath.percentAtLength(xpos);
+ double currAngle = guidePath.angleAtPercent(currPerc);
+#if QT_VERSION >= 0x040400
+ if (currAngle <= 180.0)
+ currAngle *= -1.0;
+ else
+ currAngle = 360.0 - currAngle;
+#endif
+ QPointF currPoint = guidePath.pointAtPercent(currPerc);
+ p->save();
+ p->translate(currPoint.x(), currPoint.y());
+ p->rotate(currAngle);
+ p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+ p->translate(-pat.width / 2.0, -pat.height / 2.0);
+ p->translate(0.0, patternStrokeOffsetY);
+ p->drawImage(pat.getPattern());
+ xpos += adv;
+ p->restore();
+ }
+ p->newPath();
+ }
+ else
+ {
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+ p->setStrokeMode(ScPainter::Pattern);
+ p->strokePath();
+ }
}
else if (GrTypeStroke > 0)
{
@@ -127,10 +161,13 @@
else
p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
}
+ p->strokePath();
}
else if (lineColor() != CommonStrings::None)
+ {
p->setStrokeMode(ScPainter::Solid);
- p->strokePath();
+ p->strokePath();
+ }
}
else
{
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp (revision 14397)
+++ scribus/scribusXml.cpp (revision 14398)
@@ -1271,8 +1271,10 @@
double patternRotationS;
double patternSkewXS;
double patternSkewYS;
+ double patternSpace;
bool patternMirrorX;
bool patternMirrorY;
+ bool atPath;
QString gradNameS;
QString gradNameM;
while(!sReader.atEnd() && !sReader.hasError())
@@ -1362,8 +1364,10 @@
patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
+ patternSpace = attrAsDbl(attrs, "pSpaceS", 0.0);
patternMirrorX = attrAsBool(attrs, "pMirrorXS", false);
patternMirrorY = attrAsBool(attrs, "pMirrorYS", false);
+ atPath = attrAsBool(attrs, "pAtPathS", false);
}
if (inItem && sReader.isStartElement() && tagName == "ITEXT")
{
@@ -1536,8 +1540,9 @@
Neu->setGradientMask(gradNameM);
Neu->doOverprint = doOverprint;
Neu->setStrokePattern(StrokePattern);
- Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS);
+ Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS, patternSpace);
Neu->setStrokePatternFlip(patternMirrorX, patternMirrorY);
+ Neu->setStrokePatternToPath(atPath);
storyText.setDefaultStyle(Neu->itemText.defaultStyle());
if (Neu->asLatexFrame())
{
@@ -1714,8 +1719,10 @@
double patternRotationS;
double patternSkewXS;
double patternSkewYS;
+ double patternSpace;
bool patternMirrorXS;
bool patternMirrorYS;
+ bool atPath;
QString gradNameS;
QString gradNameM;
int lowResType = 1;
@@ -1749,8 +1756,10 @@
patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
+ patternSpace = attrAsDbl(attrs, "pSpaceS", 0.0);
patternMirrorXS = attrAsBool(attrs, "pMirrorXS", false);
patternMirrorYS = attrAsBool(attrs, "pMirrorYS", false);
+ atPath = attrAsBool(attrs, "pAtPathS", false);
inlineF = attrAsBool(attrs1, "isInlineImage", false);
inlineImageData.resize(0);
QString dat = attrAsString(attrs1, "ImageData", "");
@@ -1903,8 +1912,9 @@
Neu->setStrokeGradient(gradNameS);
Neu->setGradientMask(gradNameM);
Neu->setStrokePattern(StrokePattern);
- Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS);
+ Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS, patternSpace);
Neu->setStrokePatternFlip(patternMirrorXS, patternMirrorYS);
+ Neu->setStrokePatternToPath(atPath);
Neu->setXYPos(Neu->xPos() - doc->currentPage()->xOffset(), Neu->yPos() - doc->currentPage()->yOffset(), true);
storyText.setDefaultStyle(Neu->itemText.defaultStyle());
Neu->itemText = storyText;
@@ -2539,10 +2549,11 @@
if (!item->strokePattern().isEmpty())
{
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;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
+ bool mirrorX, mirrorY, atPath;
item->strokePatternFlip(mirrorX, mirrorY);
+ atPath = item->isStrokePatternToPath();
writer.writeAttribute("pScaleXS", patternScaleX);
writer.writeAttribute("pScaleYS", patternScaleY);
writer.writeAttribute("pOffsetXS", patternOffsetX);
@@ -2550,8 +2561,10 @@
writer.writeAttribute("pRotationS", patternRotation);
writer.writeAttribute("pSkewXS" , patternSkewX);
writer.writeAttribute("pSkewYS" , patternSkewY);
+ writer.writeAttribute("pSpaceS" , patternSpace);
writer.writeAttribute("pMirrorXS" , mirrorX);
writer.writeAttribute("pMirrorYS" , mirrorY);
+ writer.writeAttribute("pAtPathS" , atPath);
}
if (item->GrMask > 0)
{
Index: scribus/pageitem_pathtext.cpp
===================================================================
--- scribus/pageitem_pathtext.cpp (revision 14397)
+++ scribus/pageitem_pathtext.cpp (revision 14398)
@@ -106,8 +106,42 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
- p->setStrokeMode(ScPainter::Pattern);
+ if (patternStrokePath)
+ {
+ QPainterPath guidePath = PoLine.toQPainterPath(false);
+ ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+ double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+ double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+ double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+ while (xpos < pLen)
+ {
+ double currPerc = guidePath.percentAtLength(xpos);
+ double currAngle = guidePath.angleAtPercent(currPerc);
+#if QT_VERSION >= 0x040400
+ if (currAngle <= 180.0)
+ currAngle *= -1.0;
+ else
+ currAngle = 360.0 - currAngle;
+#endif
+ QPointF currPoint = guidePath.pointAtPercent(currPerc);
+ p->save();
+ p->translate(currPoint.x(), currPoint.y());
+ p->rotate(currAngle);
+ p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+ p->translate(-pat.width / 2.0, -pat.height / 2.0);
+ p->translate(0.0, patternStrokeOffsetY);
+ p->drawImage(pat.getPattern());
+ xpos += adv;
+ p->restore();
+ }
+ p->newPath();
+ }
+ else
+ {
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+ p->setStrokeMode(ScPainter::Pattern);
+ p->strokePath();
+ }
}
else if (GrTypeStroke > 0)
{
@@ -134,10 +168,13 @@
else
p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
}
+ p->strokePath();
}
else if (lineColor() != CommonStrings::None)
+ {
p->setStrokeMode(ScPainter::Solid);
- p->strokePath();
+ p->strokePath();
+ }
}
else
{
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h (revision 14397)
+++ scribus/pageitem.h (revision 14398)
@@ -795,7 +795,7 @@
QString strokePattern() const { return patternStrokeVal; }
/** @brief Get the stroke pattern transformation matrix of the object */
- void strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const;
+ void strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY, double &space) const;
/**
* @brief Set the stroke pattern of the object.
@@ -806,9 +806,11 @@
/**
* @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 setStrokePatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space);
void setStrokePatternFlip(bool flipX, bool flipY);
void strokePatternFlip(bool &flipX, bool &flipY);
+ void setStrokePatternToPath(bool enable);
+ bool isStrokePatternToPath();
/** @brief Set the QColor for the line */
void setLineQColor();
@@ -1375,8 +1377,10 @@
double patternStrokeRotation;
double patternStrokeSkewX;
double patternStrokeSkewY;
+ double patternStrokeSpace;
bool patternStrokeMirrorX;
bool patternStrokeMirrorY;
+ bool patternStrokePath;
/**
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14397)
+++ scribus/pageitem.cpp (revision 14398)
@@ -259,6 +259,7 @@
patternStrokeSkewY(other.patternStrokeSkewY),
patternStrokeMirrorX(other.patternStrokeMirrorX),
patternStrokeMirrorY(other.patternStrokeMirrorY),
+ patternStrokePath(other.patternStrokePath),
gradientStrokeVal(other.gradientStrokeVal),
stroke_gradient(other.stroke_gradient),
GrTypeStroke(other.GrTypeStroke),
@@ -393,6 +394,7 @@
patternStrokeSkewY = 0;
patternStrokeMirrorX = false;
patternStrokeMirrorY = false;
+ patternStrokePath = false;
m_lineWidth = w2;
Oldm_lineWidth = w2;
PLineArt = Qt::PenStyle(m_Doc->itemToolPrefs.shapeLineStyle);
@@ -1389,9 +1391,42 @@
{
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
- p->setStrokeMode(ScPainter::Pattern);
- p->strokePath();
+ if (patternStrokePath)
+ {
+ QPainterPath guidePath = PoLine.toQPainterPath(false);
+ ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+ double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+ double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+ double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+ while (xpos < pLen)
+ {
+ double currPerc = guidePath.percentAtLength(xpos);
+ double currAngle = guidePath.angleAtPercent(currPerc);
+#if QT_VERSION >= 0x040400
+ if (currAngle <= 180.0)
+ currAngle *= -1.0;
+ else
+ currAngle = 360.0 - currAngle;
+#endif
+ QPointF currPoint = guidePath.pointAtPercent(currPerc);
+ p->save();
+ p->translate(currPoint.x(), currPoint.y());
+ p->rotate(currAngle);
+ p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+ p->translate(-pat.width / 2.0, -pat.height / 2.0);
+ p->translate(0.0, patternStrokeOffsetY);
+ p->drawImage(pat.getPattern());
+ xpos += adv;
+ p->restore();
+ }
+ p->newPath();
+ }
+ else
+ {
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+ p->setStrokeMode(ScPainter::Pattern);
+ p->strokePath();
+ }
}
else if (GrTypeStroke > 0)
{
@@ -2838,8 +2873,18 @@
patternStrokeVal = newPattern;
}
-void PageItem::setStrokePatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY)
+void PageItem::setStrokePatternToPath(bool enable)
{
+ patternStrokePath = enable;
+}
+
+bool PageItem::isStrokePatternToPath()
+{
+ return patternStrokePath;
+}
+
+void PageItem::setStrokePatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space)
+{
patternStrokeScaleX = scaleX;
patternStrokeScaleY = scaleY;
patternStrokeOffsetX = offsetX;
@@ -2847,6 +2892,7 @@
patternStrokeRotation = rotation;
patternStrokeSkewX = skewX;
patternStrokeSkewY = skewY;
+ patternStrokeSpace = space;
}
void PageItem::setStrokePatternFlip(bool flipX, bool flipY)
@@ -2861,15 +2907,16 @@
flipY = patternStrokeMirrorY;
}
-void PageItem::strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const
+void PageItem::strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY, double &space) const
{
- scaleX = patternStrokeScaleX;
- scaleY = patternStrokeScaleY;
- offsetX = patternStrokeOffsetX;
- offsetY = patternStrokeOffsetY;
- rotation = patternStrokeRotation;
- skewX = patternStrokeSkewX;
- skewY = patternStrokeSkewY;
+ scaleX = patternStrokeScaleX;
+ scaleY = patternStrokeScaleY;
+ offsetX = patternStrokeOffsetX;
+ offsetY = patternStrokeOffsetY;
+ rotation = patternStrokeRotation;
+ skewX = patternStrokeSkewX;
+ skewY = patternStrokeSkewY;
+ space = patternStrokeSpace;
}
void PageItem::setLineQColor()
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp (revision 14397)
+++ scribus/pageitem_textframe.cpp (revision 14398)
@@ -2661,9 +2661,42 @@
}
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
{
- p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
- p->setStrokeMode(ScPainter::Pattern);
- p->strokePath();
+ if (patternStrokePath)
+ {
+ QPainterPath guidePath = PoLine.toQPainterPath(false);
+ ScPattern pat = m_Doc->docPatterns[patternStrokeVal];
+ double pLen = guidePath.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0));
+ double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace;
+ double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0;
+ while (xpos < pLen)
+ {
+ double currPerc = guidePath.percentAtLength(xpos);
+ double currAngle = guidePath.angleAtPercent(currPerc);
+#if QT_VERSION >= 0x040400
+ if (currAngle <= 180.0)
+ currAngle *= -1.0;
+ else
+ currAngle = 360.0 - currAngle;
+#endif
+ QPointF currPoint = guidePath.pointAtPercent(currPerc);
+ p->save();
+ p->translate(currPoint.x(), currPoint.y());
+ p->rotate(currAngle);
+ p->scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
+ p->translate(-pat.width / 2.0, -pat.height / 2.0);
+ p->translate(0.0, patternStrokeOffsetY);
+ p->drawImage(pat.getPattern());
+ xpos += adv;
+ p->restore();
+ }
+ p->newPath();
+ }
+ else
+ {
+ p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+ p->setStrokeMode(ScPainter::Pattern);
+ p->strokePath();
+ }
}
else if (GrTypeStroke > 0)
{
Index: scribus/ui/cpalette.cpp
===================================================================
--- scribus/ui/cpalette.cpp (revision 14397)
+++ scribus/ui/cpalette.cpp (revision 14398)
@@ -451,7 +451,7 @@
emit NewPatternS(c->text());
}
-void Cpalette::setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
+void Cpalette::setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY, double space, bool pathF)
{
disconnect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
QList<QListWidgetItem*> itl = patternBoxStroke->findItems(pattern, Qt::MatchExactly);
@@ -471,6 +471,8 @@
m_Pattern_skewYS = skewY;
m_Pattern_mirrorXS = mirrorX;
m_Pattern_mirrorYS = mirrorY;
+ m_Pattern_spaceS = space;
+ m_Pattern_pathF = pathF;
connect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
}
@@ -724,7 +726,7 @@
dia->spinYSkew->setValue(asinb / (M_PI / 180.0));
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)));
+ 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();
Index: scribus/ui/cpalette.h
===================================================================
--- scribus/ui/cpalette.h (revision 14397)
+++ scribus/ui/cpalette.h (revision 14398)
@@ -79,7 +79,7 @@
void updatePatternList();
void updateGradientList();
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 setActPatternStroke(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY, double space, bool pathF);
void setActFarben(QString p, QString b, int shp, int shb);
void selectColorS(QListWidgetItem *c);
void selectColorF(QListWidgetItem *c);
@@ -137,8 +137,10 @@
double m_Pattern_rotationS;
double m_Pattern_skewXS;
double m_Pattern_skewYS;
+ double m_Pattern_spaceS;
bool m_Pattern_mirrorXS;
bool m_Pattern_mirrorYS;
+ bool m_Pattern_pathF;
int currentUnit;
int editStrokeGradient;
};
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp (revision 14397)
+++ scribus/ui/propertiespalette.cpp (revision 14398)
@@ -2254,14 +2254,14 @@
Rotation->setValue(fabs(rr));
// 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;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
bool mirrorX, mirrorY;
i->patternTransform(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);
+ i->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
i->strokePatternFlip(mirrorX, mirrorY);
- Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
+ Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY, patternSpace, i->isStrokePatternToPath());
i->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
i->maskFlip(mirrorX, mirrorY);
Index: scribus/plugins/tools/lenseffects/lensdialog.cpp
===================================================================
--- scribus/plugins/tools/lenseffects/lensdialog.cpp (revision 14397)
+++ scribus/plugins/tools/lenseffects/lensdialog.cpp (revision 14398)
@@ -365,8 +365,8 @@
{
if ((!currItem->strokePattern().isEmpty()) && (doc->docPatterns.contains(currItem->strokePattern())))
{
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
QTransform qmatrix;
qmatrix.translate(-currItem->lineWidth() / 2.0, -currItem->lineWidth() / 2.0);
qmatrix.translate(patternOffsetX, patternOffsetY);
Index: scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
===================================================================
--- scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (revision 14397)
+++ scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp (revision 14398)
@@ -252,8 +252,8 @@
{
if ((!currItem->strokePattern().isEmpty()) && (doc->docPatterns.contains(currItem->strokePattern())))
{
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ currItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
QTransform qmatrix;
qmatrix.translate(-currItem->lineWidth() / 2.0, -currItem->lineWidth() / 2.0);
qmatrix.translate(patternOffsetX, patternOffsetY);
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14397)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14398)
@@ -1215,10 +1215,11 @@
if (!item->strokePattern().isEmpty())
{
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;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
+ bool mirrorX, mirrorY, atPath;
item->strokePatternFlip(mirrorX, mirrorY);
+ atPath = item->isStrokePatternToPath();
docu.writeAttribute("pScaleXS", patternScaleX);
docu.writeAttribute("pScaleYS", patternScaleY);
docu.writeAttribute("pOffsetXS", patternOffsetX);
@@ -1226,8 +1227,10 @@
docu.writeAttribute("pRotationS", patternRotation);
docu.writeAttribute("pSkewXS", patternSkewX);
docu.writeAttribute("pSkewYS", patternSkewY);
+ docu.writeAttribute("pSpaceS", patternSpace);
docu.writeAttribute("pMirrorXS" , mirrorX);
docu.writeAttribute("pMirrorYS" , mirrorY);
+ docu.writeAttribute("pAtPathS" , atPath);
}
docu.writeAttribute("GRTYPM", item->GrMask);
if (item->GrMask > 0)
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14397)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14398)
@@ -2847,10 +2847,13 @@
double patternRotation = attrs.valueAsDouble("pRotationS", 0.0);
double patternSkewX = attrs.valueAsDouble("pSkewXS", 0.0);
double patternSkewY = attrs.valueAsDouble("pSkewYS", 0.0);
- currItem->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternSpace = attrs.valueAsDouble("pSpaceS", 0.0);
+ currItem->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
bool mirrorX = attrs.valueAsBool("pMirrorXS", false);
bool mirrorY = attrs.valueAsBool("pMirrorYS", false);
+ bool atPath = attrs.valueAsBool("pAtPathS", false);
currItem->setPatternFlip(mirrorX, mirrorY);
+ currItem->setStrokePatternToPath(atPath);
currItem->GrTypeStroke = attrs.valueAsInt("GRTYPS", 0);
if (((currItem->GrTypeStroke != 0) && (currItem->GrTypeStroke != 8)) && (currItem->strokeGradient().isEmpty()))
currItem->stroke_gradient.clearStops();
Index: scribus/plugins/import/svg/svgplugin.cpp
===================================================================
--- scribus/plugins/import/svg/svgplugin.cpp (revision 14397)
+++ scribus/plugins/import/svg/svgplugin.cpp (revision 14398)
@@ -713,7 +713,7 @@
mm.rotate(rot);
double patDx = (item->xPos() - BaseX) - mm.dx();
double patDy = (item->yPos() - BaseY) - mm.dy();
- item->setStrokePatternTransform(mm.m11() * 100.0, mm.m22() * 100.0, patDx, patDy, -rot, 0, 0);
+ item->setStrokePatternTransform(mm.m11() * 100.0, mm.m22() * 100.0, patDx, patDy, -rot, 0, 0, 1);
}
else
{
Index: scribus/plugins/import/ai/importai.cpp
===================================================================
--- scribus/plugins/import/ai/importai.cpp (revision 14397)
+++ scribus/plugins/import/ai/importai.cpp (revision 14398)
@@ -1185,7 +1185,7 @@
if (!currentStrokePatternName.isEmpty())
{
ite->setStrokePattern(currentStrokePatternName);
- ite->setStrokePatternTransform(currentStrokePatternXScale * 100, currentStrokePatternYScale * 100, currentStrokePatternX, currentStrokePatternY, currentStrokePatternRotation, 0.0, 0.0);
+ ite->setStrokePatternTransform(currentStrokePatternXScale * 100, currentStrokePatternYScale * 100, currentStrokePatternX, currentStrokePatternY, currentStrokePatternRotation, 0.0, 0.0, 1.0);
currentStrokePatternName = "";
}
ite->setLineEnd(CapStyle);
Index: scribus/plugins/import/xar/importxar.cpp
===================================================================
--- scribus/plugins/import/xar/importxar.cpp (revision 14397)
+++ scribus/plugins/import/xar/importxar.cpp (revision 14398)
@@ -399,7 +399,8 @@
XarColorMap.insert(-9, color);
ignoreableTags << 2 << 40 << 41 << 43 << 46 << 47 << 53 << 61 << 62 << 63 << 80 << 90 << 91 << 92 << 93 << 111;
ignoreableTags << 2150 << 2151 << 2205 << 2900 << 2901;
- ignoreableTags << 4031 << 4087 << 4114 << 4115 << 4116 << 4124;
+ ignoreableTags << 4031 << 4081 << 4082 << 4083 << 4087 << 4102 << 4103 << 4104 << 4105 << 4106 << 4107 << 4108 << 4109;
+ ignoreableTags << 4110 << 4111 << 4112 << 4113 << 4114 << 4115 << 4116 << 4124;
if(progressDialog)
{
progressDialog->setOverallProgress(2);
@@ -721,19 +722,23 @@
handleMultiGradient(ts, false);
else if (tag == 4077)
handleMultiGradientElliptical(ts);
+ else if (tag == 4079)
+ handleBrushItem(ts);
+ else if (tag == 4080)
+ createBrushItem(ts);
+ else if (tag == 4084)
+ createClipItem();
+ else if (tag == 4085)
+ finishClip();
else if (tag == 4121)
handleSimpleGradientSkewed(ts, dataLen);
else if (tag == 4122)
handleMultiGradientSkewed(ts);
else if (tag == 4123)
handleSimpleGradientTransparencySkewed(ts, dataLen);
- else if (tag == 4084)
- createClipItem();
- else if (tag == 4085)
- finishClip();
else
{
- /* if (m_gc.count() > 3)
+/* if (m_gc.count() > 3)
{
if ((tag > 1999) && (tag < 3000))
qDebug() << QString("Unhandled OpCode: %1 Data Len %2").arg(tag).arg(dataLen, 8, 16, QLatin1Char('0'));
@@ -1408,11 +1413,11 @@
if (flags & 1)
path.addEllipse(QPointF(0,0), w, h);
else
- path = RegularPolygon(w * 2, h * 2, numSides, flags & 2, r1, 225, 0);
+ path = RegularPolygon(w * 2, h * 2, numSides, flags & 2, r1, 45, 0);
Coords.fromQPainterPath(path);
if (!(flags & 1))
Coords.translate(-w, -h);
- QTransform matrix(-scaleX, skewX, -skewY, scaleY, 0, 0);
+ QTransform matrix(scaleX, -skewX, -skewY, scaleY, 0, 0);
Coords.map(matrix);
Coords.translate(transX, -transY);
Coords.translate(0, docHeight);
@@ -2499,12 +2504,60 @@
// qDebug() << "Item" << ite->itemName() << type;
}
+void XarPlug::handleBrushItem(QDataStream &ts)
+{
+ quint32 handle;
+ qint32 spacing, offsetX, offsetY;
+ quint8 flags;
+ double rotate, scale;
+ ts >> handle;
+ ts >> spacing;
+ ts >> flags;
+ ts >> rotate;
+ ts >> offsetX >> offsetY;
+ ts >> scale;
+ qDebug() << "Using Brush" << brushRef[handle] << "Rot" << rotate << "Offsets X" << offsetX << "Y" << offsetY << "Sc" << scale;
+ ScPattern pat = m_Doc->docPatterns[brushRef[handle]];
+ XarStyle *gc = m_gc.top();
+ gc->strokePattern = brushRef[handle];
+ gc->patternScaleXS = scale * 100;
+ gc->patternScaleYS = scale * 100;
+ gc->patternOffsetXS = offsetX / 1000.0;
+ gc->patternOffsetYS = offsetY / 1000.0;
+ gc->patternRotationS = 0.0;
+ gc->patternSkewX = 0.0;
+ gc->patternSkewY = 0.0;
+ gc->patternSpace = (spacing / 1000.0) / static_cast<double>(m_Doc->docPatterns[brushRef[handle]].width);
+ gc->patternStrokePath = true;
+}
+
+void XarPlug::createBrushItem(QDataStream &ts)
+{
+ quint32 idNr;
+ ts >> idNr;
+ XarGroup gg;
+ gg.index = Elements.count();
+ gg.gcStackDepth = m_gc.count();
+ gg.clipping = false;
+ gg.idNr = idNr;
+ gg.isBrush = true;
+ int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ PageItem *neu = m_Doc->Items->at(z);
+ gg.groupItem = neu;
+ Elements.append(neu);
+ XarStyle *gc = m_gc.top();
+ gc->Elements.append(neu);
+ groupStack.push(gg);
+}
+
void XarPlug::createGroupItem()
{
XarGroup gg;
gg.index = Elements.count();
gg.gcStackDepth = m_gc.count();
gg.clipping = false;
+ gg.idNr = 0;
+ gg.isBrush = false;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
gg.groupItem = neu;
@@ -2520,6 +2573,8 @@
gg.index = Elements.count();
gg.gcStackDepth = m_gc.count();
gg.clipping = true;
+ gg.idNr = 0;
+ gg.isBrush = false;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
gg.groupItem = neu;
@@ -3027,52 +3082,6 @@
recordPath = false;
pathGcStackIndex = 0;
}
-/* if (inTextBlock)
- {
- if (textData.count() > 0)
- {
- textData.last().FillCol = gc->FillCol;
- textData.last().FillOpacity = gc->FillOpacity;
- textData.last().FillBlend = gc->FillBlend;
- textData.last().StrokeOpacity = gc->StrokeOpacity;
- textData.last().LWidth = gc->LWidth;
- textData.last().StrokeCol = gc->StrokeCol;
- textData.last().PLineJoin = gc->PLineJoin;
- textData.last().PLineEnd = gc->PLineEnd;
- textData.last().fillPattern = gc->fillPattern;
- textData.last().patternScaleX = gc->patternScaleX;
- textData.last().patternScaleY = gc->patternScaleY;
- textData.last().patternOffsetX = gc->patternOffsetX;
- textData.last().patternOffsetY = gc->patternOffsetY;
- textData.last().patternRotation = gc->patternRotation;
- textData.last().patternSkewX = gc->patternSkewX;
- textData.last().patternSkewY = gc->patternSkewY;
- textData.last().FillGradientType = gc->FillGradientType;
- textData.last().FillGradient = gc->FillGradient;
- textData.last().GradFillX1 = gc->GradFillX1;
- textData.last().GradFillY1 = gc->GradFillY1;
- textData.last().GradFillX2 = gc->GradFillX2;
- textData.last().GradFillY2 = gc->GradFillY2;
- textData.last().GrScale = gc->GrScale;
- textData.last().GrSkew = gc->GrSkew;
- textData.last().GradMask = gc->GradMask;
- textData.last().MaskGradient = gc->MaskGradient;
- textData.last().GradMaskX1 = gc->GradMaskX1;
- textData.last().GradMaskY1 = gc->GradMaskY1;
- textData.last().GradMaskX2 = gc->GradMaskX2;
- textData.last().GradMaskY2 = gc->GradMaskY2;
- textData.last().GradMaskScale = gc->GradMaskScale;
- textData.last().GradMaskSkew = gc->GradMaskSkew;
- textData.last().patternMaskScaleX = gc->patternMaskScaleX;
- textData.last().patternMaskScaleY = gc->patternMaskScaleY;
- textData.last().patternMaskOffsetX = gc->patternMaskOffsetX;
- textData.last().patternMaskOffsetY = gc->patternMaskOffsetY;
- textData.last().patternMaskRotation = gc->patternMaskRotation;
- textData.last().patternMaskSkewX = gc->patternMaskSkewX;
- textData.last().patternMaskSkewY = gc->patternMaskSkewY;
- textData.last().maskPattern = gc->maskPattern;
- }
- } */
if (groupStack.count() > 0)
{
XarGroup gg = groupStack.top();
@@ -3126,6 +3135,28 @@
groupItem->groupsLastItem = Elements.last();
groupItem->Groups.push(m_Doc->GroupCounter);
m_Doc->GroupCounter++;
+ if (gg.isBrush)
+ {
+ m_Doc->DoDrawing = true;
+ QImage tmpImg = groupItem->DrawObj_toImage();
+ ScPattern pat = ScPattern();
+ pat.setDoc(m_Doc);
+ pat.width = tmpImg.width();
+ pat.height = tmpImg.height();
+ pat.pattern = tmpImg;
+ for (int a = gg.index; a < Elements.count(); ++a)
+ {
+ PageItem* paItem = Elements.at(a);
+ paItem->setItemName(groupItem->itemName()+QString("_%1").arg(a));
+ pat.items.append(paItem);
+ m_Doc->Items->removeAll(paItem);
+ }
+ QString patternName = "Pattern_"+groupItem->itemName();
+ patternName = patternName.trimmed().simplified().replace(" ", "_");
+ m_Doc->addPattern(patternName, pat);
+ m_Doc->DoDrawing = false;
+ brushRef.insert(gg.idNr, patternName);
+ }
}
}
}
@@ -3174,6 +3205,12 @@
item->setPatternMask(gc->maskPattern);
}
}
+ if (!gc->strokePattern.isEmpty())
+ {
+ item->setStrokePatternToPath(gc->patternStrokePath);
+ item->setStrokePattern(gc->strokePattern);
+ item->setStrokePatternTransform(gc->patternScaleXS, gc->patternScaleYS, gc->patternOffsetXS, gc->patternOffsetYS, gc->patternRotationS, gc->patternSkewXS, gc->patternSkewYS, gc->patternSpace);
+ }
}
}
delete gc;
Index: scribus/plugins/import/xar/importxar.h
===================================================================
--- scribus/plugins/import/xar/importxar.h (revision 14397)
+++ scribus/plugins/import/xar/importxar.h (revision 14398)
@@ -92,6 +92,16 @@
patternMaskRotation(0),
patternMaskSkewX(0),
patternMaskSkewY(0),
+ strokePattern(""),
+ patternScaleXS(1),
+ patternScaleYS(1),
+ patternOffsetXS(0),
+ patternOffsetYS(0),
+ patternRotationS(0),
+ patternSkewXS(0),
+ patternSkewYS(0),
+ patternSpace(0),
+ patternStrokePath(false),
Elements()
{
}
@@ -157,6 +167,16 @@
double patternMaskRotation;
double patternMaskSkewX;
double patternMaskSkewY;
+ QString strokePattern;
+ double patternScaleXS;
+ double patternScaleYS;
+ double patternOffsetXS;
+ double patternOffsetYS;
+ double patternRotationS;
+ double patternSkewXS;
+ double patternSkewYS;
+ double patternSpace;
+ bool patternStrokePath;
QList<PageItem*> Elements;
};
@@ -240,6 +260,8 @@
void createSimilarItem(QDataStream &ts);
void createPolylineItem(int type);
void createPolygonItem(int type);
+ void handleBrushItem(QDataStream &ts);
+ void createBrushItem(QDataStream &ts);
void createGroupItem();
void createClipItem();
void finishClip();
@@ -292,6 +314,8 @@
int index;
int gcStackDepth;
bool clipping;
+ bool isBrush;
+ quint32 idNr;
PageItem* groupItem;
};
struct XarText
@@ -361,6 +385,7 @@
QList<XarText> textData;
QMap<qint32, XarColor> XarColorMap;
QMap<qint32, PageItem*> pathMap;
+ QMap<quint32, QString> brushRef;
QMap<QString, QString> patternMap;
QMap<quint32, QString> patternRef;
QMap<quint32, QString> fontRef;
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14397)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp (revision 14398)
@@ -1291,8 +1291,8 @@
patt.setAttribute("height", pa.height);
patt.setAttribute("width", pa.width);
patt.setAttribute("patternUnits", "userSpaceOnUse");
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
bool mirrorX, mirrorY;
Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
@@ -1446,8 +1446,8 @@
patt.setAttribute("height", pa.height);
patt.setAttribute("width", pa.width);
patt.setAttribute("patternUnits", "userSpaceOnUse");
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
bool mirrorX, mirrorY;
Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
@@ -1817,8 +1817,8 @@
patt.setAttribute("height", FToStr(pa.height));
patt.setAttribute("width", FToStr(pa.width));
patt.setAttribute("patternUnits", "userSpaceOnUse");
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
- Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ Item->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
bool mirrorX, mirrorY;
Item->strokePatternFlip(mirrorX, mirrorY);
QTransform mpa;
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 14397)
+++ scribus/pslib.cpp (revision 14398)
@@ -3433,10 +3433,10 @@
{
ScPattern *pat;
QTransform patternMatrix;
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
pat = &m_Doc->docPatterns[c->strokePattern()];
uint patHash = qHash(c->strokePattern());
- c->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ c->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
patternMatrix.translate(-c->lineWidth() / 2.0, c->lineWidth() / 2.0);
patternMatrix.translate(patternOffsetX, -patternOffsetY);
patternMatrix.rotate(-patternRotation);
@@ -3882,10 +3882,10 @@
SetClipPath(&arrow);
PS_closepath();
QTransform patternMatrix;
- double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
ScPattern *pat = &m_Doc->docPatterns[ite->strokePattern()];
uint patHash = qHash(ite->strokePattern());
- ite->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ ite->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
patternMatrix.translate(patternOffsetX, -patternOffsetY);
patternMatrix.rotate(-patternRotation);
patternMatrix.shear(patternSkewX, -patternSkewY);
Index: scribus/pageitem_desaxe.cpp
===================================================================
--- scribus/pageitem_desaxe.cpp (revision 14397)
+++ scribus/pageitem_desaxe.cpp (revision 14398)
@@ -266,10 +266,11 @@
patt.insert("pOffsetXS", toXMLString(patternStrokeOffsetX));
patt.insert("pOffsetYS", toXMLString(patternStrokeOffsetY));
patt.insert("pRotationS", toXMLString(patternStrokeRotation));
- patt.insert("pSkewXS", toXMLString(patternStrokeSkewX));
- patt.insert("pSkewYS", toXMLString(patternStrokeSkewY));
+ patt.insert("pSkewXS", toXMLString(patternStrokeSkewX));
+ patt.insert("pSkewYS", toXMLString(patternStrokeSkewY));
patt.insert("pMirrorXS", toXMLString(patternStrokeMirrorX));
patt.insert("pMirrorYS", toXMLString(patternStrokeMirrorY));
+ patt.insert("pAtPathS", toXMLString(patternStrokePath));
handler.begin("PatternStroke", patt);
handler.end("PatternStroke");
}
@@ -712,11 +713,14 @@
double patternRotation = parseDouble(attr["pRotationS"]);
double patternSkewX = parseDouble(attr["pSkewXS"]);
double patternSkewY = parseDouble(attr["pSkewYS"]);
+ double patternSpace = parseDouble(attr["pSpaceS"]);
bool mirrorX = parseBool(attr["pMirrorXS"]);
bool mirrorY = parseBool(attr["pMirrorYS"]);
+ bool atPath = parseBool(attr["pAtPathS"]);
item->setStrokePattern(attr["patternS"]);
- item->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ item->setStrokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
item->setStrokePatternFlip(mirrorX, mirrorY);
+ item->setStrokePatternToPath(atPath);
}
};
More information about the scribus-commit
mailing list