Update of /cvsroot/libwpg/libwpg/src/lib
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv22380/src/lib
Modified Files:
WPG2Parser.cpp WPGSVGGenerator.cpp
Log Message:
converting partial ellipse to elliptical arc
Index: WPG2Parser.cpp
===================================================================
RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- WPG2Parser.cpp 6 Jun 2010 21:58:51 -0000 1.106
+++ WPG2Parser.cpp 7 Jun 2010 12:47:48 -0000 1.107
@@ -1559,29 +1559,60 @@
long cx = (m_doublePrecision) ? readS32() : readS16();
long cy = (m_doublePrecision) ? readS32() : readS16();
- TRANSFORM_XY(cx,cy);
long radx = (m_doublePrecision) ? readS32() : readS16();
long rady = (m_doublePrecision) ? readS32() : readS16();
long ix = (m_doublePrecision) ? readS32() : readS16();
+ ix += cx;
long iy = (m_doublePrecision) ? readS32() : readS16();
- TRANSFORM_XY(ix,iy);
+ iy += cy;
long ex = (m_doublePrecision) ? readS32() : readS16();
+ ex += cx;
long ey = (m_doublePrecision) ? readS32() : readS16();
- TRANSFORM_XY(ex,ey);
+ ey += cy;
- ::WPXPropertyList propList;
- propList.insert("svg:cx", (TO_DOUBLE(cx) / m_xres));
- propList.insert("svg:cy", (TO_DOUBLE(cy) / m_xres));
- propList.insert("svg:rx", (TO_DOUBLE(radx) / m_xres));
- propList.insert("svg:ry", (TO_DOUBLE(rady) / m_xres));
- if (objCh.rotate)
- propList.insert("libwpg:rotate", objCh.rotationAngle, WPX_GENERIC);
+ TRANSFORM_XY(cx,cy);
+ TRANSFORM_XY(ix,iy);
+ TRANSFORM_XY(ex,ey);
m_painter->setStyle( objCh.filled ? m_gradient : ::WPXPropertyListVector(), tmpStyle );
- m_painter->drawEllipse(propList);
+
+ if (ix == ex && iy == ey)
+ {
+ ::WPXPropertyList propList;
+ propList.insert("svg:cx", (TO_DOUBLE(cx) / m_xres));
+ propList.insert("svg:cy", (TO_DOUBLE(cy) / m_xres));
+ propList.insert("svg:rx", (TO_DOUBLE(radx) / m_xres));
+ propList.insert("svg:ry", (TO_DOUBLE(rady) / m_xres));
+ if (objCh.rotate)
+ propList.insert("libwpg:rotate", objCh.rotationAngle, WPX_GENERIC);
+
+ m_painter->drawEllipse(propList);
+ }
+ else
+ {
+ ::WPXPropertyList element;
+ ::WPXPropertyListVector path;
+
+ element.insert("libwpg:path-action", "M");
+ element.insert("svg:x", (TO_DOUBLE(ix)/m_xres));
+ element.insert("svg:y", (TO_DOUBLE(iy)/m_yres));
+ path.append(element);
+ element.clear();
+
+ element.insert("libwpg:path-action", "A");
+ element.insert("svg:rx", (TO_DOUBLE(radx)/m_xres));
+ element.insert("svg:ry", (TO_DOUBLE(rady)/m_yres));
+ element.insert("svg:x", (TO_DOUBLE(ex)/m_xres));
+ element.insert("svg:y", (TO_DOUBLE(ey)/m_yres));
+ if (objCh.rotate)
+ element.insert("libwpg:rotate", objCh.rotationAngle, WPX_GENERIC);
+ path.append(element);
+
+ m_painter->drawPath(path);
+ }
WPG_DEBUG_MSG((" Center point x : %li\n", cx));
WPG_DEBUG_MSG((" Center point y : %li\n", cy));
Index: WPGSVGGenerator.cpp
===================================================================
RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- WPGSVGGenerator.cpp 4 Jun 2010 09:23:13 -0000 1.36
+++ WPGSVGGenerator.cpp 7 Jun 2010 12:47:51 -0000 1.37
@@ -221,6 +221,14 @@
m_outputSink << doubleToString(72*(propList["svg:x2"]->getDouble())) << "," << doubleToString(72*(propList["svg:y2"]->getDouble())) << " ";
m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble()));
}
+ else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "A")
+ {
+ m_outputSink << "\nA";
+ m_outputSink << doubleToString(72*(propList["svg:rx"]->getDouble())) << "," << doubleToString(72*(propList["svg:ry"]->getDouble())) << " ";
+ m_outputSink << (propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getStr().cstr() : "0") << " ";
+ m_outputSink << "0,0 ";
+ m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble()));
+ }
else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" )
{
isClosed = true;
|