r13915 by fschmid - WPG-Import: fixed incorrect fill for WPG1 polylines, fixed incorrect positions for Ellipse and Rectangle.
scribus-commit
scribus-commit at lists.scribus.net
Wed Aug 26 05:57:27 CEST 2009
Revision: 13915
Author: fschmid
Date: 2009-08-25T11:40:30.458402Z
Commit message: WPG-Import: fixed incorrect fill for WPG1 polylines, fixed incorrect positions for Ellipse and Rectangle.
Changeset:
M /trunk/Scribus/scribus/plugins/wpgimplugin/importwpg.cpp
M /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/WPG1Parser.cpp
M /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/WPG2Parser.cpp
M /trunk/Scribus/scribus/plugins/wpgimplugin/wpg/WPGPaintInterface.h
M /trunk/Scribus/scribus/plugins/wpgimplugin/importwpg.h
Diffs:
Index: scribus/plugins/wpgimplugin/importwpg.cpp
===================================================================
--- scribus/plugins/wpgimplugin/importwpg.cpp (revision 13914)
+++ scribus/plugins/wpgimplugin/importwpg.cpp (revision 13915)
@@ -298,6 +298,7 @@
QMatrix mm = QMatrix();
mm.translate(72*rect.x1, 72*rect.y1);
ite->PoLine.map(mm);
+ ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
finishItem(ite);
}
@@ -306,12 +307,13 @@
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX, baseY, rx * 144.0, ry * 144.0, LineW, CurrColorFill, CurrColorStroke, true);
PageItem *ite = m_Doc->Items->at(z);
QMatrix mm = QMatrix();
- mm.translate(72*center.x, 72*center.y);
+ mm.translate(72*(center.x - rx), 72*(center.y - ry));
ite->PoLine.map(mm);
+ ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
finishItem(ite);
}
-void ScrPainter::drawPolygon(const libwpg::WPGPointArray& vertices)
+void ScrPainter::drawPolygon(const libwpg::WPGPointArray& vertices, bool closed)
{
if(vertices.count() < 2)
return;
@@ -323,10 +325,15 @@
{
Coords.svgLineTo(72 * vertices[i].x, 72 * vertices[i].y);
}
- Coords.svgClosePath();
+ if (closed)
+ Coords.svgClosePath();
if (Coords.size() > 0)
{
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
+ int z;
+ if (closed)
+ z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
+ else
+ z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
ite = m_Doc->Items->at(z);
ite->PoLine = Coords.copy();
ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
Index: scribus/plugins/wpgimplugin/wpg/WPG1Parser.cpp
===================================================================
--- scribus/plugins/wpgimplugin/wpg/WPG1Parser.cpp (revision 13914)
+++ scribus/plugins/wpgimplugin/wpg/WPG1Parser.cpp (revision 13915)
@@ -366,7 +366,7 @@
m_painter->setBrush(m_brush);
m_painter->setPen(m_pen);
- m_painter->drawPolygon(points);
+ m_painter->drawPolygon(points, true);
WPG_DEBUG_MSG(("Line\n"));
WPG_DEBUG_MSG((" Starting point: %d,%d\n", sx, sy));
@@ -389,7 +389,7 @@
m_painter->setBrush(libwpg::WPGBrush()); // not filled
m_painter->setPen(m_pen);
- m_painter->drawPolygon(points);
+ m_painter->drawPolygon(points, false);
WPG_DEBUG_MSG(("Polyline\n"));
}
@@ -436,7 +436,7 @@
m_painter->setBrush(m_brush);
m_painter->setPen(m_pen);
- m_painter->drawPolygon(points);
+ m_painter->drawPolygon(points, true);
WPG_DEBUG_MSG(("Polygon\n"));
}
Index: scribus/plugins/wpgimplugin/wpg/WPG2Parser.cpp
===================================================================
--- scribus/plugins/wpgimplugin/wpg/WPG2Parser.cpp (revision 13914)
+++ scribus/plugins/wpgimplugin/wpg/WPG2Parser.cpp (revision 13915)
@@ -1317,7 +1317,7 @@
m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill);
else
m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill);
- m_painter->drawPolygon(points);
+ m_painter->drawPolygon(points, objCh.filled);
}
WPG_DEBUG_MSG((" Vertices count : %li\n", count));
Index: scribus/plugins/wpgimplugin/wpg/WPGPaintInterface.h
===================================================================
--- scribus/plugins/wpgimplugin/wpg/WPGPaintInterface.h (revision 13914)
+++ scribus/plugins/wpgimplugin/wpg/WPGPaintInterface.h (revision 13915)
@@ -60,7 +60,7 @@
virtual void drawEllipse(const WPGPoint& center, double rx, double ry) = 0;
- virtual void drawPolygon(const WPGPointArray& vertices) = 0;
+ virtual void drawPolygon(const WPGPointArray& vertices, bool closed) = 0;
virtual void drawPath(const WPGPath& path) = 0;
Index: scribus/plugins/wpgimplugin/importwpg.h
===================================================================
--- scribus/plugins/wpgimplugin/importwpg.h (revision 13914)
+++ scribus/plugins/wpgimplugin/importwpg.h (revision 13915)
@@ -41,7 +41,7 @@
void setFillRule(FillRule rule);
void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry);
void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry);
- void drawPolygon(const libwpg::WPGPointArray& vertices);
+ void drawPolygon(const libwpg::WPGPointArray& vertices, bool closed);
void drawPath(const libwpg::WPGPath& path);
void drawBitmap(const libwpg::WPGBitmap& bitmap, double hres, double vres);
void drawImageObject(const libwpg::WPGBinaryData& binaryData);
More information about the scribus-commit
mailing list