r14962 by fschmid - Xara Importer: added the new 4-color gradient.
scribus-commit
scribus-commit at lists.scribus.net
Sun Apr 11 11:30:25 CEST 2010
Revision: 14962
Author: fschmid
Date: 2010-04-11T09:26:35.084253Z
Commit message: Xara Importer: added the new 4-color gradient.
Changeset:
M /trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
M /trunk/Scribus/scribus/plugins/import/xar/importxar.h
Diffs:
Index: scribus/plugins/import/xar/importxar.cpp
===================================================================
--- scribus/plugins/import/xar/importxar.cpp (revision 14961)
+++ scribus/plugins/import/xar/importxar.cpp (revision 14962)
@@ -737,6 +737,8 @@
gc->StrokeCol = "White";
else if (tag == 198)
handleBitmap(ts);
+ else if (tag == 204)
+ handleFourColorGradient(ts);
else if (tag == 1000)
createRectangleItem(ts, true);
else if (tag == 1100)
@@ -970,6 +972,10 @@
text.GradFillY2 = gc->GradFillY2;
text.GrScale = gc->GrScale;
text.GrSkew = gc->GrSkew;
+ text.GrColorP1 = gc->GrColorP1;
+ text.GrColorP2 = gc->GrColorP2;
+ text.GrColorP3 = gc->GrColorP3;
+ text.GrColorP4 = gc->GrColorP4;
text.GradMask = gc->GradMask;
text.MaskGradient = gc->MaskGradient;
text.GradMaskX1 = gc->GradMaskX1;
@@ -1036,6 +1042,10 @@
text.GradFillY2 = gc->GradFillY2;
text.GrScale = gc->GrScale;
text.GrSkew = gc->GrSkew;
+ text.GrColorP1 = gc->GrColorP1;
+ text.GrColorP2 = gc->GrColorP2;
+ text.GrColorP3 = gc->GrColorP3;
+ text.GrColorP4 = gc->GrColorP4;
text.GradMask = gc->GradMask;
text.MaskGradient = gc->MaskGradient;
text.GradMaskX1 = gc->GradMaskX1;
@@ -1242,6 +1252,12 @@
item->fill_gradient = txDat.FillGradient;
item->setGradientVector(txDat.GradFillX1 - item->xPos(), txDat.GradFillY1 - item->yPos(), txDat.GradFillX2 - item->xPos(), txDat.GradFillY2 - item->yPos(), txDat.GradFillX1 - item->xPos(), txDat.GradFillY1 - item->yPos(), txDat.GrScale, txDat.GrSkew);
}
+ if (txDat.FillGradientType == 9)
+ {
+ item->GrType = txDat.FillGradientType;
+ item->set4ColorGeometry(FPoint(0, 0), FPoint(item->width(), 0), FPoint(item->width(), item->height()), FPoint(0, item->height()));
+ item->set4ColorColors(txDat.GrColorP1, txDat.GrColorP2, txDat.GrColorP3, txDat.GrColorP4);
+ }
if (txDat.GradMask > 0)
{
item->GrMask = txDat.GradMask;
@@ -1330,6 +1346,12 @@
item->fill_gradient = txDat.FillGradient;
item->setGradientVector(txDat.GradFillX1 - item->xPos(), txDat.GradFillY1 - item->yPos(), txDat.GradFillX2 - item->xPos(), txDat.GradFillY2 - item->yPos(), txDat.GradFillX1 - item->xPos(), txDat.GradFillY1 - item->yPos(), txDat.GrScale, txDat.GrSkew);
}
+ if (txDat.FillGradientType == 9)
+ {
+ item->GrType = txDat.FillGradientType;
+ item->set4ColorGeometry(FPoint(0, 0), FPoint(item->width(), 0), FPoint(item->width(), item->height()), FPoint(0, item->height()));
+ item->set4ColorColors(txDat.GrColorP1, txDat.GrColorP2, txDat.GrColorP3, txDat.GrColorP4);
+ }
if (txDat.GradMask > 0)
{
item->GrMask = txDat.GradMask;
@@ -2215,6 +2237,38 @@
}
}
+void XarPlug::handleFourColorGradient(QDataStream &ts)
+{
+ XarStyle *gc = m_gc.top();
+ double b1x, b1y, b2x, b2y, b3x, b3y;
+ qint32 colRef1, colRef2, colRef3, colRef4;
+ readCoords(ts, b1x, b1y);
+ readCoords(ts, b2x, b2y);
+ readCoords(ts, b3x, b3y);
+ ts >> colRef1 >> colRef3 >> colRef4 >> colRef3;
+ gc->GrColorP1 = "Black";
+ gc->GrColorP2 = "Black";
+ gc->GrColorP3 = "Black";
+ gc->GrColorP4 = "Black";
+ if (XarColorMap.contains(colRef1))
+ gc->GrColorP1 = XarColorMap[colRef1].name;
+ if (XarColorMap.contains(colRef2))
+ gc->GrColorP2 = XarColorMap[colRef2].name;
+ if (XarColorMap.contains(colRef3))
+ gc->GrColorP3 = XarColorMap[colRef3].name;
+ if (XarColorMap.contains(colRef4))
+ gc->GrColorP4 = XarColorMap[colRef4].name;
+ gc->FillGradientType = 9;
+ if (textData.count() > 0)
+ {
+ textData.last().FillGradientType = gc->FillGradientType;
+ textData.last().GrColorP1 = gc->GrColorP1;
+ textData.last().GrColorP2 = gc->GrColorP2;
+ textData.last().GrColorP3 = gc->GrColorP3;
+ textData.last().GrColorP4 = gc->GrColorP4;
+ }
+}
+
void XarPlug::handleBitmapFill(QDataStream &ts, quint32 dataLen)
{
XarStyle *gc = m_gc.top();
@@ -3360,6 +3414,12 @@
item->fill_gradient = gc->FillGradient;
item->setGradientVector(gc->GradFillX1 - item->xPos(), gc->GradFillY1 - item->yPos(), gc->GradFillX2 - item->xPos(), gc->GradFillY2 - item->yPos(), gc->GradFillX1 - item->xPos(), gc->GradFillY1 - item->yPos(), gc->GrScale, gc->GrSkew);
}
+ if (gc->FillGradientType == 9)
+ {
+ item->GrType = gc->FillGradientType;
+ item->set4ColorGeometry(FPoint(0, 0), FPoint(item->width(), 0), FPoint(item->width(), item->height()), FPoint(0, item->height()));
+ item->set4ColorColors(gc->GrColorP1, gc->GrColorP2, gc->GrColorP3, gc->GrColorP4);
+ }
if (gc->GradMask > 0)
{
item->GrMask = gc->GradMask;
Index: scribus/plugins/import/xar/importxar.h
===================================================================
--- scribus/plugins/import/xar/importxar.h (revision 14961)
+++ scribus/plugins/import/xar/importxar.h (revision 14962)
@@ -110,6 +110,22 @@
patternSkewYS(0),
patternSpace(0),
patternStrokePath(false),
+ GrControl1(FPoint()),
+ GrControl2(FPoint()),
+ GrControl3(FPoint()),
+ GrControl4(FPoint()),
+ GrColorP1(""),
+ GrColorP2(""),
+ GrColorP3(""),
+ GrColorP4(""),
+ GrCol1transp(1.0),
+ GrCol2transp(1.0),
+ GrCol3transp(1.0),
+ GrCol4transp(1.0),
+ GrCol1Shade(100),
+ GrCol2Shade(100),
+ GrCol3Shade(100),
+ GrCol4Shade(100),
Elements()
{
}
@@ -185,6 +201,22 @@
double patternSkewYS;
double patternSpace;
bool patternStrokePath;
+ FPoint GrControl1;
+ FPoint GrControl2;
+ FPoint GrControl3;
+ FPoint GrControl4;
+ QString GrColorP1;
+ QString GrColorP2;
+ QString GrColorP3;
+ QString GrColorP4;
+ double GrCol1transp;
+ double GrCol2transp;
+ double GrCol3transp;
+ double GrCol4transp;
+ int GrCol1Shade;
+ int GrCol2Shade;
+ int GrCol3Shade;
+ int GrCol4Shade;
QList<PageItem*> Elements;
};
@@ -258,6 +290,7 @@
void handleMultiGradient(QDataStream &ts, bool linear);
void handleSimpleGradientSkewed(QDataStream &ts, quint32 dataLen);
void handleSimpleGradient(QDataStream &ts, quint32 dataLen, bool linear);
+ void handleFourColorGradient(QDataStream &ts);
void handleBitmapFill(QDataStream &ts, quint32 dataLen);
void handleContoneBitmapFill(QDataStream &ts, quint32 dataLen);
void handleBitmap(QDataStream &ts);
@@ -351,6 +384,22 @@
double GradFillY2;
double GrScale;
double GrSkew;
+ FPoint GrControl1;
+ FPoint GrControl2;
+ FPoint GrControl3;
+ FPoint GrControl4;
+ QString GrColorP1;
+ QString GrColorP2;
+ QString GrColorP3;
+ QString GrColorP4;
+ double GrCol1transp;
+ double GrCol2transp;
+ double GrCol3transp;
+ double GrCol4transp;
+ int GrCol1Shade;
+ int GrCol2Shade;
+ int GrCol3Shade;
+ int GrCol4Shade;
double GradStrokeX1;
double GradStrokeX2;
double GradStrokeY1;
More information about the scribus-commit
mailing list