You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(31) |
Jul
(37) |
Aug
(20) |
Sep
(20) |
Oct
(16) |
Nov
(10) |
Dec
(16) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(11) |
May
(136) |
Jun
(61) |
Jul
(42) |
Aug
(21) |
Sep
(25) |
Oct
(43) |
Nov
(5) |
Dec
(24) |
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(11) |
May
|
Jun
|
Jul
(51) |
Aug
(6) |
Sep
|
Oct
|
Nov
(21) |
Dec
(35) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(35) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
From: Fridrich S. <str...@us...> - 2008-12-05 19:07:57
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1240/src/lib Removed Files: WPGBrush.cpp WPGBrush.h WPGPen.cpp WPGPen.h Log Message: removing unused files --- WPGBrush.h DELETED --- --- WPGBrush.cpp DELETED --- --- WPGPen.cpp DELETED --- --- WPGPen.h DELETED --- |
From: Fridrich S. <str...@us...> - 2008-12-05 18:45:05
|
Update of /cvsroot/libwpg/perfectspot/cmake In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26584/cmake Removed Files: FindLibWpd.cmake FindLibWpg.cmake Log Message: use a newer cmake macro for pkg-config stuff --- FindLibWpg.cmake DELETED --- --- FindLibWpd.cmake DELETED --- |
From: Fridrich S. <str...@us...> - 2008-12-05 18:45:04
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26584/src Modified Files: CMakeLists.txt Log Message: use a newer cmake macro for pkg-config stuff Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/CMakeLists.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- CMakeLists.txt 1 Dec 2008 16:20:39 -0000 1.10 +++ CMakeLists.txt 5 Dec 2008 18:44:56 -0000 1.11 @@ -35,9 +35,9 @@ add_executable(perfectspot ${perfectspot_SOURCES} ${perfectspot_RESOURCES_SOURCES}) IF (NOT WIN32) -target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES}) +target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LDFLAGS} ${LIBWPD_LDFLAGS} ${LIBWPD_STREAM_LDFLAGS}) ELSE (NOT WIN32) -target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES} -mwindows) +target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LDFLAGS} ${LIBWPD_LDFLAGS} ${LIBWPD_STREAM_LDFLAGS} -mwindows) ENDIF (NOT WIN32) install(TARGETS ${PROGNAME} DESTINATION bin) |
From: Fridrich S. <str...@us...> - 2008-12-05 18:45:02
|
Update of /cvsroot/libwpg/perfectspot In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26584 Modified Files: CMakeLists.txt Log Message: use a newer cmake macro for pkg-config stuff Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/libwpg/perfectspot/CMakeLists.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CMakeLists.txt 28 Nov 2008 15:09:15 -0000 1.4 +++ CMakeLists.txt 5 Dec 2008 18:44:55 -0000 1.5 @@ -6,11 +6,13 @@ set(CMAKE_COLOR_MAKEFILE ON) set(CMAKE_VERBOSE_MAKEFILE OFF) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) -set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(FindLibWpd) -include(FindLibWpg) -include_directories(${LIBWPD_INCLUDE_DIR}/libwpd-0.9 ${LIBWPG_INCLUDE_DIR}/libwpg-0.2) +INCLUDE(FindPkgConfig) +pkg_check_modules(LIBWPG REQUIRED libwpg-0.2) +pkg_check_modules(LIBWPD REQUIRED libwpd-0.9) +pkg_check_modules(LIBWPD_STREAM REQUIRED libwpd-stream-0.9) + +include_directories(${LIBWPG_INCLUDE_DIRS} ${LIBWPD_INCLUDE_DIRS} ${LIBWPD_STREAM_INCLUDE_DIRS}) set(QT_MIN_VERSION "4.1.0") find_package(Qt4 REQUIRED) |
From: Fridrich S. <str...@us...> - 2008-12-05 15:18:31
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12779/src Modified Files: renderer.cpp Log Message: committing work done in the train while having wireless access Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- renderer.cpp 5 Dec 2008 00:55:48 -0000 1.17 +++ renderer.cpp 5 Dec 2008 15:18:24 -0000 1.18 @@ -27,6 +27,7 @@ #include <libwpg/libwpg.h> +#include <libwpd/libwpd.h> #include <libwpd-stream/libwpd-stream.h> #include <QtGui> @@ -51,7 +52,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} void endEmbeddedGraphics() {} - void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGDashArray& pen, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -83,22 +84,26 @@ m_zoomY = m_target->viewport().height() / height; } -void Painter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) +void Painter::setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList) { QPen ppen(Qt::SolidLine); - ppen.setWidth((int)(pen.width * m_zoomX)); - if(pen.width == 0) + if (propList["svg:stroke-width"]) + ppen.setWidth((int)((propList["svg:stroke-width"]->getDouble()) * m_zoomX)); + if(!propList["svg:stroke-width"] || propList["svg:stroke-width"]->getDouble() == 0) ppen.setStyle(Qt::NoPen); - QColor cPen(pen.foreColor.cstr()); - ppen.setColor(cPen); + if (propList["svg:stroke-color"]) + { + QColor cPen(propList["svg:stroke-color"]->getStr().cstr()); + ppen.setColor(cPen); + } - if(!pen.solid) + if(!propList["libwpg:stroke-solid"] || !propList["libwpg:stroke-solid"]->getInt()) { QVector<qreal> dashes; - for(unsigned i = 0; i < pen.dashArray.count(); i++) - dashes.append(pen.dashArray.at(i)); + for(unsigned i = 0; i < dashArray.count(); i++) + dashes.append(dashArray.at(i)); ppen.setDashPattern(dashes); } @@ -106,8 +111,11 @@ QBrush pbrush(Qt::SolidPattern); - QColor cBrush(brush.foreColor.cstr()); - pbrush.setColor(cBrush); + if (propList["draw:fill-color"]) + { + QColor cBrush(propList["draw:fill-color"]->getStr().cstr()); + pbrush.setColor(cBrush); + } if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "none") pbrush.setStyle(Qt::NoBrush); @@ -117,8 +125,6 @@ if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") { - WPGGradient gradient = brush.gradient; - QLinearGradient pgradient(0, 0, 0, 1); for(unsigned c = 0; c < gradient.count(); c++) pgradient.setColorAt(gradient.stopOffset(c), QColor(gradient.stopColor(c).cstr())); |
From: Fridrich S. <str...@us...> - 2008-12-05 15:18:30
|
Update of /cvsroot/libwpg/perfectspot/src/odg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12779/src/odg Modified Files: OdgExporter.cxx OdgExporter.hxx Log Message: committing work done in the train while having wireless access Index: OdgExporter.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- OdgExporter.cxx 5 Dec 2008 00:55:48 -0000 1.10 +++ OdgExporter.cxx 5 Dec 2008 15:18:24 -0000 1.11 @@ -242,11 +242,11 @@ mpHandler->endDocument(); } -void OdgExporter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList & propList) +void OdgExporter::setStyle(const libwpg::WPGDashArray& pen, const libwpg::WPGGradient& gradient, const ::WPXPropertyList & propList) { mxStyle = propList; - mxPen = pen; - mxBrush = brush; + mxDashArray = pen; + mxGradient = gradient; } void OdgExporter::startLayer(const ::WPXPropertyList & /* propList */) @@ -270,7 +270,7 @@ pDrawRectElement->addAttribute("svg:height", propList["svg:height"]->getStr()); // FIXME: what to do when rx != ry ? if (propList["svg:rx"]) - pDrawRectElement->addAttribute("draw:corner-radius", propList["svg:rx"]->getStr()); + pDrawRectElement->addAttribute("draw:corner-radius", propList["svg:rx"]->getStr()); else pDrawRectElement->addAttribute("draw:corner-radius", "0.0000in"); mBodyElements.push_back(pDrawRectElement); @@ -495,12 +495,12 @@ void OdgExporter::writeGraphicsStyle() { - if(!mxPen.solid && (mxPen.dashArray.count() >=2 ) ) + if(!(mxStyle["libwpg:stroke-solid"] && mxStyle["libwpg:stroke-solid"]->getInt()) && (mxDashArray.count() >=2 ) ) { // ODG only supports dashes with the same length of spaces inbetween // here we take the first space and assume everything else the same // note that dash length is written in percentage ????????????????? - double distance = mxPen.dashArray.at(1); + double distance = mxDashArray.at(1); TagOpenElement *pDrawStrokeDashElement = new TagOpenElement("draw:stroke-dash"); pDrawStrokeDashElement->addAttribute("draw:style", "rect"); WPXString sValue; @@ -511,19 +511,19 @@ WPXString sName; // We have to find out how to do this intelligently, since the ODF is allowing only // two pairs draw:dots1 draw:dots1-length and draw:dots2 draw:dots2-length - for(unsigned i = 0; i < mxPen.dashArray.count()/2 && i < 2; i++) + for(unsigned i = 0; i < mxDashArray.count()/2 && i < 2; i++) { sName.sprintf("draw:dots%i", i+1); pDrawStrokeDashElement->addAttribute(sName.cstr(), "1"); sName.sprintf("draw:dots%i-length", i+1); - sValue = doubleToString(mxPen.dashArray.at(i*2)); sValue.append("in"); + sValue = doubleToString(mxDashArray.at(i*2)); sValue.append("in"); pDrawStrokeDashElement->addAttribute(sName.cstr(), sValue); } mGraphicsStrokeDashStyles.push_back(pDrawStrokeDashElement); mGraphicsStrokeDashStyles.push_back(new TagCloseElement("draw:stroke-dash")); } - if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient" && mxGradient.count() >= 2) { TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient"); pDrawGradientElement->addAttribute("draw:style", "linear"); @@ -532,7 +532,7 @@ pDrawGradientElement->addAttribute("draw:name", sValue); // ODG angle unit is 0.1 degree - double angle = -mxBrush.gradient.angle(); + double angle = -mxGradient.angle(); while(angle < 0) angle += 360; while(angle > 360) @@ -541,8 +541,8 @@ sValue.sprintf("%i", (unsigned)(angle*10)); pDrawGradientElement->addAttribute("draw:angle", sValue); - pDrawGradientElement->addAttribute("draw:start-color", mxBrush.gradient.stopColor(0).cstr()); - pDrawGradientElement->addAttribute("draw:end-color", mxBrush.gradient.stopColor(1).cstr()); + pDrawGradientElement->addAttribute("draw:start-color", mxGradient.stopColor(0).cstr()); + pDrawGradientElement->addAttribute("draw:end-color", mxGradient.stopColor(1).cstr()); pDrawGradientElement->addAttribute("draw:start-intensity", "100%"); pDrawGradientElement->addAttribute("draw:end-intensity", "100%"); pDrawGradientElement->addAttribute("draw:border", "0%"); @@ -560,14 +560,17 @@ TagOpenElement *pStyleGraphicsPropertiesElement = new TagOpenElement("style:graphic-properties"); - if(mxPen.width > 0.0) + if(!(mxStyle["draw:stroke"] && mxStyle["draw:stroke"]->getStr() == "none") && mxStyle["svg:stroke-width"] && mxStyle["svg:stroke-width"]->getDouble() > 0.0) { - sValue = doubleToString(mxPen.width); sValue.append("in"); - pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-width", sValue); + pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-width", mxStyle["svg:stroke-width"]->getStr()); - pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-color", mxPen.foreColor.cstr()); + if (mxStyle["svg:stroke-color"]) + pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-color", mxStyle["svg:stroke-color"]->getStr()); + if (mxStyle["svg:stroke-opacity"] && mxStyle["svg:stroke-opacity"]->getDouble() != 1.0) + pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-opacity", mxStyle["svg:stroke-opacity"]->getStr()); + - if(!mxPen.solid) + if(!mxStyle["libwpg:stroke-solid"] || !mxStyle["libwpg:stroke-solid"]->getInt()) { pStyleGraphicsPropertiesElement->addAttribute("draw:stroke", "dash"); sValue.sprintf("Dash_%i", miDashIndex-1); @@ -583,7 +586,10 @@ if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "solid") { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "solid"); - pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", mxBrush.foreColor.cstr()); + if (mxStyle["draw:fill-color"]) + pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", mxStyle["draw:fill-color"]->getStr()); + if (mxStyle["draw:opacity"] && mxStyle["draw:opacity"]->getDouble() != 1.0) + pStyleGraphicsPropertiesElement->addAttribute("draw:opacity", mxStyle["draw:opacity"]->getStr()); } if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") Index: OdgExporter.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.hxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- OdgExporter.hxx 5 Dec 2008 00:55:48 -0000 1.6 +++ OdgExporter.hxx 5 Dec 2008 15:18:24 -0000 1.7 @@ -47,7 +47,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} void endEmbeddedGraphics() {} - void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList &propList); @@ -72,8 +72,8 @@ FileOutputHandler *mpHandler; ::WPXPropertyList mxStyle; - libwpg::WPGPen mxPen; - libwpg::WPGBrush mxBrush; + libwpg::WPGDashArray mxDashArray; + libwpg::WPGGradient mxGradient; int miGradientIndex; int miDashIndex; int miGraphicsStyleIndex; |
From: Fridrich S. <str...@us...> - 2008-12-05 15:17:33
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12685/src/conv/raw Modified Files: wpg2raw.cpp Log Message: committing work done in the train while having wireless access Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- wpg2raw.cpp 5 Dec 2008 00:53:49 -0000 1.21 +++ wpg2raw.cpp 5 Dec 2008 15:17:25 -0000 1.22 @@ -31,7 +31,7 @@ #include "libwpg.h" #include <libwpd-stream/libwpd-stream.h> #include <libwpd/libwpd.h> -#include "WPGBrush.h" +#include "WPGGradient.h" class RawPainter : public libwpg::WPGPaintInterface { public: @@ -44,7 +44,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList& propList); void endEmbeddedGraphics(); - void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -135,18 +135,15 @@ printf("RawPainter::endEmbeddedGraphics \n"); } -void RawPainter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) +void RawPainter::setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList) { - libwpg::WPGBrush tmpBrush = brush; + libwpg::WPGGradient tmpGradient = gradient; printf("RawPainter::setStyle(%s)\n", getPropString(propList).cstr()); - printf(" Foreground color: RGB %s Opacity %f\n", tmpBrush.foreColor.cstr(), tmpBrush.foreOpacity); - printf(" Background color: RGB %s Opacity %f\n", tmpBrush.backColor.cstr(), tmpBrush.backOpacity); - if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") - for(unsigned c = 0; c < tmpBrush.gradient.count(); c++) + for(unsigned c = 0; c < tmpGradient.count(); c++) printf(" Gradient stop %d: %f RGB %s Opacity %f\n", c+1, - tmpBrush.gradient.stopOffset(c), tmpBrush.gradient.stopColor(c).cstr(), tmpBrush.gradient.stopOpacity(c)); + tmpGradient.stopOffset(c), tmpGradient.stopColor(c).cstr(), tmpGradient.stopOpacity(c)); } void RawPainter::drawRectangle(const ::WPXPropertyList &propList) |
From: Fridrich S. <str...@us...> - 2008-12-05 15:17:33
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12685/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGColor.cpp WPGGradient.cpp WPGPaintInterface.h WPGPen.cpp WPGPen.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in Log Message: committing work done in the train while having wireless access Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- WPG2Parser.h 5 Dec 2008 00:53:49 -0000 1.34 +++ WPG2Parser.h 5 Dec 2008 15:17:25 -0000 1.35 @@ -29,8 +29,8 @@ #define __WPG2PARSER_H__ #include "WPGXParser.h" -#include "WPGBrush.h" -#include "WPGPen.h" +#include "WPGGradient.h" +#include "WPGDashArray.h" #include "WPGBitmap.h" #include <libwpd/libwpd.h> @@ -215,8 +215,12 @@ long m_height; bool m_doublePrecision; ::WPXPropertyList m_style; - libwpg::WPGPen m_pen; - libwpg::WPGBrush m_brush; + libwpg::WPGColor m_penForeColor; + libwpg::WPGColor m_penBackColor; + libwpg::WPGColor m_brushForeColor; + libwpg::WPGColor m_brushBackColor; + libwpg::WPGDashArray m_dashArray; + libwpg::WPGGradient m_gradient; std::map<unsigned int,libwpg::WPGDashArray> m_penStyles; bool m_layerOpened; unsigned int m_layerId; Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- WPG1Parser.cpp 5 Dec 2008 00:53:49 -0000 1.57 +++ WPG1Parser.cpp 5 Dec 2008 15:17:25 -0000 1.58 @@ -142,9 +142,17 @@ m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), m_width(0), m_height(0), m_style(), - m_pen(), m_brush() + m_penForeColor(0,0,0), + m_penBackColor(0xff,0xff,0xff), + m_brushForeColor(0,0,0), + m_brushBackColor(0xff,0xff,0xff), + m_dashArray(), m_gradient() { m_style.insert("draw:fill", "solid"); + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); } bool WPG1Parser::parse() @@ -198,14 +206,18 @@ m_graphicsStarted = false; // default style - m_pen.foreColor = "#000000"; - m_pen.backColor = "#000000"; - m_pen.width = 0.001; - m_pen.height = 0.001; - m_pen.solid = true; - m_pen.dashArray = libwpg::WPGDashArray(); - m_brush.foreColor = "#000000"; - m_brush.backColor = "#000000"; + m_penForeColor = libwpg::WPGColor(0,0,0); + m_penBackColor = libwpg::WPGColor(0,0,0); + m_style.insert("svg:stroke-width", 0.001); +// m_pen.height = 0.001; + m_style.insert("libwpg:stroke-solid", true); + m_dashArray = libwpg::WPGDashArray(); + m_brushForeColor = libwpg::WPGColor(0,0,0); + m_brushBackColor = libwpg::WPGColor(0,0,0); + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); resetPalette(); while(!m_input->atEOS()) @@ -327,8 +339,9 @@ if(style == 1) m_style.insert("draw:fill", "solid"); - m_brush.foreColor = m_colorPalette[color].getColorString(); - m_brush.foreOpacity = m_colorPalette[color].getOpacity() + m_brushForeColor = m_colorPalette[color]; + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); WPG_DEBUG_MSG(("Fill Attributes\n")); WPG_DEBUG_MSG((" Fill style: %d\n", style)); @@ -343,13 +356,15 @@ unsigned char color = readU8(); unsigned int width = readU16(); - m_pen.solid = style != 0; - m_pen.foreColor = m_colorPalette[color].getColorString(); - m_pen.foreOpacity = m_colorPalette[color].getOpacity(); - if (!width && m_pen.solid) - m_pen.width = 0.001; + m_style.insert("libwpg:stroke-solid", style); + m_penForeColor = m_colorPalette[color]; + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); + + if (!m_style["svg:stroke-width"]->getInt() && m_style["libwpg:stroke-solid"]->getInt()) + m_style.insert("svg:stroke-width", 0.001); else - m_pen.width = (double)width / 1200.0; + m_style.insert("svg:stroke-width", (double)width / 1200.0); WPG_DEBUG_MSG(("Line Attributes\n")); WPG_DEBUG_MSG((" Line style: %d\n", style)); @@ -376,7 +391,7 @@ point.insert("svg:y", (double)(m_height-ey)/1200.0); points.append(point); - m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->setStyle(m_dashArray, m_gradient, m_style); m_painter->drawPolyline(points); @@ -403,7 +418,7 @@ points.append(point); } - m_painter->setStyle(m_pen, libwpg::WPGBrush(),::WPXPropertyList()); + m_painter->setStyle(m_dashArray, libwpg::WPGGradient(), m_style); m_painter->drawPolyline(points); @@ -426,7 +441,7 @@ propList.insert("svg:width", (double)w/1200.0); propList.insert("svg:height",(double)h/1200.0); - m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->setStyle(m_dashArray, m_gradient, m_style); m_painter->drawRectangle(propList); @@ -454,7 +469,7 @@ points.append(point); } - m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->setStyle(m_dashArray, m_gradient, m_style); m_painter->drawPolygon(points); @@ -478,14 +493,14 @@ int endAngle = readS16(); unsigned flags = readU16(); #endif - m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->setStyle(m_dashArray, m_gradient, m_style); m_painter->drawEllipse(propList); WPG_DEBUG_MSG(("Ellipse\n")); - WPG_DEBUG_MSG((" Center point: %d,%d\n", cx, cy)); - WPG_DEBUG_MSG((" Radius x: %d\n", rx)); - WPG_DEBUG_MSG((" Radius y: %d\n", ry)); + WPG_DEBUG_MSG((" Center point: %f,%f\n", propList["svg:cx"]->getDouble(), propList["svg:cy"]->getDouble())); + WPG_DEBUG_MSG((" Radius x: %f\n", propList["svg:rx"]->getDouble())); + WPG_DEBUG_MSG((" Radius y: %f\n", propList["svg:ry"]->getDouble())); } void WPG1Parser::handleCurvedPolyline() @@ -526,7 +541,7 @@ } - m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->setStyle(m_dashArray, m_gradient, m_style); m_painter->drawPath(path); Index: WPGGradient.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGGradient.cpp 3 Dec 2008 23:05:05 -0000 1.8 +++ WPGGradient.cpp 5 Dec 2008 15:17:25 -0000 1.9 @@ -46,8 +46,9 @@ { public: WPGGradientPrivate() : - gradientStops(std::vector<WPGGradientStop>()), - angle(0.0) {}; + gradientStops(), + angle(0.0) {}; + std::vector<WPGGradientStop> gradientStops; double angle; }; Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WPGSVGGenerator.h 5 Dec 2008 00:53:49 -0000 1.19 +++ WPGSVGGenerator.h 5 Dec 2008 15:17:26 -0000 1.20 @@ -47,7 +47,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} - void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -57,8 +57,8 @@ void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: - libwpg::WPGPen m_pen; - libwpg::WPGBrush m_brush; + libwpg::WPGDashArray m_dashArray; + libwpg::WPGGradient m_gradient; ::WPXPropertyList m_style; int m_gradientIndex; void writeStyle(bool isClosed=true); Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- WPG1Parser.h 5 Dec 2008 00:53:49 -0000 1.21 +++ WPG1Parser.h 5 Dec 2008 15:17:25 -0000 1.22 @@ -29,8 +29,8 @@ #define __WPG1PARSER_H__ #include "WPGXParser.h" -#include "WPGBrush.h" -#include "WPGPen.h" +#include "WPGGradient.h" +#include "WPGDashArray.h" #include "WPGBitmap.h" #include <vector> @@ -74,8 +74,12 @@ int m_width; int m_height; ::WPXPropertyList m_style; - libwpg::WPGPen m_pen; - libwpg::WPGBrush m_brush; + libwpg::WPGColor m_penForeColor; + libwpg::WPGColor m_penBackColor; + libwpg::WPGColor m_brushForeColor; + libwpg::WPGColor m_brushBackColor; + libwpg::WPGDashArray m_dashArray; + libwpg::WPGGradient m_gradient; }; #endif // __WPG1PARSER_H__ Index: WPGColor.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGColor.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPGColor.cpp 3 Dec 2008 23:05:05 -0000 1.3 +++ WPGColor.cpp 5 Dec 2008 15:17:25 -0000 1.4 @@ -29,14 +29,14 @@ red(0), green(0), blue(0), - alpha(1) + alpha(0xff) {} libwpg::WPGColor::WPGColor(int r, int g, int b): red(r), green(g), blue(b), - alpha(1) + alpha(0xff) {} libwpg::WPGColor::WPGColor(int r, int g, int b, int a): @@ -71,5 +71,5 @@ double libwpg::WPGColor::getOpacity() const { - return 1.0 - ((double)alpha/256.0); + return ((double)alpha/255.0); } Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- WPGSVGGenerator.cpp 5 Dec 2008 00:53:49 -0000 1.29 +++ WPGSVGGenerator.cpp 5 Dec 2008 15:17:25 -0000 1.30 @@ -47,7 +47,7 @@ } -libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_style(), m_gradientIndex(1), m_outputSink(output_sink) +libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_dashArray(), m_gradient(), m_style(), m_gradientIndex(1), m_outputSink(output_sink) { } @@ -79,25 +79,27 @@ m_outputSink << "</svg>\n"; } -void libwpg::WPGSVGGenerator::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) +void libwpg::WPGSVGGenerator::setStyle(const libwpg::WPGDashArray& dashArray, const libwpg::WPGGradient& gradient, const ::WPXPropertyList &propList) { - m_pen = pen; + m_style = propList; - m_brush = brush; + m_dashArray = dashArray; + + m_gradient = gradient; if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") { - double angle = m_brush.gradient.angle(); + double angle = m_gradient.angle(); m_outputSink << "<defs>\n"; m_outputSink << " <linearGradient id=\"grad" << m_gradientIndex++ << "\" >\n"; - for(unsigned c = 0; c < m_brush.gradient.count(); c++) + for(unsigned c = 0; c < m_gradient.count(); c++) { // round to nearest percentage - int ofs = (int)((100.0*m_brush.gradient.stopOffset(c))+0.5); + int ofs = (int)((100.0*m_gradient.stopOffset(c))+0.5); - ::WPXString color = m_brush.gradient.stopColor(c); - double opacity = m_brush.gradient.stopOpacity(c); + ::WPXString color = m_gradient.stopColor(c); + double opacity = m_gradient.stopOpacity(c); m_outputSink << " <stop offset=\"" << ofs << "%\""; // set stream to %02x formatting @@ -129,8 +131,6 @@ m_outputSink << "</defs>\n"; } - m_style = propList; - } void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) @@ -268,25 +268,25 @@ { m_outputSink << "style=\""; - ::WPXString color = m_pen.foreColor; - double opacity = m_pen.foreOpacity; - m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; +// ::WPXString color = m_dashArray.foreColor; +// double opacity = m_dashArray.foreOpacity; + m_outputSink << "stroke-width: " << doubleToString(72*m_style["svg:stroke-width"]->getDouble()) << "; "; - if(m_pen.width > 0.0 || m_pen.solid) + if(m_style["svg:stroke-width"]->getDouble() > 0.0 || m_style["libwpg:stroke-solid"]->getInt()) { - m_outputSink << "stroke: " << color.cstr() << "; "; - if(opacity != 1.0) - // alpha = 0 means opacity = 1.0, alpha = 256 means opacity = 0 - m_outputSink << "stroke-opacity: " << doubleToString(opacity) << "; "; + if (m_style["svg:stroke-color"]) + m_outputSink << "stroke: " << m_style["svg:stroke-color"]->getStr().cstr() << "; "; + if(m_style["svg:stroke-opacity"] && m_style["svg:stroke-opacity"]->getInt()!= 1) + m_outputSink << "stroke-opacity: " << doubleToString(m_style["svg:stroke-opacity"]->getDouble()) << "; "; } - if(!m_pen.solid) + if(!m_style["libwpg:stroke-solid"]->getInt()) { m_outputSink << "stroke-dasharray: "; - for(unsigned i = 0; i < m_pen.dashArray.count(); i++) + for(unsigned i = 0; i < m_dashArray.count(); i++) { - m_outputSink << doubleToString(72*m_pen.dashArray.at(i)*m_pen.width); - if(i < m_pen.dashArray.count()-1) + m_outputSink << doubleToString(72*m_dashArray.at(i)*(m_style["svg:stroke-width"]->getDouble())); + if(i < m_dashArray.count()-1) m_outputSink << ", "; } m_outputSink << "; "; @@ -302,8 +302,8 @@ if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "gradient") m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "solid") - m_outputSink << "fill: " << m_brush.foreColor.cstr() << "; "; + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "solid" && m_style["draw:fill-color"]) + m_outputSink << "fill: " << m_style["draw:fill-color"]->getStr().cstr() << "; "; } m_outputSink << "\""; // style Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- WPGPaintInterface.h 28 Nov 2008 12:25:45 -0000 1.17 +++ WPGPaintInterface.h 5 Dec 2008 15:17:25 -0000 1.18 @@ -28,8 +28,8 @@ #define __WPGPAINTINTERFACE_H__ #include <libwpd/libwpd.h> -#include "WPGBrush.h" -#include "WPGPen.h" +#include "WPGDashArray.h" +#include "WPGGradient.h" namespace libwpg { @@ -41,7 +41,7 @@ // none of the other callback functions will be called before this function is called virtual void startGraphics(const ::WPXPropertyList &propList) = 0; - virtual void setStyle(const WPGPen& pen, const WPGBrush& brush, const ::WPXPropertyList &propList) = 0; + virtual void setStyle(const WPGDashArray& dashArray, const WPGGradient& gradient, const ::WPXPropertyList &propList) = 0; virtual void startLayer(const ::WPXPropertyList& propList) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Makefile.am 4 Dec 2008 23:17:39 -0000 1.34 +++ Makefile.am 5 Dec 2008 15:17:25 -0000 1.35 @@ -24,8 +24,6 @@ libwpg.h \ WPGraphics.h \ WPGDashArray.h \ - WPGPen.h \ - WPGBrush.h \ WPGGradient.h \ WPGPaintInterface.h @@ -36,8 +34,6 @@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_SOURCES = \ WPGraphics.cpp \ - WPGBrush.cpp \ - WPGPen.cpp \ WPGColor.cpp \ WPGDashArray.cpp \ WPGGradient.cpp \ @@ -51,8 +47,6 @@ libwpg.h \ libwpg_utils.h \ WPGColor.h \ - WPGPen.h \ - WPGBrush.h \ WPGGradient.h \ WPGHeader.h \ WPGSVGGenerator.h \ Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- WPGPen.cpp 4 Dec 2008 23:17:39 -0000 1.11 +++ WPGPen.cpp 5 Dec 2008 15:17:25 -0000 1.12 @@ -28,38 +28,17 @@ #include <vector> libwpg::WPGPen::WPGPen(): - foreColor("#000000"), - backColor("#ffffff"), - foreOpacity(1.0), - backOpacity(1.0), - width(0), - height(0), - solid(true) , dashArray() { } libwpg::WPGPen::WPGPen(const WPGPen& pen): - foreColor(pen.foreColor), - backColor(pen.backColor), - foreOpacity(pen.foreOpacity), - backOpacity(pen.backOpacity), - width(pen.width), - height(pen.height), - solid(pen.solid), dashArray(pen.dashArray) { } libwpg::WPGPen& libwpg::WPGPen::operator=(const libwpg::WPGPen& pen) { - foreColor = pen.foreColor; - backColor = pen.backColor; - foreOpacity = pen.foreOpacity; - backOpacity = pen.backOpacity; - width = pen.width; - height = pen.height; - solid = pen.solid; dashArray = pen.dashArray; return *this; } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- WPG2Parser.cpp 5 Dec 2008 00:53:49 -0000 1.95 +++ WPG2Parser.cpp 5 Dec 2008 15:17:25 -0000 1.96 @@ -218,8 +218,12 @@ m_width(0), m_height(0), m_doublePrecision(false), m_style(), - m_pen(), - m_brush(), + m_penForeColor(0,0,0), + m_penBackColor(0xff,0xff,0xff), + m_brushForeColor(0,0,0), + m_brushBackColor(0xff,0xff,0xff), + m_dashArray(), + m_gradient(), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -239,14 +243,20 @@ m_embedded(isEmbedded) { // default style - m_pen.foreColor = "#000000"; - m_pen.backColor = "#ffffff"; - m_pen.width = 0.0; - m_pen.height = 0.0; - m_pen.solid = true; - m_pen.dashArray = libwpg::WPGDashArray(); - m_brush.foreColor = "#000000"; - m_brush.backColor = "#ffffff"; + m_penForeColor = ::libwpg::WPGColor(0,0,0); + m_penBackColor = ::libwpg::WPGColor(0xff,0xff,0xff); + m_style.insert("svg:stroke-width", 0.001); +// m_pen.height = 0.0; + m_style.insert("libwpg:stroke-solid", true); + m_dashArray = libwpg::WPGDashArray(); + m_brushForeColor = ::libwpg::WPGColor(0,0,0); + m_brushBackColor = ::libwpg::WPGColor(0xff,0xff,0xff); + + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); + resetPalette(); m_style.insert("draw:fill", "solid"); } @@ -610,13 +620,12 @@ return; WPGGroupContext& context = m_groupStack.top(); - ::WPXPropertyList fillRule; if(context.compoundWindingRule) - fillRule.insert("svg:fill-rule", "nonzero"); + m_style.insert("svg:fill-rule", "nonzero"); else - fillRule.insert("svg:fill-rule", "evenodd"); + m_style.insert("svg:fill-rule", "evenodd"); - m_painter->setStyle( context.compoundFramed ? m_pen : libwpg::WPGPen(), context.compoundFilled ? m_brush : libwpg::WPGBrush(), fillRule ); + m_painter->setStyle( context.compoundFramed ? m_dashArray : libwpg::WPGDashArray(), context.compoundFilled ? m_gradient : libwpg::WPGGradient(), m_style ); if (context.compoundClosed) { @@ -670,7 +679,7 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); libwpg::WPGColor color(red, green, blue, alpha); m_colorPalette[startIndex+i] = color; WPG_DEBUG_MSG(("Index#%d: RGB %s\n", startIndex+i, color.getColorString().cstr())); @@ -689,7 +698,7 @@ unsigned char red = readU16() >> 8 ; unsigned char green = readU16() >> 8 ; unsigned char blue = readU16() >> 8 ; - unsigned char alpha = readU16() >> 8 ; + unsigned char alpha = 0xff - (readU16() >> 8) ; libwpg::WPGColor color(red, green, blue, alpha); m_colorPalette[startIndex+i] = color; WPG_DEBUG_MSG(("Index#%d: RGB %s\n", startIndex+i, color.getColorString().cstr())); @@ -705,10 +714,9 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); - m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_pen.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity() + m_penForeColor = libwpg::WPGColor(red, green, blue, alpha); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -723,10 +731,9 @@ unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8(); - m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_pen.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + m_penForeColor = libwpg::WPGColor(red, green, blue, alpha); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -740,10 +747,12 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); - m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_pen.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + m_penBackColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -758,10 +767,12 @@ unsigned int red = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int green = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned int alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned int alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8(); - m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_pen.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + m_penBackColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("svg:stroke-color", m_penForeColor.getColorString()); + m_style.insert("svg:stroke-opacity", m_penForeColor.getOpacity(), WPX_PERCENT); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -774,11 +785,11 @@ return; unsigned int style = readU16(); - m_pen.dashArray = m_penStyles[style]; - m_pen.solid = (style == 0); + m_dashArray = m_penStyles[style]; + m_style.insert("libwpg:stroke-solid", !style); WPG_DEBUG_MSG((" Pen style : %d\n", style)); - WPG_DEBUG_MSG((" Segments : %d\n", m_pen.dashArray.count())); + WPG_DEBUG_MSG((" Segments : %d\n", m_dashArray.count())); } void WPG2Parser::handlePenSize() @@ -788,13 +799,13 @@ if (!m_groupStack.empty() && m_groupStack.top().isCompoundPolygon()) return; unsigned int width = readU16(); - unsigned int height = readU16(); +// unsigned int height = readU16(); - m_pen.width = TO_DOUBLE(width) / m_xres; - m_pen.height = TO_DOUBLE(height) / m_yres; + m_style.insert("svg:stroke-width", TO_DOUBLE(width) / m_xres) +// m_pen.height = TO_DOUBLE(height) / m_yres; WPG_DEBUG_MSG((" Width: %d\n", width)); - WPG_DEBUG_MSG((" Height: %d\n", height)); +// WPG_DEBUG_MSG((" Height: %d\n", height)); } void WPG2Parser::handleDPPenSize() @@ -804,13 +815,13 @@ if (!m_groupStack.empty() && m_groupStack.top().isCompoundPolygon()) return; unsigned long width = readU32(); - unsigned long height = readU32(); +// unsigned long height = readU32(); - m_pen.width = TO_DOUBLE(width) / m_xres / 256; - m_pen.height = TO_DOUBLE(height) / m_yres / 256; + m_style.insert("svg:stroke-width", TO_DOUBLE(width) / m_xres / 256); +// m_pen.height = TO_DOUBLE(height) / m_yres / 256; WPG_DEBUG_MSG((" Width: %li\n", width)); - WPG_DEBUG_MSG((" Height: %li\n", height)); +// WPG_DEBUG_MSG((" Height: %li\n", height)); } void WPG2Parser::handleBrushGradient() @@ -887,11 +898,14 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); - m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + m_brushForeColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "gradient") m_style.insert("draw:fill", "solid"); } @@ -909,7 +923,7 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); libwpg::WPGColor color(red, green, blue, alpha); colors.push_back(color); WPG_DEBUG_MSG((" Color #%d (RGBA): %d %d %d %d\n", i+1, red, green, blue, alpha)); @@ -938,7 +952,7 @@ gradient.addStop(ref, colors[0].getColorString(), colors[0].getOpacity()); if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); - m_brush.gradient = gradient; + m_gradient = gradient; m_style.insert("draw:fill", "gradient"); } } @@ -958,11 +972,14 @@ unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8(); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); - m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + m_brushForeColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "none") m_style.insert("draw:fill", "solid"); } @@ -978,7 +995,7 @@ unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8(); libwpg::WPGColor color(red, green, blue, alpha); colors.push_back(color); WPG_DEBUG_MSG((" Color #%d (RGBA): %d %d %d %d\n", i+1, red, green, blue, alpha)); @@ -1006,7 +1023,7 @@ gradient.addStop(ref, colors[0].getColorString(), colors[0].getOpacity()); if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); - m_brush.gradient = gradient; + m_gradient = gradient; m_style.insert("draw:fill", "gradient"); } } @@ -1021,10 +1038,13 @@ unsigned char red = readU8(); unsigned char green = readU8(); unsigned char blue = readU8(); - unsigned char alpha = readU8(); + unsigned char alpha = 0xff - readU8(); + + m_brushBackColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); - m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") m_style.insert("draw:fill", "solid"); @@ -1041,10 +1061,13 @@ unsigned int red = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int green = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned int alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned int alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8(); + + m_brushBackColor = libwpg::WPGColor(red, green, blue, alpha); + + m_style.insert("draw:fill-color", m_brushForeColor.getColorString()); + m_style.insert("draw:opacity", m_brushForeColor.getOpacity(), WPX_PERCENT); - m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); - m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") m_style.insert("draw:fill", "solid"); @@ -1202,14 +1225,13 @@ else { // otherwise draw directly - ::WPXPropertyList fillRule; if (count > 2) { if(objCh.windingRule) - fillRule.insert("svg:fill-rule", "nonzero"); + m_style.insert("svg:fill-rule", "nonzero"); else - fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); + m_style.insert("svg:fill-rule", "evenodd"); + m_painter->setStyle( objCh.framed ? m_dashArray : libwpg::WPGDashArray(), objCh.filled ? m_gradient : libwpg::WPGGradient(), m_style ); if (objCh.filled || objCh.closed) m_painter->drawPolygon(points); else @@ -1217,14 +1239,14 @@ } else { - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), libwpg::WPGBrush(), fillRule ); + m_painter->setStyle( objCh.framed ? m_dashArray : libwpg::WPGDashArray(), libwpg::WPGGradient(), m_style ); m_painter->drawPolyline(points); } } WPG_DEBUG_MSG((" Vertices count : %li\n", count)); for(unsigned int j = 0; j < count; j++ ) - WPG_DEBUG_MSG((" Point #%d : %g,%g\n", j+1, points[j].x, points[j].y)); + WPG_DEBUG_MSG((" Point #%d : %g,%g\n", j+1, points[j]["svg:x"]->getDouble(), points[j]["svg:x"]->getDouble())); } void WPG2Parser::handlePolyspline() @@ -1303,12 +1325,11 @@ else { // otherwise draw directly - ::WPXPropertyList fillRule; if(objCh.windingRule) - fillRule.insert("svg:fill-rule", "nonzero"); + m_style.insert("svg:fill-rule", "nonzero"); else - fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); + m_style.insert("svg:fill-rule", "evenodd"); + m_painter->setStyle( objCh.framed ? m_dashArray : libwpg::WPGDashArray(), objCh.filled ? m_gradient : libwpg::WPGGradient(), m_style ); m_painter->drawPath(path); } } @@ -1346,7 +1367,7 @@ propList.insert("svg:rx", (TO_DOUBLE(rx)/m_xres)); propList.insert("svg:ry", (TO_DOUBLE(ry)/m_yres)); - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); + m_painter->setStyle( objCh.framed ? m_dashArray : libwpg::WPGDashArray(), objCh.filled ? m_gradient : libwpg::WPGGradient(), m_style ); m_painter->drawRectangle(propList); WPG_DEBUG_MSG((" X1 : %li\n", x1)); @@ -1388,7 +1409,7 @@ if (objCh.rotate) propList.insert("libwpg:rotate", (double)(objCh.rotationAngle)); - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); + m_painter->setStyle( objCh.framed ? m_dashArray : libwpg::WPGDashArray(), objCh.filled ? m_gradient : libwpg::WPGGradient(), m_style ); m_painter->drawEllipse(propList /* TODO: fix this: libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres) */); @@ -1791,19 +1812,6 @@ m_painter->drawImageObject(propList, bitmap.getDIB()); } - -#ifdef DEBUG - // debugging only - if(buffer.size() && 0) - { - for(unsigned long x = 0; x < width; x++) - for(unsigned long y = 0; y < height; y++) - { - libwpg::WPGColor color = bitmap.pixel(x,y); - WPG_DEBUG_MSG((" pixel at %li, %li: %3d %3d %3d\n", x, y, color.red, color.green, color.blue)); - } - } -#endif } void WPG2Parser::handleObjectCapsule() @@ -1912,7 +1920,7 @@ propList.insert("svg:height", (m_binaryData.y2 - m_binaryData.y1)); propList.insert("libwpg:mime-type", m_binaryData.mimeTypes[m_binaryData.objectIndex]); - WPG_DEBUG_MSG(("Image Object Mime Type : %s\n", binaryData.mimeType.cstr())); + WPG_DEBUG_MSG(("Image Object Mime Type : %s\n", propList["libwpg:mime-type"]->getStr().cstr())); ::WPXBinaryData binaryData; while (!m_input->atEOS() && m_input->tell() <= m_recordEnd) Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- libwpg.h.in 4 Dec 2008 23:17:39 -0000 1.12 +++ libwpg.h.in 5 Dec 2008 15:17:26 -0000 1.13 @@ -35,8 +35,7 @@ #include "WPGraphics.h" #include "WPGPaintInterface.h" -#include "WPGPen.h" -#include "WPGBrush.h" +#include "WPGDashArray.h" #include "WPGGradient.h" #endif Index: WPGPen.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGPen.h 4 Dec 2008 23:17:39 -0000 1.7 +++ WPGPen.h 5 Dec 2008 15:17:25 -0000 1.8 @@ -35,13 +35,6 @@ class WPGPen { public: - ::WPXString foreColor; - ::WPXString backColor; - double foreOpacity; - double backOpacity; - double width; - double height; - bool solid; WPGDashArray dashArray; WPGPen(); |
From: Fridrich S. <str...@us...> - 2008-12-05 00:55:55
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21411/src Modified Files: renderer.cpp Log Message: WPGBrush::style went, so learn to live without it Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- renderer.cpp 5 Dec 2008 00:14:35 -0000 1.16 +++ renderer.cpp 5 Dec 2008 00:55:48 -0000 1.17 @@ -109,13 +109,13 @@ QColor cBrush(brush.foreColor.cstr()); pbrush.setColor(cBrush); - if(brush.style == "none") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "none") pbrush.setStyle(Qt::NoBrush); - if(brush.style == "solid") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "solid") pbrush.setStyle(Qt::SolidPattern); - if(brush.style == "gradient") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") { WPGGradient gradient = brush.gradient; |
From: Fridrich S. <str...@us...> - 2008-12-05 00:55:55
|
Update of /cvsroot/libwpg/perfectspot/src/odg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21411/src/odg Modified Files: OdgExporter.cxx OdgExporter.hxx Log Message: WPGBrush::style went, so learn to live without it Index: OdgExporter.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- OdgExporter.cxx 5 Dec 2008 00:14:35 -0000 1.9 +++ OdgExporter.cxx 5 Dec 2008 00:55:48 -0000 1.10 @@ -242,8 +242,9 @@ mpHandler->endDocument(); } -void OdgExporter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList & /*propList*/) +void OdgExporter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList & propList) { + mxStyle = propList; mxPen = pen; mxBrush = brush; } @@ -522,7 +523,7 @@ mGraphicsStrokeDashStyles.push_back(new TagCloseElement("draw:stroke-dash")); } - if(mxBrush.style == "gradient") + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") { TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient"); pDrawGradientElement->addAttribute("draw:style", "linear"); @@ -576,16 +577,16 @@ else pStyleGraphicsPropertiesElement->addAttribute("draw:stroke", "none"); - if(mxBrush.style == "none") + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "none") pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "none"); - if(mxBrush.style == "solid") + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "solid") { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "solid"); pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", mxBrush.foreColor.cstr()); } - if(mxBrush.style == "gradient") + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "gradient"); sValue.sprintf("Gradient_%i", miGradientIndex-1); Index: OdgExporter.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.hxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- OdgExporter.hxx 28 Nov 2008 15:09:15 -0000 1.5 +++ OdgExporter.hxx 5 Dec 2008 00:55:48 -0000 1.6 @@ -71,6 +71,7 @@ FileOutputHandler *mpHandler; + ::WPXPropertyList mxStyle; libwpg::WPGPen mxPen; libwpg::WPGBrush mxBrush; int miGradientIndex; |
From: Fridrich S. <str...@us...> - 2008-12-05 00:54:01
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21256/src/conv/raw Modified Files: wpg2raw.cpp Log Message: moving the brush style information out from the WPGBrush class (making the class meager so that it can be removed at one point) Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- wpg2raw.cpp 4 Dec 2008 23:17:39 -0000 1.20 +++ wpg2raw.cpp 5 Dec 2008 00:53:49 -0000 1.21 @@ -140,19 +140,10 @@ libwpg::WPGBrush tmpBrush = brush; printf("RawPainter::setStyle(%s)\n", getPropString(propList).cstr()); - printf(" Brush style: "); - - if (tmpBrush.style == "none" || tmpBrush.style == "solid" || tmpBrush.style == "bitmap" || tmpBrush.style == "gradient") - printf(tmpBrush.style.cstr()); - else - printf("unknown"); - - printf("\n"); - printf(" Foreground color: RGB %s Opacity %f\n", tmpBrush.foreColor.cstr(), tmpBrush.foreOpacity); printf(" Background color: RGB %s Opacity %f\n", tmpBrush.backColor.cstr(), tmpBrush.backOpacity); - if(tmpBrush.style == "gradient") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") for(unsigned c = 0; c < tmpBrush.gradient.count(); c++) printf(" Gradient stop %d: %f RGB %s Opacity %f\n", c+1, tmpBrush.gradient.stopOffset(c), tmpBrush.gradient.stopColor(c).cstr(), tmpBrush.gradient.stopOpacity(c)); |
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21256/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGBrush.cpp WPGBrush.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: moving the brush style information out from the WPGBrush class (making the class meager so that it can be removed at one point) Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGBrush.h 4 Dec 2008 23:17:39 -0000 1.9 +++ WPGBrush.h 5 Dec 2008 00:53:49 -0000 1.10 @@ -35,7 +35,6 @@ class WPGBrush { public: - ::WPXString style; ::WPXString foreColor; ::WPXString backColor; double foreOpacity; @@ -45,8 +44,6 @@ WPGBrush(); - WPGBrush(const ::WPXString& brushStyle); - WPGBrush(const WPGBrush& brush); WPGBrush& operator=(const WPGBrush& brush); Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- WPG2Parser.h 3 Dec 2008 13:41:29 -0000 1.33 +++ WPG2Parser.h 5 Dec 2008 00:53:49 -0000 1.34 @@ -214,6 +214,7 @@ long m_width; long m_height; bool m_doublePrecision; + ::WPXPropertyList m_style; libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; std::map<unsigned int,libwpg::WPGDashArray> m_penStyles; Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGBrush.cpp 4 Dec 2008 23:17:39 -0000 1.6 +++ WPGBrush.cpp 5 Dec 2008 00:53:49 -0000 1.7 @@ -26,16 +26,6 @@ #include "WPGBrush.h" libwpg::WPGBrush::WPGBrush(): - style("none"), - foreColor("#000000"), - backColor("#ffffff"), - foreOpacity(1.0), - backOpacity(1.0), - gradient() -{} - -libwpg::WPGBrush::WPGBrush(const ::WPXString& brushStyle): - style(brushStyle), foreColor("#000000"), backColor("#ffffff"), foreOpacity(1.0), @@ -44,7 +34,6 @@ {} libwpg::WPGBrush::WPGBrush(const WPGBrush& brush): - style(brush.style), foreColor(brush.foreColor), backColor(brush.backColor), foreOpacity(brush.foreOpacity), @@ -54,7 +43,6 @@ libwpg::WPGBrush& libwpg::WPGBrush::operator=(const libwpg::WPGBrush& brush) { - style = brush.style; foreColor = brush.foreColor; backColor = brush.backColor; foreOpacity = brush.foreOpacity; Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- WPGSVGGenerator.h 4 Dec 2008 10:16:18 -0000 1.18 +++ WPGSVGGenerator.h 5 Dec 2008 00:53:49 -0000 1.19 @@ -59,7 +59,7 @@ private: libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; - ::WPXPropertyList m_fillRule; + ::WPXPropertyList m_style; int m_gradientIndex; void writeStyle(bool isClosed=true); void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- WPG1Parser.h 28 Nov 2008 11:53:03 -0000 1.20 +++ WPG1Parser.h 5 Dec 2008 00:53:49 -0000 1.21 @@ -73,6 +73,7 @@ bool m_graphicsStarted; int m_width; int m_height; + ::WPXPropertyList m_style; libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; }; Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- WPGSVGGenerator.cpp 4 Dec 2008 23:17:39 -0000 1.28 +++ WPGSVGGenerator.cpp 5 Dec 2008 00:53:49 -0000 1.29 @@ -47,7 +47,7 @@ } -libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_fillRule(), m_gradientIndex(1), m_outputSink(output_sink) +libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_style(), m_gradientIndex(1), m_outputSink(output_sink) { } @@ -85,7 +85,7 @@ m_brush = brush; - if(m_brush.style == "gradient") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") { double angle = m_brush.gradient.angle(); @@ -129,7 +129,7 @@ m_outputSink << "</defs>\n"; } - m_fillRule = propList; + m_style = propList; } @@ -292,17 +292,17 @@ m_outputSink << "; "; } - if(!isClosed || m_brush.style == "none") + if(!isClosed || (m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none")) m_outputSink << "fill: none; "; else { - if(m_fillRule["svg:fill-rule"]) - m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; + if(m_style["svg:fill-rule"]) + m_outputSink << "fill-rule: " << m_style["svg:fill-rule"]->getStr().cstr() << "; "; - if(m_brush.style == "gradient") + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "gradient") m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - if(m_brush.style == "solid") + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "solid") m_outputSink << "fill: " << m_brush.foreColor.cstr() << "; "; } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- WPG2Parser.cpp 4 Dec 2008 23:17:39 -0000 1.94 +++ WPG2Parser.cpp 5 Dec 2008 00:53:49 -0000 1.95 @@ -217,8 +217,9 @@ m_xofs(0), m_yofs(0), m_width(0), m_height(0), m_doublePrecision(false), + m_style(), m_pen(), - m_brush("solid"), + m_brush(), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -247,6 +248,7 @@ m_brush.foreColor = "#000000"; m_brush.backColor = "#ffffff"; resetPalette(); + m_style.insert("draw:fill", "solid"); } bool WPG2Parser::parse() @@ -890,8 +892,8 @@ m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(!(m_brush.style == "gradient")) - m_brush.style = "solid"; + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "gradient") + m_style.insert("draw:fill", "solid"); } else { @@ -937,7 +939,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = "gradient"; + m_style.insert("draw:fill", "gradient"); } } } @@ -961,8 +963,8 @@ m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(!(m_brush.style == "none")) - m_brush.style = "solid"; + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "none") + m_style.insert("draw:fill", "solid"); } else { @@ -1005,7 +1007,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = "gradient"; + m_style.insert("draw:fill", "gradient"); } } } @@ -1023,8 +1025,8 @@ m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(m_brush.style == "none") - m_brush.style = "solid"; + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") + m_style.insert("draw:fill", "solid"); WPG_DEBUG_MSG((" Backround color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -1043,8 +1045,8 @@ m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(m_brush.style == "none") - m_brush.style = "solid"; + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") + m_style.insert("draw:fill", "solid"); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- WPG1Parser.cpp 4 Dec 2008 23:17:39 -0000 1.56 +++ WPG1Parser.cpp 5 Dec 2008 00:53:49 -0000 1.57 @@ -141,9 +141,10 @@ WPGXParser(input, painter), m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), - m_width(0), m_height(0), - m_pen(), m_brush("solid") + m_width(0), m_height(0), m_style(), + m_pen(), m_brush() { + m_style.insert("draw:fill", "solid"); } bool WPG1Parser::parse() @@ -322,9 +323,9 @@ unsigned char color = readU8(); if(style == 0) - m_brush.style = "none"; + m_style.insert("draw:fill", "none"); if(style == 1) - m_brush.style = "solid"; + m_style.insert("draw:fill", "solid"); m_brush.foreColor = m_colorPalette[color].getColorString(); m_brush.foreOpacity = m_colorPalette[color].getOpacity() |
From: Fridrich S. <str...@us...> - 2008-12-05 00:14:40
|
Update of /cvsroot/libwpg/perfectspot/src/odg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18793/src/odg Modified Files: OdgExporter.cxx Log Message: adapting to the current state of libwpg api Index: OdgExporter.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- OdgExporter.cxx 28 Nov 2008 15:09:15 -0000 1.8 +++ OdgExporter.cxx 5 Dec 2008 00:14:35 -0000 1.9 @@ -40,8 +40,8 @@ miGradientIndex(1), miDashIndex(1), miGraphicsStyleIndex(1), - mfWidth(0.0f), - mfHeight(0.0f), + mfWidth(0.0), + mfHeight(0.0), mbIsFlatXML(isFlatXML) { } @@ -122,7 +122,7 @@ configItemOpenElement.addAttribute("config:type", "int"); configItemOpenElement.write(mpHandler); if (propList["svg:width"]) - mfWidth = propList["svg:width"]->getFloat(); + mfWidth = propList["svg:width"]->getDouble(); WPXString sWidth; sWidth.sprintf("%li", (unsigned long)(2540 * mfWidth)); mpHandler->characters(sWidth); mpHandler->endElement("config:config-item"); @@ -131,7 +131,7 @@ configItemOpenElement.addAttribute("config:type", "int"); configItemOpenElement.write(mpHandler); if (propList["svg:height"]) - mfHeight = propList["svg:height"]->getFloat(); + mfHeight = propList["svg:height"]->getDouble(); WPXString sHeight; sHeight.sprintf("%li", (unsigned long)(2540 * mfHeight)); mpHandler->characters(sHeight); mpHandler->endElement("config:config-item"); @@ -268,7 +268,10 @@ pDrawRectElement->addAttribute("svg:width", propList["svg:width"]->getStr()); pDrawRectElement->addAttribute("svg:height", propList["svg:height"]->getStr()); // FIXME: what to do when rx != ry ? + if (propList["svg:rx"]) pDrawRectElement->addAttribute("draw:corner-radius", propList["svg:rx"]->getStr()); + else + pDrawRectElement->addAttribute("draw:corner-radius", "0.0000in"); mBodyElements.push_back(pDrawRectElement); mBodyElements.push_back(new TagCloseElement("draw:rect")); } @@ -280,35 +283,35 @@ WPXString sValue; sValue.sprintf("gr%i", miGraphicsStyleIndex-1); pDrawEllipseElement->addAttribute("draw:style-name", sValue); - sValue = doubleToString(2 * propList["svg:rx"]->getFloat()); sValue.append("in"); + sValue = doubleToString(2 * propList["svg:rx"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:width", sValue); - sValue = doubleToString(2 * propList["svg:ry"]->getFloat()); sValue.append("in"); + sValue = doubleToString(2 * propList["svg:ry"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:height", sValue); - if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getFloat() != 0.0) + if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getDouble() != 0.0) { - double rotation = propList["libwpg:rotate"]->getFloat(); + double rotation = propList["libwpg:rotate"]->getDouble(); while(rotation < -180) rotation += 360; while(rotation > 180) rotation -= 360; double radrotation = rotation*M_PI/180.0; - double deltax = sqrt(pow(propList["svg:rx"]->getFloat(), 2.0) - + pow(propList["svg:ry"]->getFloat(), 2.0))*cos(atan(propList["svg:ry"]->getFloat()/propList["svg:rx"]->getFloat()) - - radrotation ) - propList["svg:rx"]->getFloat(); - double deltay = sqrt(pow(propList["svg:rx"]->getFloat(), 2.0) - + pow(propList["svg:ry"]->getFloat(), 2.0))*sin(atan(propList["svg:ry"]->getFloat()/propList["svg:rx"]->getFloat()) - - radrotation ) - propList["svg:ry"]->getFloat(); + double deltax = sqrt(pow(propList["svg:rx"]->getDouble(), 2.0) + + pow(propList["svg:ry"]->getDouble(), 2.0))*cos(atan(propList["svg:ry"]->getDouble()/propList["svg:rx"]->getDouble()) + - radrotation ) - propList["svg:rx"]->getDouble(); + double deltay = sqrt(pow(propList["svg:rx"]->getDouble(), 2.0) + + pow(propList["svg:ry"]->getDouble(), 2.0))*sin(atan(propList["svg:ry"]->getDouble()/propList["svg:rx"]->getDouble()) + - radrotation ) - propList["svg:ry"]->getDouble(); sValue = "rotate("; sValue.append(doubleToString(radrotation)); sValue.append(") "); - sValue.append("translate("); sValue.append(doubleToString(propList["svg:cx"]->getFloat() - propList["svg:rx"]->getFloat() - deltax)); + sValue.append("translate("); sValue.append(doubleToString(propList["svg:cx"]->getDouble() - propList["svg:rx"]->getDouble() - deltax)); sValue.append("in, "); - sValue.append(doubleToString(propList["svg:cy"]->getFloat() - propList["svg:ry"]->getFloat() - deltay)); sValue.append("in)"); + sValue.append(doubleToString(propList["svg:cy"]->getDouble() - propList["svg:ry"]->getDouble() - deltay)); sValue.append("in)"); pDrawEllipseElement->addAttribute("svg:transform", sValue); } else { - sValue = doubleToString(propList["svg:cx"]->getFloat()-propList["svg:rx"]->getFloat()); sValue.append("in"); + sValue = doubleToString(propList["svg:cx"]->getDouble()-propList["svg:rx"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:x", sValue); - sValue = doubleToString(propList["svg:cy"]->getFloat()-propList["svg:ry"]->getFloat()); sValue.append("in"); + sValue = doubleToString(propList["svg:cy"]->getDouble()-propList["svg:ry"]->getDouble()); sValue.append("in"); pDrawEllipseElement->addAttribute("svg:y", sValue); } mBodyElements.push_back(pDrawEllipseElement); @@ -378,28 +381,28 @@ // try to find the bounding box // this is simple convex hull technique, the bounding box might not be // accurate but that should be enough for this purpose - double px = path[0]["svg:x"]->getFloat(); - double py = path[0]["svg:y"]->getFloat(); - double qx = path[0]["svg:x"]->getFloat(); - double qy = path[0]["svg:y"]->getFloat(); + double px = path[0]["svg:x"]->getDouble(); + double py = path[0]["svg:y"]->getDouble(); + double qx = path[0]["svg:x"]->getDouble(); + double qy = path[0]["svg:y"]->getDouble(); for(unsigned k = 0; k < path.count(); k++) { if (!path[k]["svg:x"] || !path[k]["svg:y"]) continue; - px = (px > path[k]["svg:x"]->getFloat()) ? path[k]["svg:x"]->getFloat() : px; - py = (py > path[k]["svg:y"]->getFloat()) ? path[k]["svg:y"]->getFloat() : py; - qx = (qx < path[k]["svg:x"]->getFloat()) ? path[k]["svg:x"]->getFloat() : qx; - qy = (qy < path[k]["svg:y"]->getFloat()) ? path[k]["svg:y"]->getFloat() : qy; + px = (px > path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : px; + py = (py > path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : py; + qx = (qx < path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : qx; + qy = (qy < path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : qy; if(path[k]["libwpg:path-action"]->getStr() == "C") { - px = (px > path[k]["svg:x1"]->getFloat()) ? path[k]["svg:x1"]->getFloat() : px; - py = (py > path[k]["svg:y1"]->getFloat()) ? path[k]["svg:y1"]->getFloat() : py; - qx = (qx < path[k]["svg:x1"]->getFloat()) ? path[k]["svg:x1"]->getFloat() : qx; - qy = (qy < path[k]["svg:y1"]->getFloat()) ? path[k]["svg:y1"]->getFloat() : qy; - px = (px > path[k]["svg:x2"]->getFloat()) ? path[k]["svg:x2"]->getFloat() : px; - py = (py > path[k]["svg:y2"]->getFloat()) ? path[k]["svg:y2"]->getFloat() : py; - qx = (qx < path[k]["svg:x2"]->getFloat()) ? path[k]["svg:x2"]->getFloat() : qx; - qy = (qy < path[k]["svg:y2"]->getFloat()) ? path[k]["svg:y2"]->getFloat() : qy; + px = (px > path[k]["svg:x1"]->getDouble()) ? path[k]["svg:x1"]->getDouble() : px; + py = (py > path[k]["svg:y1"]->getDouble()) ? path[k]["svg:y1"]->getDouble() : py; + qx = (qx < path[k]["svg:x1"]->getDouble()) ? path[k]["svg:x1"]->getDouble() : qx; + qy = (qy < path[k]["svg:y1"]->getDouble()) ? path[k]["svg:y1"]->getDouble() : qy; + px = (px > path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : px; + py = (py > path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : py; + qx = (qx < path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : qx; + qy = (qy < path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : qy; } } double vw = qx - px; @@ -431,22 +434,25 @@ if (path[i]["libwpg:path-action"]->getStr() == "M") { // 2540 is 2.54*1000, 2.54 in = 1 inch - sElement.sprintf("M%i %i", (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("M%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } else if (path[i]["libwpg:path-action"]->getStr() == "L") { - sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } else if (path[i]["libwpg:path-action"]->getStr() == "C") { - sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((path[i]["svg:x1"]->getFloat()-px)*2540), - (int)((path[i]["svg:y1"]->getFloat()-py)*2540), (unsigned)((path[i]["svg:x2"]->getFloat()-px)*2540), - (int)((path[i]["svg:y2"]->getFloat()-py)*2540), (unsigned)((path[i]["svg:x"]->getFloat()-px)*2540), (unsigned)((path[i]["svg:y"]->getFloat()-py)*2540)); + sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((path[i]["svg:x1"]->getDouble()-px)*2540), + (int)((path[i]["svg:y1"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x2"]->getDouble()-px)*2540), + (int)((path[i]["svg:y2"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } - else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i == (path.count() - 1)) + else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i >= (path.count() - 1)) sValue.append(" Z"); } pDrawPathElement->addAttribute("svg:d", sValue); @@ -516,7 +522,7 @@ mGraphicsStrokeDashStyles.push_back(new TagCloseElement("draw:stroke-dash")); } - if(mxBrush.style == libwpg::WPGBrush::Gradient) + if(mxBrush.style == "gradient") { TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient"); pDrawGradientElement->addAttribute("draw:style", "linear"); @@ -534,12 +540,8 @@ sValue.sprintf("%i", (unsigned)(angle*10)); pDrawGradientElement->addAttribute("draw:angle", sValue); - libwpg::WPGColor startColor = mxBrush.gradient.stopColor(0); - libwpg::WPGColor stopColor = mxBrush.gradient.stopColor(1); - sValue.sprintf("#%.2x%.2x%.2x", (startColor.red & 0xff), (startColor.green & 0xff), (startColor.blue & 0xff)); - pDrawGradientElement->addAttribute("draw:start-color", sValue); - sValue.sprintf("#%.2x%.2x%.2x", (stopColor.red & 0xff), (stopColor.green & 0xff), (stopColor.blue & 0xff)); - pDrawGradientElement->addAttribute("draw:end-color", sValue); + pDrawGradientElement->addAttribute("draw:start-color", mxBrush.gradient.stopColor(0).cstr()); + pDrawGradientElement->addAttribute("draw:end-color", mxBrush.gradient.stopColor(1).cstr()); pDrawGradientElement->addAttribute("draw:start-intensity", "100%"); pDrawGradientElement->addAttribute("draw:end-intensity", "100%"); pDrawGradientElement->addAttribute("draw:border", "0%"); @@ -562,9 +564,7 @@ sValue = doubleToString(mxPen.width); sValue.append("in"); pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-width", sValue); - sValue.sprintf("#%.2x%.2x%.2x", (mxPen.foreColor.red & 0xff), - (mxPen.foreColor.green & 0xff), (mxPen.foreColor.blue & 0xff)); - pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-color", sValue); + pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-color", mxPen.foreColor.cstr()); if(!mxPen.solid) { @@ -576,18 +576,16 @@ else pStyleGraphicsPropertiesElement->addAttribute("draw:stroke", "none"); - if(mxBrush.style == libwpg::WPGBrush::NoBrush) + if(mxBrush.style == "none") pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "none"); - if(mxBrush.style == libwpg::WPGBrush::Solid) + if(mxBrush.style == "solid") { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "solid"); - sValue.sprintf("#%.2x%.2x%.2x", (mxBrush.foreColor.red & 0xff), - (mxBrush.foreColor.green & 0xff), (mxBrush.foreColor.blue & 0xff)); - pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", sValue); + pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", mxBrush.foreColor.cstr()); } - if(mxBrush.style == libwpg::WPGBrush::Gradient) + if(mxBrush.style == "gradient") { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "gradient"); sValue.sprintf("Gradient_%i", miGradientIndex-1); |
From: Fridrich S. <str...@us...> - 2008-12-05 00:14:39
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18793/src Modified Files: renderer.cpp Log Message: adapting to the current state of libwpg api Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- renderer.cpp 28 Nov 2008 15:09:15 -0000 1.15 +++ renderer.cpp 5 Dec 2008 00:14:35 -0000 1.16 @@ -76,8 +76,8 @@ void Painter::startGraphics(const ::WPXPropertyList &propList) { - width = propList["svg:width"]->getFloat(); - height = propList["svg:height"]->getFloat(); + width = propList["svg:width"]->getDouble(); + height = propList["svg:height"]->getDouble(); m_zoomX = m_target->viewport().width() / width; m_zoomY = m_target->viewport().height() / height; @@ -91,7 +91,7 @@ if(pen.width == 0) ppen.setStyle(Qt::NoPen); - QColor cPen(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue); + QColor cPen(pen.foreColor.cstr()); ppen.setColor(cPen); if(!pen.solid) @@ -106,25 +106,22 @@ QBrush pbrush(Qt::SolidPattern); - QColor cBrush(brush.foreColor.red, brush.foreColor.green, brush.foreColor.blue); + QColor cBrush(brush.foreColor.cstr()); pbrush.setColor(cBrush); - if(brush.style == WPGBrush::NoBrush) + if(brush.style == "none") pbrush.setStyle(Qt::NoBrush); - if(brush.style == WPGBrush::Solid) + if(brush.style == "solid") pbrush.setStyle(Qt::SolidPattern); - if(brush.style == WPGBrush::Gradient) + if(brush.style == "gradient") { WPGGradient gradient = brush.gradient; QLinearGradient pgradient(0, 0, 0, 1); for(unsigned c = 0; c < gradient.count(); c++) - { - WPGColor cc = gradient.stopColor(c); - pgradient.setColorAt(gradient.stopOffset(c), QColor(cc.red, cc.green, cc. blue)); - } + pgradient.setColorAt(gradient.stopOffset(c), QColor(gradient.stopColor(c).cstr())); #if QT_VERSION >= 0x040300 pgradient.setCoordinateMode(QLinearGradient::ObjectBoundingMode); #endif @@ -156,24 +153,24 @@ void Painter::drawRectangle(const ::WPXPropertyList &propList) { - m_target->drawRoundRect((int)(m_zoomX*propList["svg:x"]->getFloat()), (int)(m_zoomY*propList["svg:y"]->getFloat()), - (int)(m_zoomX*propList["svg:width"]->getFloat()), (int)(m_zoomY*propList["svg:height"]->getFloat()), - (int)(propList["svg:rx"]->getFloat() * 200 / propList["svg:width"]->getFloat()), - (int)(propList["svg:ry"]->getFloat() * 200 / propList["svg:height"]->getFloat())); + m_target->drawRoundRect((int)(m_zoomX*propList["svg:x"]->getDouble()), (int)(m_zoomY*propList["svg:y"]->getDouble()), + (int)(m_zoomX*propList["svg:width"]->getDouble()), (int)(m_zoomY*propList["svg:height"]->getDouble()), + (int)(propList["svg:rx"]->getDouble() * 200 / propList["svg:width"]->getDouble()), + (int)(propList["svg:ry"]->getDouble() * 200 / propList["svg:height"]->getDouble())); } void Painter::drawEllipse(const ::WPXPropertyList &propList) { - m_target->drawEllipse((int)(m_zoomX*(propList["svg:cx"]->getFloat() - propList["svg:rx"]->getFloat())), - (int)(m_zoomY*(propList["svg:cy"]->getFloat() - propList["svg:ry"]->getFloat())), - (int)(2*m_zoomX*propList["svg:rx"]->getFloat()), (int)(2*m_zoomY*propList["svg:ry"]->getFloat())); + m_target->drawEllipse((int)(m_zoomX*(propList["svg:cx"]->getDouble() - propList["svg:rx"]->getDouble())), + (int)(m_zoomY*(propList["svg:cy"]->getDouble() - propList["svg:ry"]->getDouble())), + (int)(2*m_zoomX*propList["svg:rx"]->getDouble()), (int)(2*m_zoomY*propList["svg:ry"]->getDouble())); } void Painter::drawPolygon(const ::WPXPropertyListVector& vertices) { QPointF* points = new QPointF[vertices.count()]; for(unsigned i = 0; i < vertices.count(); i++) - points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getFloat(), m_zoomY*vertices[i]["svg:y"]->getFloat()); + points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getDouble(), m_zoomY*vertices[i]["svg:y"]->getDouble()); m_target->drawPolygon(points, vertices.count()); delete [] points; @@ -183,7 +180,7 @@ { QPointF* points = new QPointF[vertices.count()]; for(unsigned i = 0; i < vertices.count(); i++) - points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getFloat(), m_zoomY*vertices[i]["svg:y"]->getFloat()); + points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getDouble(), m_zoomY*vertices[i]["svg:y"]->getDouble()); m_target->drawPolyline(points, vertices.count()); delete [] points; @@ -195,13 +192,13 @@ for(unsigned i = 0; i < path.count(); i++) { if (path[i]["libwpg:path-action"]->getStr() == "M") - p.moveTo(m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.moveTo(m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "L") - p.lineTo(m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.lineTo(m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "C") - p.cubicTo(m_zoomX*path[i]["svg:x1"]->getFloat(), m_zoomY*path[i]["svg:y1"]->getFloat(), - m_zoomX*path[i]["svg:x2"]->getFloat(), m_zoomY*path[i]["svg:y2"]->getFloat(), - m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.cubicTo(m_zoomX*path[i]["svg:x1"]->getDouble(), m_zoomY*path[i]["svg:y1"]->getDouble(), + m_zoomX*path[i]["svg:x2"]->getDouble(), m_zoomY*path[i]["svg:y2"]->getDouble(), + m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i == path.count()) p.closeSubpath(); } @@ -215,9 +212,9 @@ if (image.isNull()) return; QRectF target; - target.setTopLeft( QPointF(m_zoomX*propList["svg:x"]->getFloat(), m_zoomY*propList["svg:y"]->getFloat()) ); - target.setBottomRight( QPointF(m_zoomX*(propList["svg:x"]->getFloat() + propList["svg:width"]->getFloat()), - m_zoomY*(propList["svg:y"]->getFloat() + propList["svg:height"]->getFloat())) ); + target.setTopLeft( QPointF(m_zoomX*propList["svg:x"]->getDouble(), m_zoomY*propList["svg:y"]->getDouble()) ); + target.setBottomRight( QPointF(m_zoomX*(propList["svg:x"]->getDouble() + propList["svg:width"]->getDouble()), + m_zoomY*(propList["svg:y"]->getDouble() + propList["svg:height"]->getDouble())) ); m_target->drawImage(target, image); } |
From: Fridrich S. <str...@us...> - 2008-12-04 23:17:45
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7706/src/conv/raw Modified Files: wpg2raw.cpp Log Message: remove public access from class WPGColor Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- wpg2raw.cpp 3 Dec 2008 23:05:05 -0000 1.19 +++ wpg2raw.cpp 4 Dec 2008 23:17:39 -0000 1.20 @@ -31,6 +31,7 @@ #include "libwpg.h" #include <libwpd-stream/libwpd-stream.h> #include <libwpd/libwpd.h> +#include "WPGBrush.h" class RawPainter : public libwpg::WPGPaintInterface { public: @@ -136,26 +137,25 @@ void RawPainter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { + libwpg::WPGBrush tmpBrush = brush; printf("RawPainter::setStyle(%s)\n", getPropString(propList).cstr()); printf(" Brush style: "); - switch(brush.style) - { - case libwpg::WPGBrush::NoBrush: printf("none"); break; - case libwpg::WPGBrush::Solid: printf("solid"); break; - case libwpg::WPGBrush::Pattern: printf("pattern"); break; - case libwpg::WPGBrush::Gradient: printf("gradient"); break; - default: printf("unknown"); break; - } + + if (tmpBrush.style == "none" || tmpBrush.style == "solid" || tmpBrush.style == "bitmap" || tmpBrush.style == "gradient") + printf(tmpBrush.style.cstr()); + else + printf("unknown"); + printf("\n"); - printf(" Foreground color: RGB %s\n", brush.foreColor.getColorString().cstr()); - printf(" Background color: RGB %s\n", brush.backColor.getColorString().cstr()); + printf(" Foreground color: RGB %s Opacity %f\n", tmpBrush.foreColor.cstr(), tmpBrush.foreOpacity); + printf(" Background color: RGB %s Opacity %f\n", tmpBrush.backColor.cstr(), tmpBrush.backOpacity); - if(brush.style == libwpg::WPGBrush::Gradient) - for(unsigned c = 0; c < brush.gradient.count(); c++) + if(tmpBrush.style == "gradient") + for(unsigned c = 0; c < tmpBrush.gradient.count(); c++) printf(" Gradient stop %d: %f RGB %s Opacity %f\n", c+1, - brush.gradient.stopOffset(c), brush.gradient.stopColor(c).cstr(), brush.gradient.stopOpacity(c)); + tmpBrush.gradient.stopOffset(c), tmpBrush.gradient.stopColor(c).cstr(), tmpBrush.gradient.stopOpacity(c)); } void RawPainter::drawRectangle(const ::WPXPropertyList &propList) |
From: Fridrich S. <str...@us...> - 2008-12-04 23:17:43
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7706/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPGBrush.cpp WPGBrush.h WPGPen.cpp WPGPen.h WPGSVGGenerator.cpp libwpg.h.in Log Message: remove public access from class WPGColor Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGBrush.h 28 Nov 2008 11:53:03 -0000 1.8 +++ WPGBrush.h 4 Dec 2008 23:17:39 -0000 1.9 @@ -26,7 +26,7 @@ #ifndef __WPGBRUSH_H__ #define __WPGBRUSH_H__ -#include "WPGColor.h" +#include <libwpd/libwpd.h> #include "WPGGradient.h" namespace libwpg @@ -35,24 +35,17 @@ class WPGBrush { public: - - typedef enum - { - NoBrush, - Solid, - Pattern, - Gradient - } WPGBrushStyle; - - WPGBrushStyle style; - WPGColor foreColor; - WPGColor backColor; + ::WPXString style; + ::WPXString foreColor; + ::WPXString backColor; + double foreOpacity; + double backOpacity; WPGGradient gradient; WPGBrush(); - WPGBrush(WPGBrushStyle brushStyle); + WPGBrush(const ::WPXString& brushStyle); WPGBrush(const WPGBrush& brush); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- WPG1Parser.cpp 3 Dec 2008 23:05:05 -0000 1.55 +++ WPG1Parser.cpp 4 Dec 2008 23:17:39 -0000 1.56 @@ -142,7 +142,7 @@ m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), m_width(0), m_height(0), - m_pen(), m_brush(libwpg::WPGBrush(libwpg::WPGBrush::Solid)) + m_pen(), m_brush("solid") { } @@ -197,14 +197,14 @@ m_graphicsStarted = false; // default style - m_pen.foreColor = libwpg::WPGColor(0,0,0); - m_pen.backColor = libwpg::WPGColor(0,0,0); + m_pen.foreColor = "#000000"; + m_pen.backColor = "#000000"; m_pen.width = 0.001; m_pen.height = 0.001; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); - m_brush.foreColor = libwpg::WPGColor(0,0,0); - m_brush.backColor = libwpg::WPGColor(0,0,0); + m_brush.foreColor = "#000000"; + m_brush.backColor = "#000000"; resetPalette(); while(!m_input->atEOS()) @@ -322,11 +322,12 @@ unsigned char color = readU8(); if(style == 0) - m_brush.style = libwpg::WPGBrush::NoBrush; + m_brush.style = "none"; if(style == 1) - m_brush.style = libwpg::WPGBrush::Solid; + m_brush.style = "solid"; - m_brush.foreColor = m_colorPalette[color]; + m_brush.foreColor = m_colorPalette[color].getColorString(); + m_brush.foreOpacity = m_colorPalette[color].getOpacity() WPG_DEBUG_MSG(("Fill Attributes\n")); WPG_DEBUG_MSG((" Fill style: %d\n", style)); @@ -342,7 +343,8 @@ unsigned int width = readU16(); m_pen.solid = style != 0; - m_pen.foreColor = m_colorPalette[color]; + m_pen.foreColor = m_colorPalette[color].getColorString(); + m_pen.foreOpacity = m_colorPalette[color].getOpacity(); if (!width && m_pen.solid) m_pen.width = 0.001; else Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGBrush.cpp 28 Nov 2008 11:53:03 -0000 1.5 +++ WPGBrush.cpp 4 Dec 2008 23:17:39 -0000 1.6 @@ -26,16 +26,20 @@ #include "WPGBrush.h" libwpg::WPGBrush::WPGBrush(): - style(NoBrush), - foreColor(0,0,0), - backColor(0xFF,0xFF,0xFF), + style("none"), + foreColor("#000000"), + backColor("#ffffff"), + foreOpacity(1.0), + backOpacity(1.0), gradient() {} -libwpg::WPGBrush::WPGBrush(libwpg::WPGBrush::WPGBrushStyle brushStyle): +libwpg::WPGBrush::WPGBrush(const ::WPXString& brushStyle): style(brushStyle), - foreColor(0,0,0), - backColor(0xFF,0xFF,0xFF), + foreColor("#000000"), + backColor("#ffffff"), + foreOpacity(1.0), + backOpacity(1.0), gradient() {} @@ -43,6 +47,8 @@ style(brush.style), foreColor(brush.foreColor), backColor(brush.backColor), + foreOpacity(brush.foreOpacity), + backOpacity(brush.backOpacity), gradient(brush.gradient) {} @@ -51,6 +57,8 @@ style = brush.style; foreColor = brush.foreColor; backColor = brush.backColor; + foreOpacity = brush.foreOpacity; + backOpacity = brush.backOpacity; gradient = brush.gradient; return *this; } Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- WPGSVGGenerator.cpp 4 Dec 2008 10:16:18 -0000 1.27 +++ WPGSVGGenerator.cpp 4 Dec 2008 23:17:39 -0000 1.28 @@ -85,7 +85,7 @@ m_brush = brush; - if(m_brush.style == libwpg::WPGBrush::Gradient) + if(m_brush.style == "gradient") { double angle = m_brush.gradient.angle(); @@ -268,15 +268,16 @@ { m_outputSink << "style=\""; - const libwpg::WPGColor& color = m_pen.foreColor; + ::WPXString color = m_pen.foreColor; + double opacity = m_pen.foreOpacity; m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; if(m_pen.width > 0.0 || m_pen.solid) { - m_outputSink << "stroke: " << color.getColorString().cstr() << "; "; - if(color.getOpacity() != 1.0) + m_outputSink << "stroke: " << color.cstr() << "; "; + if(opacity != 1.0) // alpha = 0 means opacity = 1.0, alpha = 256 means opacity = 0 - m_outputSink << "stroke-opacity: " << doubleToString(color.getOpacity()) << "; "; + m_outputSink << "stroke-opacity: " << doubleToString(opacity) << "; "; } if(!m_pen.solid) @@ -291,18 +292,18 @@ m_outputSink << "; "; } - if(!isClosed || m_brush.style == libwpg::WPGBrush::NoBrush) + if(!isClosed || m_brush.style == "none") m_outputSink << "fill: none; "; else { if(m_fillRule["svg:fill-rule"]) m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; - if(m_brush.style == libwpg::WPGBrush::Gradient) + if(m_brush.style == "gradient") m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - if(m_brush.style == libwpg::WPGBrush::Solid) - m_outputSink << "fill: " << m_brush.foreColor.getColorString().cstr() << "; "; + if(m_brush.style == "solid") + m_outputSink << "fill: " << m_brush.foreColor.cstr() << "; "; } m_outputSink << "\""; // style Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Makefile.am 3 Dec 2008 23:14:46 -0000 1.33 +++ Makefile.am 4 Dec 2008 23:17:39 -0000 1.34 @@ -23,7 +23,6 @@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_include_HEADERS = \ libwpg.h \ WPGraphics.h \ - WPGColor.h \ WPGDashArray.h \ WPGPen.h \ WPGBrush.h \ Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- WPGPen.cpp 3 Dec 2008 23:14:46 -0000 1.10 +++ WPGPen.cpp 4 Dec 2008 23:17:39 -0000 1.11 @@ -28,8 +28,10 @@ #include <vector> libwpg::WPGPen::WPGPen(): - foreColor(0,0,0), - backColor(0xFF,0xFF,0xFF), + foreColor("#000000"), + backColor("#ffffff"), + foreOpacity(1.0), + backOpacity(1.0), width(0), height(0), solid(true) , @@ -40,6 +42,8 @@ libwpg::WPGPen::WPGPen(const WPGPen& pen): foreColor(pen.foreColor), backColor(pen.backColor), + foreOpacity(pen.foreOpacity), + backOpacity(pen.backOpacity), width(pen.width), height(pen.height), solid(pen.solid), @@ -51,6 +55,8 @@ { foreColor = pen.foreColor; backColor = pen.backColor; + foreOpacity = pen.foreOpacity; + backOpacity = pen.backOpacity; width = pen.width; height = pen.height; solid = pen.solid; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- WPG2Parser.cpp 4 Dec 2008 10:16:18 -0000 1.93 +++ WPG2Parser.cpp 4 Dec 2008 23:17:39 -0000 1.94 @@ -218,7 +218,7 @@ m_width(0), m_height(0), m_doublePrecision(false), m_pen(), - m_brush(libwpg::WPGBrush::Solid), + m_brush("solid"), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -238,14 +238,14 @@ m_embedded(isEmbedded) { // default style - m_pen.foreColor = libwpg::WPGColor(0,0,0); - m_pen.backColor = libwpg::WPGColor(0xff,0xff,0xff); + m_pen.foreColor = "#000000"; + m_pen.backColor = "#ffffff"; m_pen.width = 0.0; m_pen.height = 0.0; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); - m_brush.foreColor = libwpg::WPGColor(0,0,0); - m_brush.backColor = libwpg::WPGColor(0xff, 0xff, 0xff); + m_brush.foreColor = "#000000"; + m_brush.backColor = "#ffffff"; resetPalette(); } @@ -705,7 +705,8 @@ unsigned char blue = readU8(); unsigned char alpha = readU8(); - m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha); + m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_pen.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity() WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -722,7 +723,8 @@ unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); - m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha); + m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_pen.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -738,7 +740,8 @@ unsigned char blue = readU8(); unsigned char alpha = readU8(); - m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha); + m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_pen.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -755,7 +758,8 @@ unsigned int blue = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); - m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha); + m_pen.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_pen.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -884,9 +888,10 @@ unsigned char alpha = readU8(); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); - m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha); - if(m_brush.style != libwpg::WPGBrush::Gradient) - m_brush.style = libwpg::WPGBrush::Solid; + m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + if(!(m_brush.style == "gradient")) + m_brush.style = "solid"; } else { @@ -932,7 +937,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = libwpg::WPGBrush::Gradient; + m_brush.style = "gradient"; } } } @@ -954,9 +959,10 @@ unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); - m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha); - if(m_brush.style != libwpg::WPGBrush::NoBrush) - m_brush.style = libwpg::WPGBrush::Solid; + m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + if(!(m_brush.style == "none")) + m_brush.style = "solid"; } else { @@ -999,7 +1005,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = libwpg::WPGBrush::Gradient; + m_brush.style = "gradient"; } } } @@ -1015,9 +1021,10 @@ unsigned char blue = readU8(); unsigned char alpha = readU8(); - m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha); - if(m_brush.style == libwpg::WPGBrush::NoBrush) - m_brush.style = libwpg::WPGBrush::Solid; + m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + if(m_brush.style == "none") + m_brush.style = "solid"; WPG_DEBUG_MSG((" Backround color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -1034,9 +1041,10 @@ unsigned int blue = (m_doublePrecision) ? readU16()>>8 : readU8(); unsigned int alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); - m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha); - if(m_brush.style == libwpg::WPGBrush::NoBrush) - m_brush.style = libwpg::WPGBrush::Solid; + m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); + m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); + if(m_brush.style == "none") + m_brush.style = "solid"; WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- libwpg.h.in 28 Nov 2008 11:53:03 -0000 1.11 +++ libwpg.h.in 4 Dec 2008 23:17:39 -0000 1.12 @@ -35,7 +35,6 @@ #include "WPGraphics.h" #include "WPGPaintInterface.h" -#include "WPGColor.h" #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" Index: WPGPen.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGPen.h 3 Dec 2008 23:14:46 -0000 1.6 +++ WPGPen.h 4 Dec 2008 23:17:39 -0000 1.7 @@ -26,7 +26,7 @@ #ifndef __WPGPEN_H__ #define __WPGPEN_H__ -#include "WPGColor.h" +#include <libwpd/libwpd.h> #include "WPGDashArray.h" namespace libwpg @@ -35,8 +35,10 @@ class WPGPen { public: - WPGColor foreColor; - WPGColor backColor; + ::WPXString foreColor; + ::WPXString backColor; + double foreOpacity; + double backOpacity; double width; double height; bool solid; |
From: Fridrich S. <str...@us...> - 2008-12-04 10:16:23
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18363/src/lib Modified Files: WPG2Parser.cpp WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: don't fill straight line + don't fill opened objects Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- WPG2Parser.cpp 3 Dec 2008 23:05:05 -0000 1.92 +++ WPG2Parser.cpp 4 Dec 2008 10:16:18 -0000 1.93 @@ -1193,15 +1193,23 @@ { // otherwise draw directly ::WPXPropertyList fillRule; - if(objCh.windingRule) - fillRule.insert("svg:fill-rule", "nonzero"); - else - fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); - if (objCh.filled || objCh.closed) - m_painter->drawPolygon(points); + if (count > 2) + { + if(objCh.windingRule) + fillRule.insert("svg:fill-rule", "nonzero"); + else + fillRule.insert("svg:fill-rule", "evenodd"); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); + if (objCh.filled || objCh.closed) + m_painter->drawPolygon(points); + else + m_painter->drawPolyline(points); + } else + { + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), libwpg::WPGBrush(), fillRule ); m_painter->drawPolyline(points); + } } WPG_DEBUG_MSG((" Vertices count : %li\n", count)); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- WPGSVGGenerator.h 28 Nov 2008 12:25:45 -0000 1.17 +++ WPGSVGGenerator.h 4 Dec 2008 10:16:18 -0000 1.18 @@ -61,7 +61,7 @@ libwpg::WPGBrush m_brush; ::WPXPropertyList m_fillRule; int m_gradientIndex; - void writeStyle(); + void writeStyle(bool isClosed=true); void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); std::ostream & m_outputSink; Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- WPGSVGGenerator.cpp 3 Dec 2008 23:05:05 -0000 1.26 +++ WPGSVGGenerator.cpp 4 Dec 2008 10:16:18 -0000 1.27 @@ -207,7 +207,7 @@ m_outputSink << ", "; } m_outputSink << "\"\n"; - writeStyle(); + writeStyle(isClosed); m_outputSink << "/>\n"; } } @@ -215,6 +215,7 @@ void libwpg::WPGSVGGenerator::drawPath(const ::WPXPropertyListVector& path) { m_outputSink << "<path d=\" "; + bool isClosed = false; WPXPropertyListVector::Iter i(path); for(unsigned i=0; i < path.count(); i++) { @@ -236,12 +237,15 @@ 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 ((i >= path.count()-1) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" ) + else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" ) + { + isClosed = true; m_outputSink << "\nZ"; + } } m_outputSink << "\" \n"; - writeStyle(); + writeStyle(isClosed); m_outputSink << "/>\n"; } @@ -260,7 +264,7 @@ } // create "style" attribute based on current pen and brush -void libwpg::WPGSVGGenerator::writeStyle() +void libwpg::WPGSVGGenerator::writeStyle(bool isClosed) { m_outputSink << "style=\""; @@ -287,17 +291,19 @@ m_outputSink << "; "; } - if(m_brush.style == libwpg::WPGBrush::NoBrush) + if(!isClosed || m_brush.style == libwpg::WPGBrush::NoBrush) m_outputSink << "fill: none; "; + else + { + if(m_fillRule["svg:fill-rule"]) + m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; - if(m_fillRule["svg:fill-rule"]) - m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; - - if(m_brush.style == libwpg::WPGBrush::Gradient) - m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; + if(m_brush.style == libwpg::WPGBrush::Gradient) + m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - if(m_brush.style == libwpg::WPGBrush::Solid) - m_outputSink << "fill: " << m_brush.foreColor.getColorString().cstr() << "; "; + if(m_brush.style == libwpg::WPGBrush::Solid) + m_outputSink << "fill: " << m_brush.foreColor.getColorString().cstr() << "; "; + } m_outputSink << "\""; // style } |
Update of /cvsroot/libwpg/libwpg/testdocs In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12588 Removed Files: DAISIES.WPG DART.WPG DAVINCI.WPG DC-10.WPG DEER.WPG DEFENSE.WPG DEGREE.WPG DELTA-II.WPG DENMAR-M.WPG DESK-M.WPG DESK-W.WPG DESK.WPG DESSERT.WPG DESTROY.WPG DEVICE-1.WPG DEVICE-2.WPG DEVICE-3.WPG DEVICE-4.WPG DEVICE-5.WPG DIAMND.WPG DIAMOND.WPG DIME.WPG DINOSAUR.WPG DIPLOMA.WPG DISH.WPG DMARK-1.WPG DMARK-2.WPG DNTENTER.WPG DOCTOR-M.WPG DOCTOR-W.WPG DOG.WPG DOLINA.WPG DOLLAR-1.WPG DOLLAR-2.WPG DOLLAR-3.WPG DOLLAR.WPG DOLLR-1.WPG DOLLR-2.WPG DONALD.WPG DOUGHNUT.WPG DRAGON.WPG DRAGSTER.WPG DRAMA.WPG DRAPES.WPG DROP.WPG DRUGS.WPG DUCK.WPG DUCKLING.WPG DWARFS.WPG EAGLE.WPG EARTH.WPG EASTER.WPG EGERMA-M.WPG EGGS-BKN.WPG ELEC-EQP.WPG ELECTRIC.WPG ELF0.WPG ENGLAND.WPG ENVELOPE.WPG EQUEST.WPG ERLY-BRD.WPG EUROPE-M.WPG F-15.WPG FACE.WPG FACTORY.WPG FATPENCL.WPG FAX.WPG FB-111.WPG FEATHER.WPG FED-RSRV.WPG FEETON.WPG FERRARI.WPG FERRARI1.WPG FERRARI2.WPG FIAT.WPG FIGHTR-1.WPG FIGHTR-2.WPG FIGHTR-3.WPG FIGHTR-4.WPG FINGER.WPG FINLAN-M.WPG FISH.WPG FISH0.WPG FISH1.WPG FISH2.WPG FISHING.WPG FIST-MNY.WPG FLAG.WPG FLASK.WPG FLOPPY-1.WPG FLOPPY-2.WPG FLOURBAG.WPG FLOWER.WPG FLY.WPG FOLDER.WPG FOLIES.WPG FOOD-BDR.WPG FOOTBALL.WPG FOOTSTEP.WPG FORD.WPG FORE!.WPG FRAGILE.WPG FRANCE-M.WPG FRANCE.WPG FRANK-1.WPG FRANK-2.WPG FREEWAYS.WPG FRENCHFR.WPG FRIES.WPG FROG.WPG FRONTAL.WPG FRUIT.WPG GARBCAN.WPG GARFIELD.WPG GARGOYLE.WPG GASOLINE.WPG GASPUMP.WPG GAS_SYM.WPG GAVEL.WPG GEISHAS.WPG GELDER-1.WPG GELDER-2.WPG GEMINI.WPG GENERAL.WPG GEORGE.WPG GEO_WASH.WPG GERMANY.WPG GIRL.WPG GLASSES.WPG GLIDER.WPG GLOBE.WPG GLOBE1-M.WPG GLOBE2-M.WPG GLUE.WPG GOLD-1.WPG GOLD-2.WPG GOLD.WPG GOLDBARS.WPG GOLF-DGN.WPG GOLF.WPG GOODNEWS.WPG GRAIN.WPG GRANDOPN.WPG GRAPES.WPG GRAPH.WPG GRBRIT-M.WPG GRCY-SAK.WPG GREATDAY.WPG GREECE-M.WPG GREETING.WPG GRID-1.WPG GRID-2.WPG GRID-3.WPG GROCERY.WPG GUAM-M.WPG GUITAR-2.WPG GUN.WPG GYMNASTC.WPG T-ZONES.WPG TACK.WPG TACOS.WPG TANK-1.WPG TANK-2.WPG TAPE.WPG TAXI.WPG TBEAR.WPG TBLE-STG.WPG TELESCOP.WPG TELPHONE.WPG TENNIS.WPG TENNISBL.WPG TENT.WPG TEXTILES.WPG TICKER.WPG TICKET.WPG TIME-CLK.WPG TIME-FLY.WPG TOMATOES.WPG TOMCATS.WPG TOOLS.WPG TOOTH.WPG TOUR-BUS.WPG TOWER.WPG TRAIN.WPG TRAIN2.WPG TRAM.WPG TREASURY.WPG TROLLEY.WPG TROPHY.WPG TRUCKING.WPG TRUMPET.WPG TURKEY-M.WPG TURKEY.WPG TURKYDNR.WPG TURTLE.WPG TV.WPG TYPE-M.WPG TYPE-W.WPG TYPE.WPG UMBRELLA.WPG USA-M.WPG USSR-M.WPG VACATION.WPG VEGAS.WPG VEGETBLE.WPG VOLLEYBL.WPG VOLVO.WPG VW.WPG WAITER.WPG WALKING.WPG WALL-CLK.WPG WATCH-1.WPG WATCH-2.WPG WATCH-3.WPG WATCH.WPG WATER.WPG WATERCAN.WPG WEDDING.WPG WGERMA-M.WPG WHEAT.WPG WHEELB.WPG WHLCHAIR.WPG WINE.WPG WISHBONE.WPG WITCH.WPG WOMAN-1.WPG WOMAN-2.WPG WORKER-M.WPG WORKER-W.WPG WORKMAN.WPG WORLD-M.WPG WPWIN.WPG WREATH.WPG WRENCH.WPG WSKBROOM.WPG XMAS.WPG XMASTREE.WPG YEN-1.WPG YEN-2.WPG YEN.WPG YUGOSL-M.WPG c16.wpg c256.wpg quad.wpg Log Message: removing the testdocs from here --- FAX.WPG DELETED --- --- TOUR-BUS.WPG DELETED --- --- WHLCHAIR.WPG DELETED --- --- FOOD-BDR.WPG DELETED --- --- TROPHY.WPG DELETED --- --- GEISHAS.WPG DELETED --- --- FISHING.WPG DELETED --- --- DOCTOR-M.WPG DELETED --- --- DNTENTER.WPG DELETED --- --- FB-111.WPG DELETED --- --- TICKER.WPG DELETED --- --- FRANK-2.WPG DELETED --- --- TRAIN.WPG DELETED --- --- DESK-W.WPG DELETED --- --- DIAMND.WPG DELETED --- --- GLOBE1-M.WPG DELETED --- --- DEVICE-3.WPG DELETED --- --- EARTH.WPG DELETED --- --- GRID-3.WPG DELETED --- --- TRUMPET.WPG DELETED --- --- FERRARI2.WPG DELETED --- --- GOODNEWS.WPG DELETED --- --- DRAPES.WPG DELETED --- --- DONALD.WPG DELETED --- --- GUAM-M.WPG DELETED --- --- WHEELB.WPG DELETED --- --- GAS_SYM.WPG DELETED --- --- FIGHTR-2.WPG DELETED --- --- GRBRIT-M.WPG DELETED --- --- GERMANY.WPG DELETED --- --- YEN-1.WPG DELETED --- --- GREECE-M.WPG DELETED --- --- ENVELOPE.WPG DELETED --- --- GUITAR-2.WPG DELETED --- --- TURKEY.WPG DELETED --- --- WALKING.WPG DELETED --- --- WEDDING.WPG DELETED --- --- TAPE.WPG DELETED --- --- FERRARI1.WPG DELETED --- --- FLOPPY-2.WPG DELETED --- --- GREETING.WPG DELETED --- --- DEVICE-1.WPG DELETED --- --- VEGAS.WPG DELETED --- --- USSR-M.WPG DELETED --- --- VACATION.WPG DELETED --- --- FATPENCL.WPG DELETED --- --- WRENCH.WPG DELETED --- --- FLY.WPG DELETED --- --- FEETON.WPG DELETED --- --- DEVICE-5.WPG DELETED --- --- TURKEY-M.WPG DELETED --- --- TYPE-W.WPG DELETED --- --- DROP.WPG DELETED --- --- DOLLAR-2.WPG DELETED --- --- FOLIES.WPG DELETED --- --- VW.WPG DELETED --- --- FEATHER.WPG DELETED --- --- FLOURBAG.WPG DELETED --- --- EQUEST.WPG DELETED --- --- GELDER-2.WPG DELETED --- --- GUN.WPG DELETED --- --- DAVINCI.WPG DELETED --- --- GLOBE2-M.WPG DELETED --- --- WATCH-2.WPG DELETED --- --- ELEC-EQP.WPG DELETED --- --- WOMAN-1.WPG DELETED --- --- TRAM.WPG DELETED --- --- DESTROY.WPG DELETED --- --- FACE.WPG DELETED --- --- DESSERT.WPG DELETED --- --- GIRL.WPG DELETED --- --- GOLF.WPG DELETED --- --- WITCH.WPG DELETED --- --- EGGS-BKN.WPG DELETED --- --- DOLLAR-3.WPG DELETED --- --- TIME-FLY.WPG DELETED --- --- GLASSES.WPG DELETED --- --- GLIDER.WPG DELETED --- --- DIME.WPG DELETED --- --- GRAPH.WPG DELETED --- --- DRUGS.WPG DELETED --- --- FRENCHFR.WPG DELETED --- --- WISHBONE.WPG DELETED --- --- TANK-2.WPG DELETED --- --- GOLD-2.WPG DELETED --- --- DESK.WPG DELETED --- --- DISH.WPG DELETED --- --- FORE!.WPG DELETED --- --- VOLVO.WPG DELETED --- --- quad.wpg DELETED --- --- XMAS.WPG DELETED --- --- VEGETBLE.WPG DELETED --- --- GEO_WASH.WPG DELETED --- --- WHEAT.WPG DELETED --- --- FISH0.WPG DELETED --- --- FLASK.WPG DELETED --- --- c16.wpg DELETED --- --- FRANCE-M.WPG DELETED --- --- GOLD.WPG DELETED --- --- FOLDER.WPG DELETED --- --- YEN-2.WPG DELETED --- --- FINGER.WPG DELETED --- --- TBLE-STG.WPG DELETED --- --- GARGOYLE.WPG DELETED --- --- WORLD-M.WPG DELETED --- --- TROLLEY.WPG DELETED --- --- DOLLR-2.WPG DELETED --- --- GOLD-1.WPG DELETED --- --- DOLLR-1.WPG DELETED --- --- EASTER.WPG DELETED --- --- FIGHTR-4.WPG DELETED --- --- WATCH.WPG DELETED --- --- FOOTBALL.WPG DELETED --- --- FINLAN-M.WPG DELETED --- --- GRCY-SAK.WPG DELETED --- --- FERRARI.WPG DELETED --- --- DOLLAR.WPG DELETED --- --- DOG.WPG DELETED --- --- GRANDOPN.WPG DELETED --- --- TOOLS.WPG DELETED --- --- DOCTOR-W.WPG DELETED --- --- YUGOSL-M.WPG DELETED --- --- FISH.WPG DELETED --- --- TRUCKING.WPG DELETED --- --- TELPHONE.WPG DELETED --- --- WORKMAN.WPG DELETED --- --- FRANK-1.WPG DELETED --- --- USA-M.WPG DELETED --- --- TIME-CLK.WPG DELETED --- --- DEGREE.WPG DELETED --- --- TYPE-M.WPG DELETED --- --- WATCH-3.WPG DELETED --- --- DEER.WPG DELETED --- --- TBEAR.WPG DELETED --- --- FREEWAYS.WPG DELETED --- --- GOLF-DGN.WPG DELETED --- --- DIPLOMA.WPG DELETED --- --- FED-RSRV.WPG DELETED --- --- TURTLE.WPG DELETED --- --- XMASTREE.WPG DELETED --- --- GYMNASTC.WPG DELETED --- --- YEN.WPG DELETED --- --- GEORGE.WPG DELETED --- --- WALL-CLK.WPG DELETED --- --- WAITER.WPG DELETED --- --- FRONTAL.WPG DELETED --- --- c256.wpg DELETED --- --- WOMAN-2.WPG DELETED --- --- FISH2.WPG DELETED --- --- FLAG.WPG DELETED --- --- FORD.WPG DELETED --- --- ENGLAND.WPG DELETED --- --- TELESCOP.WPG DELETED --- --- GEMINI.WPG DELETED --- --- DWARFS.WPG DELETED --- --- FIST-MNY.WPG DELETED --- --- GRAIN.WPG DELETED --- --- TOOTH.WPG DELETED --- --- FISH1.WPG DELETED --- --- FIGHTR-3.WPG DELETED --- --- TOMATOES.WPG DELETED --- --- WORKER-M.WPG DELETED --- --- GARFIELD.WPG DELETED --- --- GREATDAY.WPG DELETED --- --- WATER.WPG DELETED --- --- WATERCAN.WPG DELETED --- --- FOOTSTEP.WPG DELETED --- --- WATCH-1.WPG DELETED --- --- FROG.WPG DELETED --- --- WPWIN.WPG DELETED --- --- ELF0.WPG DELETED --- --- TENT.WPG DELETED --- --- WINE.WPG DELETED --- --- TENNISBL.WPG DELETED --- --- GOLDBARS.WPG DELETED --- --- DOUGHNUT.WPG DELETED --- --- FRAGILE.WPG DELETED --- --- DEVICE-2.WPG DELETED --- --- GLOBE.WPG DELETED --- --- GRAPES.WPG DELETED --- --- DMARK-1.WPG DELETED --- --- FRANCE.WPG DELETED --- --- TANK-1.WPG DELETED --- --- DOLINA.WPG DELETED --- --- DEVICE-4.WPG DELETED --- --- DINOSAUR.WPG DELETED --- --- TREASURY.WPG DELETED --- --- TAXI.WPG DELETED --- --- FLOWER.WPG DELETED --- --- DELTA-II.WPG DELETED --- --- EUROPE-M.WPG DELETED --- --- EGERMA-M.WPG DELETED --- --- WREATH.WPG DELETED --- --- DAISIES.WPG DELETED --- --- GELDER-1.WPG DELETED --- --- FRIES.WPG DELETED --- --- DENMAR-M.WPG DELETED --- --- DUCKLING.WPG DELETED --- --- WGERMA-M.WPG DELETED --- --- GASOLINE.WPG DELETED --- --- FIGHTR-1.WPG DELETED --- --- DOLLAR-1.WPG DELETED --- --- GROCERY.WPG DELETED --- --- GASPUMP.WPG DELETED --- --- UMBRELLA.WPG DELETED --- --- FACTORY.WPG DELETED --- --- TV.WPG DELETED --- --- ERLY-BRD.WPG DELETED --- --- TEXTILES.WPG DELETED --- --- TENNIS.WPG DELETED --- --- DRAGSTER.WPG DELETED --- --- DEFENSE.WPG DELETED --- --- GRID-2.WPG DELETED --- --- TACK.WPG DELETED --- --- F-15.WPG DELETED --- --- GENERAL.WPG DELETED --- --- WSKBROOM.WPG DELETED --- --- T-ZONES.WPG DELETED --- --- GRID-1.WPG DELETED --- --- GLUE.WPG DELETED --- --- WORKER-W.WPG DELETED --- --- DC-10.WPG DELETED --- --- DART.WPG DELETED --- --- GAVEL.WPG DELETED --- --- TURKYDNR.WPG DELETED --- --- FRUIT.WPG DELETED --- --- ELECTRIC.WPG DELETED --- --- VOLLEYBL.WPG DELETED --- --- DESK-M.WPG DELETED --- --- TOMCATS.WPG DELETED --- --- DIAMOND.WPG DELETED --- --- TOWER.WPG DELETED --- --- TACOS.WPG DELETED --- --- FLOPPY-1.WPG DELETED --- --- DMARK-2.WPG DELETED --- --- FIAT.WPG DELETED --- --- EAGLE.WPG DELETED --- --- TRAIN2.WPG DELETED --- --- TYPE.WPG DELETED --- --- DRAGON.WPG DELETED --- --- DRAMA.WPG DELETED --- --- TICKET.WPG DELETED --- --- DUCK.WPG DELETED --- --- GARBCAN.WPG DELETED --- |
From: Fridrich S. <str...@us...> - 2008-12-04 00:01:44
|
Update of /cvsroot/libwpg/wpgtest In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11196 Modified Files: regression.pl Log Message: differenciate the different valgrind results Index: regression.pl =================================================================== RCS file: /cvsroot/libwpg/wpgtest/regression.pl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- regression.pl 3 Dec 2008 23:36:27 -0000 1.1.1.1 +++ regression.pl 4 Dec 2008 00:01:40 -0000 1.2 @@ -72,7 +72,7 @@ if ($diff eq "" && $err eq "") { $bgColor = $pass_colour; } elsif ($err ne "") { - $bgColor = $fail_colour; + $bgColor = $fail_colour;sourceforge import cvs module vendor_tag } else { $bgColor = $warn_colour; } @@ -170,7 +170,7 @@ # RAW VALGRIND REGRESSION TEST # //////////////////////////// if ($do_vg) { - $vgPath = 'testset/' . $wpVersion . '/' . $file . '.vg'; + $vgPath = 'testset/' . $wpVersion . '/' . $file . '.rawvg'; $rawValgrind = 0; `$vgCommand --leak-check=yes wpg2raw $filePath 1> $vgPath 2> $vgPath`; open VG, "$vgPath"; @@ -214,7 +214,7 @@ # SVG VALGRIND REGRESSION TEST # //////////////////////////// if ($do_vg) { - $vgPath = 'testset/' . $wpVersion . '/' . $file . '.vg'; + $vgPath = 'testset/' . $wpVersion . '/' . $file . '.svgvg'; $svgValgrind = 0; `$vgCommand --leak-check=yes wpg2svg $filePath 1> $vgPath 2> $vgPath`; open VG, "$vgPath"; |
From: Fridrich S. <str...@us...> - 2008-12-04 00:00:30
|
Update of /cvsroot/libwpg/wpgtest/testset/WPG2 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10932/testset/WPG2 Added Files: .cvsignore Log Message: adding a .cvsignore file --- NEW FILE: .cvsignore --- *.diff *.err *.new *.odgvg *.rawvg *.svgvg |
From: Fridrich S. <str...@us...> - 2008-12-03 23:41:12
|
Update of /cvsroot/libwpg/regression.pl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9618 Added Files: THIS_IS_A_DUMMY_MODULE Removed Files: regression.pl Log Message: this is a dummy module --- regression.pl DELETED --- --- NEW FILE: THIS_IS_A_DUMMY_MODULE --- |
From: Fridrich S. <str...@us...> - 2008-12-03 23:41:12
|
Update of /cvsroot/libwpg/regression.pl/testset/WPG1 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9618/testset/WPG1 Removed Files: regression.in Log Message: this is a dummy module --- regression.in DELETED --- |
From: Fridrich S. <str...@us...> - 2008-12-03 23:41:12
|
Update of /cvsroot/libwpg/regression.pl/testset/WPG2 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9618/testset/WPG2 Removed Files: regression.in Log Message: this is a dummy module --- regression.in DELETED --- |
From: Fridrich S. <str...@us...> - 2008-12-03 23:14:51
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7113/src/lib Modified Files: Makefile.am WPGPen.cpp WPGPen.h Added Files: WPGDashArray.cpp WPGDashArray.h Log Message: taking WPGDashArray from WPGPen.{cpp,h} into a separate file Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Makefile.am 28 Nov 2008 11:53:03 -0000 1.32 +++ Makefile.am 3 Dec 2008 23:14:46 -0000 1.33 @@ -24,6 +24,7 @@ libwpg.h \ WPGraphics.h \ WPGColor.h \ + WPGDashArray.h \ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ @@ -39,6 +40,7 @@ WPGBrush.cpp \ WPGPen.cpp \ WPGColor.cpp \ + WPGDashArray.cpp \ WPGGradient.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ --- NEW FILE: WPGDashArray.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGDASHARRAY_H__ #define __WPGDASHARRAY_H__ namespace libwpg { class WPGDashArrayPrivate; class WPGDashArray { public: WPGDashArray(); ~WPGDashArray(); WPGDashArray(const WPGDashArray&); WPGDashArray& operator=(const WPGDashArray&); unsigned count() const; double at(unsigned i) const; void add(double p); private: WPGDashArrayPrivate *d; }; } // namespace libwpg #endif // __WPGDASHARRAY_H__ --- NEW FILE: WPGDashArray.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGDashArray.h" #include <vector> namespace libwpg { class WPGDashArrayPrivate { public: WPGDashArrayPrivate() : dashes(std::vector<double>()) {}; std::vector<double> dashes; }; } libwpg::WPGDashArray::WPGDashArray() : d(new libwpg::WPGDashArrayPrivate()) { } libwpg::WPGDashArray::~WPGDashArray() { delete d; } libwpg::WPGDashArray::WPGDashArray(const libwpg::WPGDashArray& dash): d(new libwpg::WPGDashArrayPrivate()) { d->dashes = dash.d->dashes; } libwpg::WPGDashArray& libwpg::WPGDashArray::operator=(const libwpg::WPGDashArray& dash) { d->dashes = dash.d->dashes; return *this; } unsigned libwpg::WPGDashArray::count() const { return d->dashes.size(); } double libwpg::WPGDashArray::at(unsigned i) const { return d->dashes[i]; } void libwpg::WPGDashArray::add(double p) { d->dashes.push_back(p); } Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGPen.cpp 28 Nov 2008 11:53:03 -0000 1.9 +++ WPGPen.cpp 3 Dec 2008 23:14:46 -0000 1.10 @@ -27,52 +27,6 @@ #include <vector> -namespace libwpg -{ -class WPGDashArrayPrivate -{ -public: - WPGDashArrayPrivate() : dashes(std::vector<double>()) {}; - std::vector<double> dashes; -}; -} - -libwpg::WPGDashArray::WPGDashArray() : d(new libwpg::WPGDashArrayPrivate()) -{ -} - -libwpg::WPGDashArray::~WPGDashArray() -{ - delete d; -} - -libwpg::WPGDashArray::WPGDashArray(const libwpg::WPGDashArray& dash): - d(new libwpg::WPGDashArrayPrivate()) -{ - d->dashes = dash.d->dashes; -} - -libwpg::WPGDashArray& libwpg::WPGDashArray::operator=(const libwpg::WPGDashArray& dash) -{ - d->dashes = dash.d->dashes; - return *this; -} - -unsigned libwpg::WPGDashArray::count() const -{ - return d->dashes.size(); -} - -double libwpg::WPGDashArray::at(unsigned i) const -{ - return d->dashes[i]; -} - -void libwpg::WPGDashArray::add(double p) -{ - d->dashes.push_back(p); -} - libwpg::WPGPen::WPGPen(): foreColor(0,0,0), backColor(0xFF,0xFF,0xFF), Index: WPGPen.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGPen.h 28 Nov 2008 11:53:03 -0000 1.5 +++ WPGPen.h 3 Dec 2008 23:14:46 -0000 1.6 @@ -27,27 +27,11 @@ #define __WPGPEN_H__ #include "WPGColor.h" +#include "WPGDashArray.h" namespace libwpg { -class WPGDashArrayPrivate; - -class WPGDashArray -{ -public: - WPGDashArray(); - ~WPGDashArray(); - WPGDashArray(const WPGDashArray&); - WPGDashArray& operator=(const WPGDashArray&); - unsigned count() const; - double at(unsigned i) const; - void add(double p); - -private: - WPGDashArrayPrivate *d; -}; - class WPGPen { public: |
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5477/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGBitmap.cpp WPGColor.cpp WPGColor.h WPGGradient.cpp WPGGradient.h WPGSVGGenerator.cpp Log Message: transforming rgb(XX,YY,ZZ) to #XXYYZZ (still need to handle the default brush correctly) Index: WPGColor.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGColor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPGColor.h 14 Dec 2006 14:39:57 -0000 1.3 +++ WPGColor.h 3 Dec 2008 23:05:05 -0000 1.4 @@ -26,6 +26,8 @@ #ifndef __WPGCOLOR_H__ #define __WPGCOLOR_H__ +#include <libwpd/libwpd.h> + namespace libwpg { @@ -43,6 +45,10 @@ WPGColor(const WPGColor& color); WPGColor& operator=(const WPGColor& color); + + const ::WPXString getColorString() const; + + double getOpacity() const; }; } // namespace libwpg Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- WPGBitmap.cpp 28 Nov 2008 11:53:03 -0000 1.24 +++ WPGBitmap.cpp 3 Dec 2008 23:05:05 -0000 1.25 @@ -173,7 +173,7 @@ WPG_DEBUG_MSG(("WPGBitmap: DIB info header end = %i\n", tmpBufferPosition - 1)); // Write DIB Image data - + int i = 0; int j = 0; if (d->vFlip) for (i = 0; i < d->height && tmpBufferPosition < tmpDIBFileSize; i++) @@ -219,7 +219,7 @@ WPG_DEBUG_MSG(("WPGBitmap: DIB file size = %i\n", tmpBufferPosition - 1)); d->dib.append(tmpDIBBuffer, tmpDIBFileSize); - + // temporary for debug - dump the binary bmp (need to have write access in the current directory #if DUMP_BITMAP std::ostringstream filename; Index: WPGColor.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGColor.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- WPGColor.cpp 8 Jun 2007 11:57:41 -0000 1.2 +++ WPGColor.cpp 3 Dec 2008 23:05:05 -0000 1.3 @@ -61,3 +61,15 @@ alpha = color.alpha; return *this; } + +const ::WPXString libwpg::WPGColor::getColorString() const +{ + ::WPXString sColor; + sColor.sprintf("#%.2x%.2x%.2x", red, green, blue); + return sColor; +} + +double libwpg::WPGColor::getOpacity() const +{ + return 1.0 - ((double)alpha/256.0); +} Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- WPGSVGGenerator.cpp 3 Dec 2008 12:51:21 -0000 1.25 +++ WPGSVGGenerator.cpp 3 Dec 2008 23:05:05 -0000 1.26 @@ -96,16 +96,18 @@ // round to nearest percentage int ofs = (int)((100.0*m_brush.gradient.stopOffset(c))+0.5); - libwpg::WPGColor color = m_brush.gradient.stopColor(c); + ::WPXString color = m_brush.gradient.stopColor(c); + double opacity = m_brush.gradient.stopOpacity(c); m_outputSink << " <stop offset=\"" << ofs << "%\""; // set stream to %02x formatting size_t old_stream_size = m_outputSink.width(2); m_outputSink << std::hex; - m_outputSink << " stop-color=\"#" << (color.red <= 0xF ? "0" : "") << color.red; - m_outputSink << "" << (color.green <= 0xF ? "0" : "") << color.green; - m_outputSink << "" << (color.blue <= 0xF ? "0" : "") << color.blue << "\" />\n"; + m_outputSink << " stop-color=\"" << color.cstr() << "\""; + if (opacity != 0.0) + m_outputSink << " stop-opacity=\"" << doubleToString(opacity) << "\""; + m_outputSink << " />\n"; // reset stream formatting m_outputSink << std::dec; @@ -198,7 +200,6 @@ m_outputSink << "<polyline "; m_outputSink << "points=\""; - WPXPropertyListVector::Iter i(vertices); for(unsigned i = 0; i < vertices.count(); i++) { m_outputSink << doubleToString(72*(vertices[i]["svg:x"]->getDouble())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getDouble())); @@ -268,10 +269,10 @@ if(m_pen.width > 0.0 || m_pen.solid) { - m_outputSink << "stroke: rgb(" << color.red << "," << color.green << "," << color.blue << "); "; - if(color.alpha != 0) + m_outputSink << "stroke: " << color.getColorString().cstr() << "; "; + if(color.getOpacity() != 1.0) // alpha = 0 means opacity = 1.0, alpha = 256 means opacity = 0 - m_outputSink << "stroke-opacity: " << doubleToString(1.0-(color.alpha/256.0)) << "; "; + m_outputSink << "stroke-opacity: " << doubleToString(color.getOpacity()) << "; "; } if(!m_pen.solid) @@ -289,17 +290,14 @@ if(m_brush.style == libwpg::WPGBrush::NoBrush) m_outputSink << "fill: none; "; - if(m_brush.style == libwpg::WPGBrush::Pattern) - { - if(m_fillRule["svg:fill-rule"]) - m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; - } + if(m_fillRule["svg:fill-rule"]) + m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; if(m_brush.style == libwpg::WPGBrush::Gradient) m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; if(m_brush.style == libwpg::WPGBrush::Solid) - m_outputSink << "fill: rgb(" << m_brush.foreColor.red << "," << m_brush.foreColor.green << "," << m_brush.foreColor.blue << "); "; + m_outputSink << "fill: " << m_brush.foreColor.getColorString().cstr() << "; "; m_outputSink << "\""; // style } Index: WPGGradient.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGGradient.cpp 28 Nov 2008 11:53:03 -0000 1.7 +++ WPGGradient.cpp 3 Dec 2008 23:05:05 -0000 1.8 @@ -24,7 +24,6 @@ */ #include "WPGGradient.h" -#include "WPGColor.h" #include <vector> @@ -35,11 +34,12 @@ { public: double offset; - WPGColor color; + ::WPXString color; + double opacity; - WPGGradientStop(): offset(0), color(WPGColor()) {} + WPGGradientStop(): offset(0), color("#000000"), opacity(1.0) {} - WPGGradientStop(double ofs, const WPGColor& c): offset(ofs), color(c) {} + WPGGradientStop(double ofs, const ::WPXString& c, double opa): offset(ofs), color(c), opacity(opa) {} }; class WPGGradientPrivate @@ -98,13 +98,18 @@ return d->gradientStops[index].offset; } -libwpg::WPGColor libwpg::WPGGradient::stopColor(unsigned index) const +::WPXString libwpg::WPGGradient::stopColor(unsigned index) const { return d->gradientStops[index].color; } -void libwpg::WPGGradient::addStop(double offset, const libwpg::WPGColor& color) +double libwpg::WPGGradient::stopOpacity(unsigned index) const { - libwpg::WPGGradientStop stop(offset, color); + return d->gradientStops[index].opacity; +} + +void libwpg::WPGGradient::addStop(double offset, const ::WPXString& color, double opacity) +{ + libwpg::WPGGradientStop stop(offset, color, opacity); d->gradientStops.push_back(stop); } Index: WPGGradient.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPGGradient.h 28 Nov 2008 11:53:03 -0000 1.4 +++ WPGGradient.h 3 Dec 2008 23:05:05 -0000 1.5 @@ -26,7 +26,7 @@ #ifndef __WPGGRADIENT_H__ #define __WPGGRADIENT_H__ -#include "WPGColor.h" +#include <libwpd/libwpd.h> namespace libwpg { @@ -53,9 +53,11 @@ double stopOffset(unsigned index) const; - WPGColor stopColor(unsigned index) const; + ::WPXString stopColor(unsigned index) const; - void addStop(double offset, const WPGColor& color); + double stopOpacity(unsigned index) const; + + void addStop(double offset, const ::WPXString &color, double opacity); private: WPGGradientPrivate *d; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- WPG2Parser.cpp 3 Dec 2008 13:41:29 -0000 1.91 +++ WPG2Parser.cpp 3 Dec 2008 23:05:05 -0000 1.92 @@ -665,13 +665,13 @@ for(unsigned i = 0; i < numEntries; i++) { - libwpg::WPGColor color; - color.red = readU8(); - color.green = readU8(); - color.blue = readU8(); - color.alpha = readU8(); + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + unsigned char alpha = readU8(); + libwpg::WPGColor color(red, green, blue, alpha); m_colorPalette[startIndex+i] = color; - WPG_DEBUG_MSG(("Index#%d: RGB %d %d %d\n", startIndex+i, color.red, color.green, color.blue)); + WPG_DEBUG_MSG(("Index#%d: RGB %s\n", startIndex+i, color.getColorString().cstr())); } } @@ -684,13 +684,13 @@ for(unsigned int i = 0; i < numEntries; i++) { - libwpg::WPGColor color; - color.red = readU16() >> 8 ; - color.green = readU16() >> 8 ; - color.blue = readU16() >> 8 ; - color.alpha = readU16() >> 8 ; + unsigned char red = readU16() >> 8 ; + unsigned char green = readU16() >> 8 ; + unsigned char blue = readU16() >> 8 ; + unsigned char alpha = readU16() >> 8 ; + libwpg::WPGColor color(red, green, blue, alpha); m_colorPalette[startIndex+i] = color; - WPG_DEBUG_MSG(("Index#%d: RGB %d %d %d\n", startIndex+i, color.red, color.green, color.blue)); + WPG_DEBUG_MSG(("Index#%d: RGB %s\n", startIndex+i, color.getColorString().cstr())); } } @@ -717,10 +717,10 @@ if (!m_groupStack.empty() && m_groupStack.top().isCompoundPolygon()) return; // we just ignore the least significant 8 bits - unsigned int red = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned int green = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned int blue = (m_doublePrecision) ? readU16()>>8 : readU8(); - unsigned int alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8(); + unsigned char alpha = (m_doublePrecision) ? readU16()>>8 : readU8(); m_pen.foreColor = libwpg::WPGColor(red, green, blue, alpha); @@ -927,10 +927,10 @@ double ref = (tanangle < 1e2 && tanangle > -1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; libwpg::WPGGradient gradient; gradient.setAngle(-m_gradientAngle); // upside down - gradient.addStop(0, colors[1]); - gradient.addStop(ref, colors[0]); + gradient.addStop(0, colors[1].getColorString(), colors[0].getOpacity()); + gradient.addStop(ref, colors[0].getColorString(), colors[0].getOpacity()); if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) - gradient.addStop(1, colors[1]); + gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; } @@ -994,10 +994,10 @@ double ref = (tanangle<1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; libwpg::WPGGradient gradient; gradient.setAngle(-m_gradientAngle); // upside down - gradient.addStop(0, colors[1]); - gradient.addStop(ref, colors[0]); + gradient.addStop(0, colors[1].getColorString(), colors[1].getOpacity()); + gradient.addStop(ref, colors[0].getColorString(), colors[0].getOpacity()); if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) - gradient.addStop(1, colors[1]); + gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; } @@ -1926,10 +1926,10 @@ m_colorPalette.clear(); for (int i=0; i<256; i++) { - libwpg::WPGColor color; - color.red = defaultWPG2PaletteRed[i]; - color.green = defaultWPG2PaletteGreen[i]; - color.blue = defaultWPG2PaletteBlue[i]; + unsigned char red = defaultWPG2PaletteRed[i]; + unsigned char green = defaultWPG2PaletteGreen[i]; + unsigned char blue = defaultWPG2PaletteBlue[i]; + libwpg::WPGColor color(red, green, blue); m_colorPalette[i] = color; } } Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- WPG1Parser.cpp 3 Dec 2008 12:51:21 -0000 1.54 +++ WPG1Parser.cpp 3 Dec 2008 23:05:05 -0000 1.55 @@ -305,12 +305,12 @@ WPG_DEBUG_MSG(("Colormap\n")); for(unsigned int i = 0; i < numEntries; i++) { - libwpg::WPGColor color; - color.red = readU8(); - color.green = readU8(); - color.blue = readU8(); + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + libwpg::WPGColor color(red, green, blue); m_colorPalette[startIndex+i] = color; - WPG_DEBUG_MSG(("Index#%d: RGB %d %d %d\n", startIndex+i, color.red, color.green, color.blue)); + WPG_DEBUG_MSG(("Index#%d: RGB %s\n", startIndex+i, color.getColorString().cstr())); } } @@ -504,7 +504,6 @@ path.append(element); for (unsigned i = 1; i < (count-1)/3; i++) { - element.clear(); long xControl1 = readS16(); long yControl1 = readS16(); long xControl2 = readS16(); @@ -512,6 +511,7 @@ long xCoordinate = readS16(); long yCoordinate = readS16(); + element.clear(); element.insert("libwpg:path-action", "C"); element.insert("svg:x1", (double)xControl1/1200.0); element.insert("svg:y1", (double)(m_height-yControl1)/1200.0); @@ -519,6 +519,7 @@ element.insert("svg:y2", (double)(m_height-yControl2)/1200.0); element.insert("svg:x", (double)xCoordinate/1200.0); element.insert("svg:y", (double)(m_height-yCoordinate)/1200.0); + path.append(element); } @@ -868,10 +869,10 @@ m_colorPalette.clear(); for (int i=0; i<256; i++) { - libwpg::WPGColor color; - color.red = defaultWPG1PaletteRed[i]; - color.green = defaultWPG1PaletteGreen[i]; - color.blue = defaultWPG1PaletteBlue[i]; + unsigned char red = defaultWPG1PaletteRed[i]; + unsigned char green = defaultWPG1PaletteGreen[i]; + unsigned char blue = defaultWPG1PaletteBlue[i]; + libwpg::WPGColor color(red, green, blue); m_colorPalette[i] = color; } } |