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; |