From: Fridrich S. <str...@us...> - 2008-07-16 14:11:04
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16996/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: rotate ellipses + make the generated svg look cute Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGPaintInterface.h 11 Jul 2008 22:19:09 -0000 1.9 +++ WPGPaintInterface.h 16 Jul 2008 14:10:59 -0000 1.10 @@ -62,7 +62,7 @@ virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; - virtual void drawEllipse(const WPGPoint& center, double rx, double ry) = 0; + virtual void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to) = 0; virtual void drawPolygon(const WPGPointArray& vertices) = 0; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- WPG2Parser.cpp 16 Jul 2008 09:57:28 -0000 1.69 +++ WPG2Parser.cpp 16 Jul 2008 14:10:59 -0000 1.70 @@ -1316,18 +1316,16 @@ long ey = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ex,ey); - if((ix==ex) && (iy==ey)) - { - libwpg::WPGPoint center; - center.x = TO_DOUBLE(cx) / m_xres; - center.y = TO_DOUBLE(cy) / m_xres; - double rx = TO_DOUBLE(radx) / m_xres; - double ry = TO_DOUBLE(rady) / m_xres; + libwpg::WPGPoint center; + center.x = TO_DOUBLE(cx) / m_xres; + center.y = TO_DOUBLE(cy) / m_xres; + double rx = TO_DOUBLE(radx) / m_xres; + double ry = TO_DOUBLE(rady) / m_xres; - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); - m_painter->drawEllipse(center, rx, ry); - } + m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->drawEllipse(center, rx, ry, objCh.rotate ? objCh.rotationAngle : 0.0, + libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres)); WPG_DEBUG_MSG((" Center point x : %li\n", cx)); WPG_DEBUG_MSG((" Center point y : %li\n", cy)); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- WPG1Parser.cpp 16 Jul 2008 10:48:19 -0000 1.39 +++ WPG1Parser.cpp 16 Jul 2008 14:10:59 -0000 1.40 @@ -447,13 +447,12 @@ int cy = readS16(); int rx = readS16(); int ry = readS16(); + double rotation = (double)readS16(); #if 0 - int rotation = readS16(); int beginAngle = readS16(); int endAngle = readS16(); unsigned flags = readU16(); #endif - libwpg::WPGPoint center; center.x = (double)cx/1200.0; center.y = (double)(m_height-cy)/1200.0; @@ -463,7 +462,7 @@ m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawEllipse(center, radx, rady); + m_painter->drawEllipse(center, radx, rady, (double)rotation, libwpg::WPGPoint(), libwpg::WPGPoint()); WPG_DEBUG_MSG(("Ellipse\n")); WPG_DEBUG_MSG((" Center point: %d,%d\n", cx, cy)); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGSVGGenerator.h 11 Jul 2008 22:19:09 -0000 1.9 +++ WPGSVGGenerator.h 16 Jul 2008 14:10:59 -0000 1.10 @@ -51,7 +51,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 drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to); void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- WPGSVGGenerator.cpp 16 Jul 2008 09:57:28 -0000 1.14 +++ WPGSVGGenerator.cpp 16 Jul 2008 14:10:59 -0000 1.15 @@ -153,12 +153,16 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawEllipse(const libwpg::WPGPoint& center, double rx, double ry) +void libwpg::WPGSVGGenerator::drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& /* from */, const WPGPoint& /* to */) { m_outputSink << "<ellipse "; m_outputSink << "cx=\"" << doubleToString(72*center.x) << "\" cy=\"" << doubleToString(72*center.y) << "\" "; m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; writeStyle(); + if (rotation > 0.0) + m_outputSink << " transform=\" translate(" << doubleToString(72*center.x) << ", " << doubleToString(72*center.y) + << ") rotate(" << doubleToString(-rotation) << ") translate(" << doubleToString(-72*center.x) << ", " << doubleToString(-72*center.y) + << ")\" "; m_outputSink << "/>\n"; } |