Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6669/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGBrush.cpp WPGBrush.h WPGPaintInterface.h WPGPen.cpp WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: some cosmetic changes + change of default constructor of WPGBrush + distinguish between polyline and polygon and add a callback for the polyline Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGBrush.h 14 Dec 2006 14:39:57 -0000 1.5 +++ WPGBrush.h 11 Jul 2008 22:19:09 -0000 1.6 @@ -51,6 +51,8 @@ WPGGradient gradient; WPGBrush(); + + WPGBrush(WPGBrushStyle brushStyle); explicit WPGBrush(const WPGColor& fore); Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- WPGBrush.cpp 15 Dec 2006 18:06:00 -0000 1.2 +++ WPGBrush.cpp 11 Jul 2008 22:19:09 -0000 1.3 @@ -26,7 +26,14 @@ #include "WPGBrush.h" libwpg::WPGBrush::WPGBrush(): - style(Solid), + style(NoBrush), + foreColor(0,0,0), + backColor(0xFF,0xFF,0xFF), + gradient() +{} + +libwpg::WPGBrush::WPGBrush(libwpg::WPGBrush::WPGBrushStyle brushStyle): + style(brushStyle), foreColor(0,0,0), backColor(0xFF,0xFF,0xFF), gradient() Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGSVGGenerator.h 10 Jul 2008 19:39:06 -0000 1.8 +++ WPGSVGGenerator.h 11 Jul 2008 22:19:09 -0000 1.9 @@ -52,6 +52,7 @@ void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); + void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); void drawBitmap(const libwpg::WPGBitmap& bitmap); @@ -63,6 +64,7 @@ FillRule m_fillRule; int m_gradientIndex; void writeStyle(); + void drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed); std::ostream & m_outputSink; }; Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGSVGGenerator.cpp 3 Apr 2008 09:28:35 -0000 1.12 +++ WPGSVGGenerator.cpp 11 Jul 2008 22:19:09 -0000 1.13 @@ -162,8 +162,18 @@ m_outputSink << "/>\n"; } +void libwpg::WPGSVGGenerator::drawPolyline(const libwpg::WPGPointArray& vertices) +{ + drawPolySomething(vertices, false); +} + void libwpg::WPGSVGGenerator::drawPolygon(const libwpg::WPGPointArray& vertices) { + drawPolySomething(vertices, true); +} + +void libwpg::WPGSVGGenerator::drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed) +{ if(vertices.count() < 2) return; @@ -179,7 +189,11 @@ } else { - m_outputSink << "<polygon "; + if (isClosed) + m_outputSink << "<polygon "; + else + m_outputSink << "<polyline "; + m_outputSink << "points=\""; for(unsigned i = 0; i < vertices.count(); i++) { @@ -260,8 +274,12 @@ m_outputSink << "style=\""; const libwpg::WPGColor& color = m_pen.foreColor; - m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; if(m_pen.width > 0.0) + m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; + else if(m_pen.solid) + m_outputSink << "stroke-width: 0.72; "; + + if(m_pen.width > 0.0 || m_pen.solid) { m_outputSink << "stroke: rgb(" << color.red << "," << color.green << "," << color.blue << "); "; if(color.alpha != 0) @@ -284,10 +302,13 @@ if(m_brush.style == libwpg::WPGBrush::NoBrush) m_outputSink << "fill: none; "; - if(m_fillRule == WPGSVGGenerator::WindingFill) - m_outputSink << "fill-rule: nonzero; "; - else if(m_fillRule == WPGSVGGenerator::AlternatingFill) - m_outputSink << "fill-rule: evenodd; "; + if(m_brush.style == libwpg::WPGBrush::Pattern) + { + if(m_fillRule == WPGSVGGenerator::WindingFill) + m_outputSink << "fill-rule: nonzero; "; + else if(m_fillRule == WPGSVGGenerator::AlternatingFill) + m_outputSink << "fill-rule: evenodd; "; + } if(m_brush.style == libwpg::WPGBrush::Gradient) m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGPaintInterface.h 10 Jul 2008 19:39:06 -0000 1.8 +++ WPGPaintInterface.h 11 Jul 2008 22:19:09 -0000 1.9 @@ -66,6 +66,8 @@ virtual void drawPolygon(const WPGPointArray& vertices) = 0; + virtual void drawPolyline(const WPGPointArray& vertices) = 0; + virtual void drawPath(const WPGPath& path) = 0; virtual void drawBitmap(const WPGBitmap& bitmap) = 0; Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGPen.cpp 9 May 2007 22:34:09 -0000 1.6 +++ WPGPen.cpp 11 Jul 2008 22:19:09 -0000 1.7 @@ -79,7 +79,7 @@ width(0), height(0), solid(true) , - dashArray(WPGDashArray()) + dashArray() { } @@ -89,7 +89,7 @@ width(0), height(0), solid(true), - dashArray(WPGDashArray()) + dashArray() { } @@ -99,7 +99,7 @@ width(0), height(0), solid(true) , - dashArray(WPGDashArray()) + dashArray() { } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- WPG2Parser.cpp 9 Jul 2008 14:46:22 -0000 1.67 +++ WPG2Parser.cpp 11 Jul 2008 22:19:09 -0000 1.68 @@ -215,7 +215,7 @@ m_width(0), m_height(0), m_doublePrecision(false), m_pen(), - m_brush(), + m_brush(libwpg::WPGBrush::Solid), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -329,8 +329,8 @@ // default style m_pen.foreColor = libwpg::WPGColor(0,0,0); m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.001; - m_pen.height = 0.001; + m_pen.width = 0.01; + m_pen.height = 0.01; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); m_brush.foreColor = libwpg::WPGColor(0,0,0); @@ -1188,7 +1188,10 @@ m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); else m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); - m_painter->drawPolygon(points); + if (objCh.filled || objCh.closed) + m_painter->drawPolygon(points); + else + m_painter->drawPolyline(points); } WPG_DEBUG_MSG((" Vertices count : %li\n", count)); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- WPG1Parser.cpp 11 Jul 2008 14:45:13 -0000 1.36 +++ WPG1Parser.cpp 11 Jul 2008 22:19:08 -0000 1.37 @@ -140,7 +140,7 @@ m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), m_width(0), m_height(0), - m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()) + m_pen(), m_brush(libwpg::WPGBrush(libwpg::WPGBrush::Solid)) { } @@ -184,8 +184,8 @@ // default style m_pen.foreColor = libwpg::WPGColor(0,0,0); m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.001; - m_pen.height = 0.001; + m_pen.width = 0.01; + m_pen.height = 0.01; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); m_brush.foreColor = libwpg::WPGColor(0,0,0); @@ -348,7 +348,7 @@ m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawPolygon(points); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Line\n")); WPG_DEBUG_MSG((" Starting point: %d,%d\n", sx, sy)); @@ -371,7 +371,7 @@ m_painter->setBrush(libwpg::WPGBrush()); // not filled m_painter->setPen(m_pen); - m_painter->drawPolygon(points); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Polyline\n")); } |