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-03 23:05:11
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5477/src/conv/raw Modified Files: wpg2raw.cpp Log Message: transforming rgb(XX,YY,ZZ) to #XXYYZZ (still need to handle the default brush correctly) Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- wpg2raw.cpp 28 Nov 2008 12:25:45 -0000 1.18 +++ wpg2raw.cpp 3 Dec 2008 23:05:05 -0000 1.19 @@ -40,8 +40,8 @@ void endGraphics(); void startLayer(const ::WPXPropertyList& propList); void endLayer(); - void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} - void endEmbeddedGraphics() {} + void startEmbeddedGraphics(const ::WPXPropertyList& propList); + void endEmbeddedGraphics(); void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); @@ -124,6 +124,16 @@ printf("RawPainter::endLayer\n"); } +void RawPainter::startEmbeddedGraphics(const ::WPXPropertyList& propList) +{ + printf("RawPainter::startEmbeddedGraphics (%s)\n", getPropString(propList).cstr()); +} + +void RawPainter::endEmbeddedGraphics() +{ + printf("RawPainter::endEmbeddedGraphics \n"); +} + void RawPainter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { printf("RawPainter::setStyle(%s)\n", getPropString(propList).cstr()); @@ -139,16 +149,13 @@ } printf("\n"); - printf(" Foreground color: RGB %d %d %d\n", brush.foreColor.red, - brush.foreColor.green, brush.foreColor.blue); - printf(" Background color: RGB %d %d %d\n", brush.backColor.red, - brush.backColor.green, brush.backColor.blue); + printf(" Foreground color: RGB %s\n", brush.foreColor.getColorString().cstr()); + printf(" Background color: RGB %s\n", brush.backColor.getColorString().cstr()); if(brush.style == libwpg::WPGBrush::Gradient) for(unsigned c = 0; c < brush.gradient.count(); c++) - printf(" Gradient stop %d: %f RGB %d %d %d\n", c+1, - brush.gradient.stopOffset(c), brush.gradient.stopColor(c).red, - brush.gradient.stopColor(c).green, brush.gradient.stopColor(c).blue); + 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)); } void RawPainter::drawRectangle(const ::WPXPropertyList &propList) |
From: Fridrich S. <str...@us...> - 2008-12-03 13:41:35
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6482/src/lib Modified Files: WPG2Parser.cpp WPG2Parser.h Log Message: all float -> double (it does not take so much more space and saves big deal of precision) Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- WPG2Parser.cpp 3 Dec 2008 12:51:21 -0000 1.90 +++ WPG2Parser.cpp 3 Dec 2008 13:41:29 -0000 1.91 @@ -519,8 +519,8 @@ WPG_DEBUG_MSG((" height : %li\n", m_height)); ::WPXPropertyList propList; - propList.insert("svg:width", (float)((TO_DOUBLE(m_width)) / m_xres)); - propList.insert("svg:height", (float)((TO_DOUBLE(m_height)) / m_yres)); + propList.insert("svg:width", ((TO_DOUBLE(m_width)) / m_xres)); + propList.insert("svg:height", ((TO_DOUBLE(m_height)) / m_yres)); m_painter->startGraphics(propList); @@ -828,8 +828,8 @@ // TODO: get gradient extent m_gradientAngle = angleInteger + (double)angleFraction/65536.0; - m_gradientRef.insert("svg:x", (float)xref); - m_gradientRef.insert("svg:y", (float)yref); + m_gradientRef.insert("svg:x", (double)xref); + m_gradientRef.insert("svg:y", (double)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -858,8 +858,8 @@ // TODO: get gradient extent (in double precision) m_gradientAngle = angleFraction + (double)angleInteger/65536.0; - m_gradientRef.insert("svg:x", (float)xref); - m_gradientRef.insert("svg:y", (float)yref); + m_gradientRef.insert("svg:x", (double)xref); + m_gradientRef.insert("svg:y", (double)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -1164,8 +1164,8 @@ long x = (m_doublePrecision) ? readS32() : readS16(); long y = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(x,y); - point.insert("svg:x", (float)(TO_DOUBLE(x)/m_xres)); - point.insert("svg:y", (float)(TO_DOUBLE(y)/m_yres)); + point.insert("svg:x", (TO_DOUBLE(x)/m_xres)); + point.insert("svg:y", (TO_DOUBLE(y)/m_yres)); points.append(point); } @@ -1257,19 +1257,19 @@ long ty = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(tx,ty); - element.insert("svg:x", (float)(TO_DOUBLE(ax)/m_xres)); - element.insert("svg:y", (float)(TO_DOUBLE(ay)/m_yres)); + element.insert("svg:x", (TO_DOUBLE(ax)/m_xres)); + element.insert("svg:y", (TO_DOUBLE(ay)/m_yres)); if (i == 0) element.insert("libwpg:path-action", "M"); else { - element.insert("svg:x2", (float)(TO_DOUBLE(ix)/m_xres)); - element.insert("svg:y2", (float)(TO_DOUBLE(iy)/m_yres)); + element.insert("svg:x2", (TO_DOUBLE(ix)/m_xres)); + element.insert("svg:y2", (TO_DOUBLE(iy)/m_yres)); element.insert("libwpg:path-action", "C"); } path.append(element); - element.insert("svg:x1", (float)(TO_DOUBLE(tx)/m_xres)); - element.insert("svg:y1", (float)(TO_DOUBLE(ty)/m_yres)); + element.insert("svg:x1", (TO_DOUBLE(tx)/m_xres)); + element.insert("svg:y1", (TO_DOUBLE(ty)/m_yres)); } element.clear(); @@ -1320,13 +1320,13 @@ long ry = (m_doublePrecision) ? readS32() : readS16(); ::WPXPropertyList propList; - propList.insert("svg:x", (float)(TO_DOUBLE(xs1) / m_xres)); - propList.insert("svg:width", (float)(TO_DOUBLE(xs2-xs1) / m_xres)); - propList.insert("svg:y", (float)(TO_DOUBLE(ys1) / m_yres)); - propList.insert("svg:height", (float)(TO_DOUBLE(ys2-ys1) / m_yres)); + propList.insert("svg:x", (TO_DOUBLE(xs1) / m_xres)); + propList.insert("svg:width", (TO_DOUBLE(xs2-xs1) / m_xres)); + propList.insert("svg:y", (TO_DOUBLE(ys1) / m_yres)); + propList.insert("svg:height", (TO_DOUBLE(ys2-ys1) / m_yres)); - propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); - propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); + 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->drawRectangle(propList); @@ -1363,12 +1363,12 @@ TRANSFORM_XY(ex,ey); ::WPXPropertyList propList; - propList.insert("svg:cx", (float)(TO_DOUBLE(cx) / m_xres)); - propList.insert("svg:cy", (float)(TO_DOUBLE(cy) / m_xres)); - propList.insert("svg:rx", (float)(TO_DOUBLE(radx) / m_xres)); - propList.insert("svg:ry", (float)(TO_DOUBLE(rady) / m_xres)); + propList.insert("svg:cx", (TO_DOUBLE(cx) / m_xres)); + propList.insert("svg:cy", (TO_DOUBLE(cy) / m_xres)); + propList.insert("svg:rx", (TO_DOUBLE(radx) / m_xres)); + propList.insert("svg:ry", (TO_DOUBLE(rady) / m_xres)); if (objCh.rotate) - propList.insert("libwpg:rotate", (float)(objCh.rotationAngle)); + 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->drawEllipse(propList /* TODO: fix this: libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), @@ -1629,10 +1629,10 @@ // prepare the bitmap structure for the listener libwpg::WPGBitmap bitmap(width, height, m_vFlipped, m_hFlipped); ::WPXPropertyList propList; - propList.insert("svg:x", (float)m_bitmap.x1); - propList.insert("svg:y", (float)m_bitmap.y1); - propList.insert("svg:width", (float)(m_bitmap.x2 - m_bitmap.x1)); - propList.insert("svg:height", (float)(m_bitmap.y2 - m_bitmap.y1)); + propList.insert("svg:x", (double)m_bitmap.x1); + propList.insert("svg:y", (double)m_bitmap.y1); + propList.insert("svg:width", (m_bitmap.x2 - m_bitmap.x1)); + propList.insert("svg:height", (m_bitmap.y2 - m_bitmap.y1)); propList.insert("libwpg:mime-type", "image/bmp"); // format 1: each byte represents 8 pixels, the color fetched from the palette @@ -1888,10 +1888,10 @@ m_input->seek(accessoryDataLength, WPX_SEEK_CUR); ::WPXPropertyList propList; - propList.insert("svg:x", (float)m_binaryData.x1); - propList.insert("svg:y", (float)m_binaryData.y1); - propList.insert("svg:width", (float)(m_binaryData.x2 - m_binaryData.x1)); - propList.insert("svg:height", (float)(m_binaryData.y2 - m_binaryData.y1)); + propList.insert("svg:x", (double)m_binaryData.x1); + propList.insert("svg:y", (double)m_binaryData.y1); + propList.insert("svg:width", (m_binaryData.x2 - m_binaryData.x1)); + 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())); Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- WPG2Parser.h 3 Dec 2008 12:51:21 -0000 1.32 +++ WPG2Parser.h 3 Dec 2008 13:41:29 -0000 1.33 @@ -63,8 +63,8 @@ ::WPXPropertyList transformPoint(const ::WPXPropertyList& p) const { ::WPXPropertyList propList; - propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getDouble() + element[1][0]*p["svg:y"]->getDouble() + element[2][0])); - propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getDouble() + element[1][1]*p["svg:y"]->getDouble() + element[2][1])); + propList.insert("svg:x", (element[0][0]*p["svg:x"]->getDouble() + element[1][0]*p["svg:y"]->getDouble() + element[2][0])); + propList.insert("svg:y", (element[0][1]*p["svg:x"]->getDouble() + element[1][1]*p["svg:y"]->getDouble() + element[2][1])); return propList; } @@ -81,10 +81,10 @@ double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0]; double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1]; - propList.insert("svg:x", (float)newx1); - propList.insert("svg:y", (float)newy1); - propList.insert("svg:width", (float)(newx2-newx1)); - propList.insert("svg:height", (float)(newy2-newy1)); + propList.insert("svg:x", (double)newx1); + propList.insert("svg:y", (double)newy1); + propList.insert("svg:width", (newx2-newx1)); + propList.insert("svg:height", (newy2-newy1)); return propList; } |
From: Fridrich S. <str...@us...> - 2008-12-03 12:51:32
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3248/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGSVGGenerator.cpp Log Message: adapting to the fact that getFloat -> getDouble in WPXProperty class Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- WPG2Parser.cpp 28 Nov 2008 12:25:45 -0000 1.89 +++ WPG2Parser.cpp 3 Dec 2008 12:51:21 -0000 1.90 @@ -920,8 +920,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; - double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; + double xref = m_gradientRef["svg:x"]->getDouble()/65536.0; + double yref = m_gradientRef["svg:y"]->getDouble()/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle < 1e2 && tanangle > -1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; @@ -987,8 +987,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; - double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; + double xref = m_gradientRef["svg:x"]->getDouble()/65536.0; + double yref = m_gradientRef["svg:y"]->getDouble()/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle<1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- WPG2Parser.h 28 Nov 2008 11:53:03 -0000 1.31 +++ WPG2Parser.h 3 Dec 2008 12:51:21 -0000 1.32 @@ -63,18 +63,18 @@ ::WPXPropertyList transformPoint(const ::WPXPropertyList& p) const { ::WPXPropertyList propList; - propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getFloat() + element[1][0]*p["svg:y"]->getFloat() + element[2][0])); - propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getFloat() + element[1][1]*p["svg:y"]->getFloat() + element[2][1])); + propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getDouble() + element[1][0]*p["svg:y"]->getDouble() + element[2][0])); + propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getDouble() + element[1][1]*p["svg:y"]->getDouble() + element[2][1])); return propList; } ::WPXPropertyList transformRect(const ::WPXPropertyList& r) const { ::WPXPropertyList propList; - double oldx1 = r["svg:x"]->getFloat(); - double oldy1 = r["svg:y"]->getFloat(); - double oldx2 = r["svg:x"]->getFloat() + r["svg:width"]->getFloat(); - double oldy2 = r["svg:y"]->getFloat() + r["svg:height"]->getFloat(); + double oldx1 = r["svg:x"]->getDouble(); + double oldy1 = r["svg:y"]->getDouble(); + double oldx2 = r["svg:x"]->getDouble() + r["svg:width"]->getDouble(); + double oldy2 = r["svg:y"]->getDouble() + r["svg:height"]->getDouble(); double newx1 = element[0][0]*oldx1 + element[1][0]*oldy1 + element[2][0]; double newy1 = element[0][1]*oldx1 + element[1][1]*oldy1 + element[2][1]; Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- WPG1Parser.cpp 28 Nov 2008 12:25:45 -0000 1.53 +++ WPG1Parser.cpp 3 Dec 2008 12:51:21 -0000 1.54 @@ -275,8 +275,8 @@ m_height = readU16(); ::WPXPropertyList propList; - propList.insert("svg:width", (float)((double)m_width/1200.0)); - propList.insert("svg:height", (float)((double)m_height/1200.0)); + propList.insert("svg:width", (double)m_width/1200.0); + propList.insert("svg:height", (double)m_height/1200.0); m_painter->startGraphics(propList); m_graphicsStarted = true; @@ -365,12 +365,12 @@ ::WPXPropertyListVector points; ::WPXPropertyList point; - point.insert("svg:x", (float)((double)sx/1200.0)); - point.insert("svg:y", (float)((double)(m_height-sy)/1200.0)); + point.insert("svg:x", (double)sx/1200.0); + point.insert("svg:y", (double)(m_height-sy)/1200.0); points.append(point); point.clear(); - point.insert("svg:x", (float)((double)ex/1200.0)); - point.insert("svg:y", (float)((double)(m_height-ey)/1200.0)); + point.insert("svg:x", (double)ex/1200.0); + point.insert("svg:y", (double)(m_height-ey)/1200.0); points.append(point); m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); @@ -395,8 +395,8 @@ point.clear(); long x = readS16(); long y = readS16(); - point.insert("svg:x", (float)((double)x/1200.0)); - point.insert("svg:y", (float)((double)(m_height-y)/1200.0)); + point.insert("svg:x", (double)x/1200.0); + point.insert("svg:y", (double)(m_height-y)/1200.0); points.append(point); } @@ -417,11 +417,11 @@ int h = readS16(); ::WPXPropertyList propList; - propList.insert("svg:x", (float)((double)x/1200.0)); + propList.insert("svg:x", (double)x/1200.0); // in WPG, we have the coordinate of lower left point, in SVG-ish coordinates we have to get upper left - propList.insert("svg:y", (float)((double)(m_height - h - y)/1200.0)); - propList.insert("svg:width", (float)((double)w/1200.0)); - propList.insert("svg:height",(float)((double)h/1200.0)); + propList.insert("svg:y", (double)(m_height - h - y)/1200.0); + propList.insert("svg:width", (double)w/1200.0); + propList.insert("svg:height",(double)h/1200.0); m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); @@ -446,8 +446,8 @@ point.clear(); long x = readS16(); long y = readS16(); - point.insert("svg:x", (float)((double)x/1200.0)); - point.insert("svg:y", (float)((double)(m_height-y)/1200.0)); + point.insert("svg:x", (double)x/1200.0); + point.insert("svg:y", (double)(m_height-y)/1200.0); points.append(point); } @@ -464,11 +464,11 @@ return; ::WPXPropertyList propList; - propList.insert("svg:cx", (float)((double)readS16()/1200.0)); - propList.insert("svg:cy", (float)((double)(m_height-readS16())/1200.0)); - propList.insert("svg:rx", (float)((double)readS16()/1200.0)); - propList.insert("svg:ry", (float)((double)readS16()/1200.0)); - propList.insert("libwpg:rotate", (float)readS16()); + propList.insert("svg:cx", (double)readS16()/1200.0); + propList.insert("svg:cy", (double)(m_height-readS16())/1200.0); + propList.insert("svg:rx", (double)readS16()/1200.0); + propList.insert("svg:ry", (double)readS16()/1200.0); + propList.insert("libwpg:rotate", (double)readS16()); #if 0 int beginAngle = readS16(); @@ -499,8 +499,8 @@ long xInitial = readS16(); long yInitial = readS16(); element.insert("libwpg:path-action", "M"); - element.insert("svg:x", (float)((double)xInitial/1200.0)); - element.insert("svg:y", (float)((double)(m_height-yInitial)/1200.0)); + element.insert("svg:x", (double)xInitial/1200.0); + element.insert("svg:y", (double)(m_height-yInitial)/1200.0); path.append(element); for (unsigned i = 1; i < (count-1)/3; i++) { @@ -513,12 +513,12 @@ long yCoordinate = readS16(); element.insert("libwpg:path-action", "C"); - element.insert("svg:x1", (float)((double)xControl1/1200.0)); - element.insert("svg:y1", (float)((double)(m_height-yControl1)/1200.0)); - element.insert("svg:x2", (float)((double)xControl2/1200.0)); - element.insert("svg:y2", (float)((double)(m_height-yControl2)/1200.0)); - element.insert("svg:x", (float)((double)xCoordinate/1200.0)); - element.insert("svg:y", (float)((double)(m_height-yCoordinate)/1200.0)); + element.insert("svg:x1", (double)xControl1/1200.0); + element.insert("svg:y1", (double)(m_height-yControl1)/1200.0); + element.insert("svg:x2", (double)xControl2/1200.0); + 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); } @@ -705,8 +705,8 @@ ::WPXPropertyList propList; propList.insert("svg:x", 0.0f); propList.insert("svg:y", 0.0f); - propList.insert("svg:width", (float)((double)width/(double)hres)); - propList.insert("svg:height", (float)((double)height/(double)vres)); + propList.insert("svg:width", (double)width/(double)hres); + propList.insert("svg:height", (double)height/(double)vres); propList.insert("libwpg:mime-type", "image/bmp"); std::vector<unsigned char> buffer; @@ -772,10 +772,10 @@ libwpg::WPGBitmap bitmap(width, height); ::WPXPropertyList propList; - propList.insert("svg:x", (float)((double)xs1/1200.0)); - propList.insert("svg:y", (float)((double)(ys1)/1200.0)); - propList.insert("svg:width", (float)((double)(xs2-xs1)/1200.0)); - propList.insert("svg:height", (float)((double)(ys2-ys1)/1200.0)); + propList.insert("svg:x", (double)xs1/1200.0); + propList.insert("svg:y", (double)(ys1)/1200.0); + propList.insert("svg:width", (double)(xs2-xs1)/1200.0); + propList.insert("svg:height", (double)(ys2-ys1)/1200.0); propList.insert("libwpg:mime-type", "image/bmp"); std::vector<unsigned char> buffer; @@ -798,10 +798,10 @@ ::WPXPropertyList propList; - propList.insert("svg:x", (float)((double)x1/72.0)); - propList.insert("svg:y", (float)((double)m_height/1200.0 - (double)y1/72.0)); - propList.insert("svg:width", (float)(((double)x2 - (double)x1)/72.0)); - propList.insert("svg:height", (float)(((double)y1 - (double)y2)/72.0)); + propList.insert("svg:x", (double)x1/72.0); + propList.insert("svg:y", (double)m_height/1200.0 - (double)y1/72.0); + propList.insert("svg:width", ((double)x2 - (double)x1)/72.0); + propList.insert("svg:height", ((double)y1 - (double)y2)/72.0); propList.insert("libwpg:mime-type", "application/x-postscript"); ::WPXBinaryData data; @@ -845,11 +845,11 @@ ::WPXPropertyList propList; - propList.insert("svg:x", (float)((double)xs1/1200.0)); - propList.insert("svg:y", (float)((double)(ys1)/1200.0)); + propList.insert("svg:x", (double)xs1/1200.0); + propList.insert("svg:y", (double)(ys1)/1200.0); - propList.insert("svg:width", (float)(((double)xs2 - (double)xs1)/1200.0)); - propList.insert("svg:height", (float)(((double)ys2 -(double)ys1)/1200.0)); + propList.insert("svg:width", ((double)xs2 - (double)xs1)/1200.0); + propList.insert("svg:height", ((double)ys2 -(double)ys1)/1200.0); propList.insert("libwpg:mime-type", "image/x-eps"); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- WPGSVGGenerator.cpp 3 Dec 2008 11:04:09 -0000 1.24 +++ WPGSVGGenerator.cpp 3 Dec 2008 12:51:21 -0000 1.25 @@ -66,9 +66,9 @@ m_outputSink << "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" "; m_outputSink << "xmlns:xlink=\"http://www.w3.org/1999/xlink\" "; if (propList["svg:width"]) - m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getFloat())) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getDouble())) << "\" "; if (propList["svg:height"]) - m_outputSink << "height=\"" << doubleToString(72*(propList["svg:height"]->getFloat())) << "\""; + m_outputSink << "height=\"" << doubleToString(72*(propList["svg:height"]->getDouble())) << "\""; m_outputSink << " >\n"; m_gradientIndex = 1; @@ -144,10 +144,10 @@ void libwpg::WPGSVGGenerator::drawRectangle(const ::WPXPropertyList& propList) { m_outputSink << "<rect "; - m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getFloat()) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getDouble()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getDouble()) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getDouble()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getDouble()) << "\" "; if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"] && propList["svg:ry"]->getInt() !=0)) - m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getDouble()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getDouble()) << "\" "; writeStyle(); m_outputSink << "/>\n"; } @@ -155,14 +155,14 @@ void libwpg::WPGSVGGenerator::drawEllipse(const WPXPropertyList& propList) { m_outputSink << "<ellipse "; - m_outputSink << "cx=\"" << doubleToString(72*propList["svg:cx"]->getFloat()) << "\" cy=\"" << doubleToString(72*propList["svg:cy"]->getFloat()) << "\" "; - m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; + m_outputSink << "cx=\"" << doubleToString(72*propList["svg:cx"]->getDouble()) << "\" cy=\"" << doubleToString(72*propList["svg:cy"]->getDouble()) << "\" "; + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getDouble()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getDouble()) << "\" "; writeStyle(); - if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getFloat() != 0.0) - m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getFloat()) << ", " << doubleToString(72*propList["svg:cy"]->getFloat()) - << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getFloat()) - << ") translate(" << doubleToString(-72*propList["svg:cx"]->getFloat()) - << ", " << doubleToString(-72*propList["svg:cy"]->getFloat()) + if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getDouble() != 0.0) + m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getDouble()) << ", " << doubleToString(72*propList["svg:cy"]->getDouble()) + << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getDouble()) + << ") translate(" << doubleToString(-72*propList["svg:cx"]->getDouble()) + << ", " << doubleToString(-72*propList["svg:cy"]->getDouble()) << ")\" "; m_outputSink << "/>\n"; } @@ -185,8 +185,8 @@ if(vertices.count() == 2) { m_outputSink << "<line "; - m_outputSink << "x1=\"" << doubleToString(72*(vertices[0]["svg:x"]->getFloat())) << "\" y1=\"" << doubleToString(72*(vertices[0]["svg:y"]->getFloat())) << "\" "; - m_outputSink << "x2=\"" << doubleToString(72*(vertices[1]["svg:x"]->getFloat())) << "\" y2=\"" << doubleToString(72*(vertices[1]["svg:y"]->getFloat())) << "\"\n"; + m_outputSink << "x1=\"" << doubleToString(72*(vertices[0]["svg:x"]->getDouble())) << "\" y1=\"" << doubleToString(72*(vertices[0]["svg:y"]->getDouble())) << "\" "; + m_outputSink << "x2=\"" << doubleToString(72*(vertices[1]["svg:x"]->getDouble())) << "\" y2=\"" << doubleToString(72*(vertices[1]["svg:y"]->getDouble())) << "\"\n"; writeStyle(); m_outputSink << "/>\n"; } @@ -201,7 +201,7 @@ WPXPropertyListVector::Iter i(vertices); for(unsigned i = 0; i < vertices.count(); i++) { - m_outputSink << doubleToString(72*(vertices[i]["svg:x"]->getFloat())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getFloat())); + m_outputSink << doubleToString(72*(vertices[i]["svg:x"]->getDouble())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getDouble())); if (i < vertices.count()-1) m_outputSink << ", "; } @@ -221,19 +221,19 @@ if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M") { m_outputSink << "\nM"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); + m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); } else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L") { m_outputSink << "\nL"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); + m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); } else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C") { m_outputSink << "\nC"; - m_outputSink << doubleToString(72*(propList["svg:x1"]->getFloat())) << "," << doubleToString(72*(propList["svg:y1"]->getFloat())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x2"]->getFloat())) << "," << doubleToString(72*(propList["svg:y2"]->getFloat())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); + m_outputSink << doubleToString(72*(propList["svg:x1"]->getDouble())) << "," << doubleToString(72*(propList["svg:y1"]->getDouble())) << " "; + 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" ) m_outputSink << "\nZ"; @@ -251,8 +251,8 @@ WPXString base64 = binaryData.getBase64Data(); m_outputSink << "<image "; if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"]) - m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->getFloat())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getFloat())) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getFloat())) << "\" height=\"" << doubleToString(72*(propList["svg:height"]->getFloat())) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getDouble())) << "\" height=\"" << doubleToString(72*(propList["svg:height"]->getDouble())) << "\" "; m_outputSink << "xlink:href=\"data:" << propList["libwpg:mime-type"]->getStr().cstr() << ";base64,"; m_outputSink << base64.cstr(); m_outputSink << "\" />\n"; |
From: Fridrich S. <str...@us...> - 2008-12-03 11:04:15
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23810/src/lib Modified Files: WPGSVGGenerator.cpp Log Message: small changes that prevent some crashes and produce a more efficient svg Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- WPGSVGGenerator.cpp 28 Nov 2008 12:25:45 -0000 1.23 +++ WPGSVGGenerator.cpp 3 Dec 2008 11:04:09 -0000 1.24 @@ -145,8 +145,8 @@ { m_outputSink << "<rect "; m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" "; - if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"]->getInt() !=0)) + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getFloat()) << "\" "; + if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"] && propList["svg:ry"]->getInt() !=0)) m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; writeStyle(); m_outputSink << "/>\n"; @@ -199,10 +199,11 @@ m_outputSink << "points=\""; WPXPropertyListVector::Iter i(vertices); - for(i.rewind(); i.next();) + for(unsigned i = 0; i < vertices.count(); i++) { - m_outputSink << doubleToString(72*(i()["svg:x"]->getFloat())) << " " << doubleToString(72*(i()["svg:y"]->getFloat())); - if(!i.last()) m_outputSink << ", "; + m_outputSink << doubleToString(72*(vertices[i]["svg:x"]->getFloat())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getFloat())); + if (i < vertices.count()-1) + m_outputSink << ", "; } m_outputSink << "\"\n"; writeStyle(); @@ -212,30 +213,30 @@ void libwpg::WPGSVGGenerator::drawPath(const ::WPXPropertyListVector& path) { - m_outputSink << "<path d=\""; + m_outputSink << "<path d=\" "; WPXPropertyListVector::Iter i(path); - for(i.rewind(); i.next();) + for(unsigned i=0; i < path.count(); i++) { - WPXPropertyList propList = i(); + WPXPropertyList propList = path[i]; if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M") { - m_outputSink << "\n M"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; + m_outputSink << "\nM"; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); } else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L") { - m_outputSink << "\n L"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; + m_outputSink << "\nL"; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); } else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C") { - m_outputSink << "C"; + m_outputSink << "\nC"; m_outputSink << doubleToString(72*(propList["svg:x1"]->getFloat())) << "," << doubleToString(72*(propList["svg:y1"]->getFloat())) << " "; m_outputSink << doubleToString(72*(propList["svg:x2"]->getFloat())) << "," << doubleToString(72*(propList["svg:y2"]->getFloat())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())); } - else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z") - m_outputSink << "Z"; + else if ((i >= path.count()-1) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" ) + m_outputSink << "\nZ"; } m_outputSink << "\" \n"; |
From: Fridrich S. <str...@us...> - 2008-12-01 16:20:50
|
Update of /cvsroot/libwpg/perfectspot/src/odg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6612/src/odg Modified Files: FileOutputHandler.hxx Log Message: removing some warnings and making use of pkgconfig even on win32 Index: FileOutputHandler.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/FileOutputHandler.hxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FileOutputHandler.hxx 28 Nov 2008 15:09:15 -0000 1.2 +++ FileOutputHandler.hxx 1 Dec 2008 16:20:39 -0000 1.3 @@ -36,11 +36,11 @@ { public: explicit FileOutputHandler(std::ostringstream &contentStream); - virtual void startDocument(); - virtual void endDocument(); - virtual void startElement(const char *psName, const WPXPropertyList &xPropList); - virtual void endElement(const char *psName); - virtual void characters(const WPXString &sCharacters); + void startDocument(); + void endDocument(); + void startElement(const char *psName, const WPXPropertyList &xPropList); + void endElement(const char *psName); + void characters(const WPXString &sCharacters); private: bool mbIsTagOpened; |
From: Fridrich S. <str...@us...> - 2008-12-01 16:20:50
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6612/src Modified Files: CMakeLists.txt Log Message: removing some warnings and making use of pkgconfig even on win32 Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/CMakeLists.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- CMakeLists.txt 28 Nov 2008 15:09:15 -0000 1.9 +++ CMakeLists.txt 1 Dec 2008 16:20:39 -0000 1.10 @@ -34,7 +34,11 @@ qt4_add_resources(perfectspot_RESOURCES_SOURCES ${perfectspot_RESOURCES}) add_executable(perfectspot ${perfectspot_SOURCES} ${perfectspot_RESOURCES_SOURCES}) +IF (NOT WIN32) target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES}) +ELSE (NOT WIN32) +target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES} -mwindows) +ENDIF (NOT WIN32) install(TARGETS ${PROGNAME} DESTINATION bin) install(FILES perfectspot.png DESTINATION share/pixmaps) |
From: Fridrich S. <str...@us...> - 2008-12-01 16:20:46
|
Update of /cvsroot/libwpg/perfectspot/cmake In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6612/cmake Modified Files: FindLibWpd.cmake FindLibWpg.cmake Log Message: removing some warnings and making use of pkgconfig even on win32 Index: FindLibWpg.cmake =================================================================== RCS file: /cvsroot/libwpg/perfectspot/cmake/FindLibWpg.cmake,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FindLibWpg.cmake 28 Nov 2008 15:09:15 -0000 1.4 +++ FindLibWpg.cmake 1 Dec 2008 16:20:39 -0000 1.5 @@ -14,11 +14,11 @@ SET(LibWpg_FIND_QUIETLY TRUE) ENDIF (LIBWPG_INCLUDE_DIR AND LIBWPG_LIBRARIES) -IF (NOT WIN32) +#IF (NOT WIN32) INCLUDE(UsePkgConfig) PKGCONFIG(libwpg-0.2 _LibWpgIncDir _LibWpgLinkDir _LibWpgLinkFlags _LibWpgCflags) SET(LIBWPG_DEFINITIONS ${_LibWpgCflags}) -ENDIF (NOT WIN32) +#ENDIF (NOT WIN32) FIND_PATH(LIBWPG_INCLUDE_DIR libwpg-0.2/libwpg/libwpg.h PATHS Index: FindLibWpd.cmake =================================================================== RCS file: /cvsroot/libwpg/perfectspot/cmake/FindLibWpd.cmake,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FindLibWpd.cmake 28 Nov 2008 15:09:15 -0000 1.3 +++ FindLibWpd.cmake 1 Dec 2008 16:20:39 -0000 1.4 @@ -13,11 +13,11 @@ SET(LibWpd_FIND_QUIETLY TRUE) ENDIF (LIBWPD_INCLUDE_DIR) -IF (NOT WIN32) +#IF (NOT WIN32) INCLUDE(UsePkgConfig) PKGCONFIG(libwpd-0.9 _LibWpdIncDir _LibWpdLinkDir _LibWpdLinkFlags _LibWpdCflags) SET(LIBWPD_DEFINITIONS ${_LibWpdCflags}) -ENDIF (NOT WIN32) +#ENDIF (NOT WIN32) FIND_PATH(LIBWPD_INCLUDE_DIR libwpd-0.9/libwpd/libwpd.h PATHS @@ -32,7 +32,7 @@ FIND_LIBRARY(LIBWPD_STREAM_LIBRARIES NAMES wpd-stream-0.9 libwpd-stream-0.9 PATHS - ${_LibWPDLinkDir} + ${_LibWpdLinkDir} ) IF (LIBWPD_INCLUDE_DIR AND LIBWPD_LIBRARIES AND LIBWPD_STREAM_LIBRARIES) @@ -55,4 +55,5 @@ MESSAGE("libwpd include dir " ${LIBWPD_INCLUDE_DIR}) MESSAGE("libwpd lib dir " ${_LibWpdLinkDir}) MESSAGE("libwpd library " ${LIBWPD_LIBRARIES}) +MESSAGE("libwpd-stream library " ${LIBWPD_STREAM_LIBRARIES}) MESSAGE("libwpd cflags " ${LIBWPD_DEFINITIONS}) |
From: Fridrich S. <str...@us...> - 2008-11-28 15:10:02
|
Update of /cvsroot/libwpg/perfectspot/cmake In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9173/cmake Modified Files: FindLibWpd.cmake FindLibWpg.cmake Log Message: Branching off the stable branch STABLE-0-1-0 and porting perfectspot to the recent libwpg changes Index: FindLibWpg.cmake =================================================================== RCS file: /cvsroot/libwpg/perfectspot/cmake/FindLibWpg.cmake,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FindLibWpg.cmake 1 Jun 2007 21:18:32 -0000 1.3 +++ FindLibWpg.cmake 28 Nov 2008 15:09:15 -0000 1.4 @@ -16,22 +16,17 @@ IF (NOT WIN32) INCLUDE(UsePkgConfig) - PKGCONFIG(libwpg-0.1 _LibWpgIncDir _LibWpgLinkDir _LibWpgLinkFlags _LibWpgCflags) + PKGCONFIG(libwpg-0.2 _LibWpgIncDir _LibWpgLinkDir _LibWpgLinkFlags _LibWpgCflags) SET(LIBWPG_DEFINITIONS ${_LibWpgCflags}) ENDIF (NOT WIN32) -FIND_PATH(LIBWPG_INCLUDE_DIR libwpg-0.1/libwpg/libwpg.h +FIND_PATH(LIBWPG_INCLUDE_DIR libwpg-0.2/libwpg/libwpg.h PATHS ${_LibWpgIncDir} PATH_SUFFIXES libwpg ) -FIND_LIBRARY(LIBWPG_LIBRARIES NAMES wpg-0.1 libwpg-0.1 - PATHS - ${_LibWpgLinkDir} - ) - -FIND_LIBRARY(LIBWPG_STREAM_LIBRARIES NAMES wpg-stream-0.1 libwpg-stream-0.1 +FIND_LIBRARY(LIBWPG_LIBRARIES NAMES wpg-0.2 libwpg-0.2 PATHS ${_LibWpgLinkDir} ) @@ -56,5 +51,4 @@ MESSAGE("libwpg include dir " ${LIBWPG_INCLUDE_DIR}) MESSAGE("libwpg lib dir " ${_LibWpgLinkDir}) MESSAGE("libwpg library " ${LIBWPG_LIBRARIES}) -MESSAGE("libwpg stream library " ${LIBWPG_STREAM_LIBRARIES}) MESSAGE("libwpg cflags " ${LIBWPG_DEFINITIONS}) Index: FindLibWpd.cmake =================================================================== RCS file: /cvsroot/libwpg/perfectspot/cmake/FindLibWpd.cmake,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FindLibWpd.cmake 1 Jun 2007 21:18:32 -0000 1.2 +++ FindLibWpd.cmake 28 Nov 2008 15:09:15 -0000 1.3 @@ -15,32 +15,44 @@ IF (NOT WIN32) INCLUDE(UsePkgConfig) - PKGCONFIG(libwpd-0.8 _LibWpdIncDir _LibWpdLinkDir _LibWpdLinkFlags _LibWpdCflags) + PKGCONFIG(libwpd-0.9 _LibWpdIncDir _LibWpdLinkDir _LibWpdLinkFlags _LibWpdCflags) SET(LIBWPD_DEFINITIONS ${_LibWpdCflags}) ENDIF (NOT WIN32) -FIND_PATH(LIBWPD_INCLUDE_DIR libwpd-0.8/libwpd/WPXStream.h +FIND_PATH(LIBWPD_INCLUDE_DIR libwpd-0.9/libwpd/libwpd.h PATHS ${_LibWpdIncDir} PATH_SUFFIXES libwpd ) -IF (LIBWPD_INCLUDE_DIR) +FIND_LIBRARY(LIBWPD_LIBRARIES NAMES wpd-0.9 libwpd-0.9 + PATHS + ${_LibWpdLinkDir} + ) + +FIND_LIBRARY(LIBWPD_STREAM_LIBRARIES NAMES wpd-stream-0.9 libwpd-stream-0.9 + PATHS + ${_LibWPDLinkDir} + ) + +IF (LIBWPD_INCLUDE_DIR AND LIBWPD_LIBRARIES AND LIBWPD_STREAM_LIBRARIES) SET(LIBWPD_FOUND TRUE) -ELSE (LIBWPD_INCLUDE_DIR) +ELSE (LIBWPD_INCLUDE_DIR AND LIBWPD_LIBRARIES AND LIBWPD_STREAM_LIBRARIES) SET(LIBWPD_FOUND FALSE) -ENDIF (LIBWPD_INCLUDE_DIR) +ENDIF (LIBWPD_INCLUDE_DIR AND LIBWPD_LIBRARIES AND LIBWPD_STREAM_LIBRARIES) IF (LIBWPD_FOUND) IF (NOT LibWpd_FIND_QUIETLY) - MESSAGE(STATUS "Found libwpd headers: ${LIBWPD_INCLUDE_DIR}") + MESSAGE(STATUS "Found libwpd: ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES}") ENDIF (NOT LibWpd_FIND_QUIETLY) ELSE (LIBWPD_FOUND) IF (LibWpd_FIND_REQUIRED) - MESSAGE(SEND_ERROR "Could NOT find libwpd headers") + MESSAGE(SEND_ERROR "Could NOT find libwpd") ENDIF (LibWpd_FIND_REQUIRED) ENDIF (LIBWPD_FOUND) -MESSAGE("libwpd headers found " ${LIBWPD_FOUND}) +MESSAGE("libwpd found " ${LIBWPD_FOUND}) MESSAGE("libwpd include dir " ${LIBWPD_INCLUDE_DIR}) +MESSAGE("libwpd lib dir " ${_LibWpdLinkDir}) +MESSAGE("libwpd library " ${LIBWPD_LIBRARIES}) MESSAGE("libwpd cflags " ${LIBWPD_DEFINITIONS}) |
Update of /cvsroot/libwpg/perfectspot/src/odg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9173/src/odg Modified Files: FileOutputHandler.cxx FileOutputHandler.hxx GraphicsElement.cxx GraphicsElement.hxx OdgExporter.cxx OdgExporter.hxx Removed Files: GraphicsHandler.hxx Log Message: Branching off the stable branch STABLE-0-1-0 and porting perfectspot to the recent libwpg changes Index: GraphicsElement.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/GraphicsElement.hxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GraphicsElement.hxx 10 Jun 2007 20:51:59 -0000 1.2 +++ GraphicsElement.hxx 28 Nov 2008 15:09:15 -0000 1.3 @@ -1,7 +1,7 @@ /* GraphicsElement: The items we are collecting to be put into the Writer * document: paragraph and spans of text, as well as section breaks. * - * Copyright (C) 2002-2003 William Lachance (wil...@sy...) + * Copyright (C) 2002-2003 William Lachance (wr...@gm...) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +14,8 @@ * 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 + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For further information visit http://libwpd.sourceforge.net * @@ -28,57 +27,58 @@ #ifndef _GRAPHICSELEMENT_H #define _GRAPHICSELEMENT_H -#include <string> -#include <map> +#include <libwpd/libwpd.h> #include <vector> -#include "GraphicsHandler.hxx" +#include "FileOutputHandler.hxx" class GraphicsElement { public: virtual ~GraphicsElement() {} - virtual void write(GraphicsHandler *pHandler) const = 0; + virtual void write(FileOutputHandler *pHandler) const = 0; virtual void print() const {} }; -class TagGraphicsElement : public GraphicsElement +class TagElement : public GraphicsElement { public: - explicit TagGraphicsElement(const char *szTagName) : msTagName(szTagName) {} - const std::string &getTagName() const { return msTagName; } - virtual void print() const; + virtual ~TagElement() {} + TagElement(const char *szTagName) : msTagName(szTagName) {} + const WPXString & getTagName() const { return msTagName; } + virtual void print() const {}; private: - const std::string msTagName; + WPXString msTagName; }; -class OpenTagGraphicsElement : public TagGraphicsElement +class TagOpenElement : public TagElement { public: - explicit OpenTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {} - ~OpenTagGraphicsElement() {} - void addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue); - virtual void write(GraphicsHandler *pHandler) const; + TagOpenElement(const char *szTagName) : TagElement(szTagName) {} + virtual ~TagOpenElement() {} + void addAttribute(const char *szAttributeName, const WPXString &sAttributeValue); + virtual void write(FileOutputHandler *pHandler) const; virtual void print () const; private: - std::vector<std::pair<std::string, std::string> > maAttrList; + WPXPropertyList maAttrList; }; -class CloseTagGraphicsElement : public TagGraphicsElement +class TagCloseElement : public TagElement { public: - explicit CloseTagGraphicsElement(const char *szTagName) : TagGraphicsElement(szTagName) {} - virtual void write(GraphicsHandler *pHandler) const; + TagCloseElement(const char *szTagName) : TagElement(szTagName) {} + virtual ~TagCloseElement() {} + virtual void write(FileOutputHandler *pHandler) const; }; -class CharDataGraphicsElement : public GraphicsElement +class CharDataElement : public GraphicsElement { public: - CharDataGraphicsElement(const char *sData) : GraphicsElement(), msData(sData) {} - virtual void write(GraphicsHandler *pHandler) const; + CharDataElement(const char *sData) : GraphicsElement(), msData(sData) {} + virtual ~CharDataElement() {} + virtual void write(FileOutputHandler *pHandler) const; private: - std::string msData; + WPXString msData; }; - #endif Index: GraphicsElement.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/GraphicsElement.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GraphicsElement.cxx 10 Jun 2007 20:51:59 -0000 1.2 +++ GraphicsElement.cxx 28 Nov 2008 15:09:15 -0000 1.3 @@ -1,7 +1,7 @@ /* GraphicsElement: The items we are collecting to be put into the Writer * document: paragraph and spans of text, as well as section breaks. * - * Copyright (C) 2002-2003 William Lachance (wil...@sy...) + * Copyright (C) 2002-2003 William Lachance (wr...@gm...) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,11 +14,10 @@ * 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 + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For further information visit http://libwpd.sourceforge.net * */ @@ -27,40 +26,30 @@ */ #include "GraphicsElement.hxx" -#include "GraphicsHandler.hxx" +#include "FileOutputHandler.hxx" #include <string.h> -#define ASCII_SPACE 0x0020 - -void TagGraphicsElement::print() const -{ -} - -void OpenTagGraphicsElement::write(GraphicsHandler *pHandler) const +void TagOpenElement::write(FileOutputHandler *pHandler) const { - pHandler->startElement(getTagName().c_str(), maAttrList); + pHandler->startElement(getTagName().cstr(), maAttrList); } -void OpenTagGraphicsElement::print() const +void TagOpenElement::print() const { - TagGraphicsElement::print(); + TagElement::print(); } -void OpenTagGraphicsElement::addAttribute(const std::string &szAttributeName, const std::string &sAttributeValue) +void TagOpenElement::addAttribute(const char *szAttributeName, const WPXString &sAttributeValue) { - std::pair<std::string, std::string> tmpAttribute; - tmpAttribute.first = szAttributeName; - tmpAttribute.second = sAttributeValue; - maAttrList.push_back(tmpAttribute); + maAttrList.insert(szAttributeName, sAttributeValue); } -void CloseTagGraphicsElement::write(GraphicsHandler *pHandler) const +void TagCloseElement::write(FileOutputHandler *pHandler) const { - - pHandler->endElement(getTagName().c_str()); + pHandler->endElement(getTagName().cstr()); } -void CharDataGraphicsElement::write(GraphicsHandler *pHandler) const +void CharDataElement::write(FileOutputHandler *pHandler) const { pHandler->characters(msData); } Index: OdgExporter.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- OdgExporter.cxx 3 Jul 2007 21:16:40 -0000 1.7 +++ OdgExporter.cxx 28 Nov 2008 15:09:15 -0000 1.8 @@ -26,69 +26,64 @@ #include "OdgExporter.hxx" #include "GraphicsElement.hxx" -#include "GraphicsHandler.hxx" +#include "FileOutputHandler.hxx" #include <locale.h> +#include <math.h> +#include <string> -static std::string doubleToString(const double value) -{ [...964 lines suppressed...] + mGraphicsAutomaticStyles.push_back(new TagCloseElement("style:style")); + miGraphicsStyleIndex++; +} + +WPXString OdgExporter::doubleToString(const double value) +{ + WPXString tempString; + tempString.sprintf("%.4f", value); + std::string decimalPoint(localeconv()->decimal_point); + if ((decimalPoint.size() == 0) || (decimalPoint == ".")) + return tempString; + std::string stringValue(tempString.cstr()); + if (!stringValue.empty()) + { + std::string::size_type pos; + while ((pos = stringValue.find(decimalPoint)) != std::string::npos) + stringValue.replace(pos,decimalPoint.size(),"."); + } + return WPXString(stringValue.c_str()); } Index: FileOutputHandler.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/FileOutputHandler.hxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FileOutputHandler.hxx 17 May 2007 14:35:12 -0000 1.1 +++ FileOutputHandler.hxx 28 Nov 2008 15:09:15 -0000 1.2 @@ -29,21 +29,22 @@ #include <iostream> #include <sstream> #include <string> -#include "GraphicsHandler.hxx" +#include <libwpd/libwpd.h> +#include "FileOutputHandler.hxx" -class FileOutputHandler : public GraphicsHandler +class FileOutputHandler { public: explicit FileOutputHandler(std::ostringstream &contentStream); virtual void startDocument(); virtual void endDocument(); - virtual void startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList); + virtual void startElement(const char *psName, const WPXPropertyList &xPropList); virtual void endElement(const char *psName); - virtual void characters(const std::string &sCharacters); + virtual void characters(const WPXString &sCharacters); private: bool mbIsTagOpened; - std::string msOpenedTagName; + WPXString msOpenedTagName; std::ostringstream &mContentStream; }; #endif Index: FileOutputHandler.cxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/FileOutputHandler.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FileOutputHandler.cxx 10 Jun 2007 20:51:59 -0000 1.2 +++ FileOutputHandler.cxx 28 Nov 2008 15:09:15 -0000 1.3 @@ -23,6 +23,7 @@ * Corel Corporation or Corel Corporation Limited." */ +#include <string.h> #include "FileOutputHandler.hxx" #include "femtozip.hxx" @@ -36,7 +37,7 @@ { } -void FileOutputHandler::startElement(const char *psName, const std::vector<std::pair<std::string, std::string> > &xPropList) +void FileOutputHandler::startElement(const char *psName, const WPXPropertyList &xPropList) { if (mbIsTagOpened) { @@ -45,9 +46,12 @@ } mContentStream << "<" << psName; - for (std::vector<std::pair<std::string, std::string> >::const_iterator i = xPropList.begin(); i != xPropList.end(); i++) + WPXPropertyList::Iter i(xPropList); + for (i.rewind(); i.next(); ) { - mContentStream << " " << (*i).first.c_str() << "=\"" << (*i).second.c_str() << "\""; + // filter out libwpd elements + if (strncmp(i.key(), "libwpd", 6) != 0) + mContentStream << " " << i.key() << "=\"" << i()->getStr().cstr() << "\""; } mbIsTagOpened = true; msOpenedTagName = psName; @@ -76,14 +80,14 @@ } } -void FileOutputHandler::characters(const std::string &sCharacters) +void FileOutputHandler::characters(const WPXString &sCharacters) { if (mbIsTagOpened) { mContentStream << ">"; mbIsTagOpened = false; } - mContentStream << sCharacters.c_str(); + mContentStream << sCharacters.cstr(); } void FileOutputHandler::endDocument() --- GraphicsHandler.hxx DELETED --- Index: OdgExporter.hxx =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/odg/OdgExporter.hxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- OdgExporter.hxx 3 Jul 2007 21:16:40 -0000 1.4 +++ OdgExporter.hxx 28 Nov 2008 15:09:15 -0000 1.5 @@ -23,54 +23,63 @@ * Corel Corporation or Corel Corporation Limited." */ -#ifndef __ODGEXPORTER_H__ -#define __ODGEXPORTER_H__ +#ifndef __ODGEXPORTER_HXX__ +#define __ODGEXPORTER_HXX__ #include <iostream> #include <sstream> #include <string> +#include <libwpd/libwpd.h> #include <libwpg/libwpg.h> #include "GraphicsElement.hxx" +#include "FileOutputHandler.hxx" class OdgExporter : public libwpg::WPGPaintInterface { public: - OdgExporter(GraphicsHandler *pHandler, const bool isFlatXML = false); + OdgExporter(FileOutputHandler *pHandler, const bool isFlatXML = false); ~OdgExporter(); - void startGraphics(double imageWidth, double imageHeight); + void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); - void startLayer(unsigned int id); - void endLayer(unsigned int id); + void startLayer(const ::WPXPropertyList &propList); + void endLayer(); + void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} + void endEmbeddedGraphics() {} - void setPen(const libwpg::WPGPen& pen); - void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(FillRule rule); + void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); - void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); - void drawPolygon(const libwpg::WPGPointArray& vertices); - void drawPath(const libwpg::WPGPath& path); - void drawBitmap(const libwpg::WPGBitmap& bitmap); - void drawImageObject(const libwpg::WPGBinaryData& binaryData); + void drawRectangle(const ::WPXPropertyList &propList); + void drawEllipse(const ::WPXPropertyList &propList); + void drawPolyline(const ::WPXPropertyListVector& vertices); + void drawPolygon(const ::WPXPropertyListVector& vertices); + void drawPath(const ::WPXPropertyListVector& path); + void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: + void writeGraphicsStyle(); + WPXString doubleToString(const double value); + void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); + + // body elements std::vector <GraphicsElement *> mBodyElements; - std::vector <GraphicsElement *> mAutomaticStylesElements; - std::vector <GraphicsElement *> mStrokeDashElements; - std::vector <GraphicsElement *> mGradientElements; - GraphicsHandler *mpHandler; - libwpg::WPGPen m_pen; - libwpg::WPGBrush m_brush; - FillRule m_fillRule; - int m_gradientIndex; - int m_dashIndex; - int m_styleIndex; - void writeStyle(); - std::ostringstream m_value, m_name; - double m_width, m_height; - const bool m_isFlatXML; + // graphics styles + std::vector<GraphicsElement *> mGraphicsStrokeDashStyles; + std::vector<GraphicsElement *> mGraphicsGradientStyles; + std::vector<GraphicsElement *> mGraphicsAutomaticStyles; + + FileOutputHandler *mpHandler; + + libwpg::WPGPen mxPen; + libwpg::WPGBrush mxBrush; + int miGradientIndex; + int miDashIndex; + int miGraphicsStyleIndex; + double mfWidth; + double mfHeight; + + const bool mbIsFlatXML; }; -#endif // __ODGEXPORTER_H__ +#endif // __ODGEXPORTER_HXX__ |
From: Fridrich S. <str...@us...> - 2008-11-28 15:09:57
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9173/src Modified Files: CMakeLists.txt renderer.cpp Log Message: Branching off the stable branch STABLE-0-1-0 and porting perfectspot to the recent libwpg changes Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/CMakeLists.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CMakeLists.txt 11 Oct 2007 11:44:17 -0000 1.8 +++ CMakeLists.txt 28 Nov 2008 15:09:15 -0000 1.9 @@ -1,3 +1,6 @@ +if(COMMAND cmake_policy) +cmake_policy(SET CMP0005 OLD) +endif(COMMAND cmake_policy) # note: change this BEFORE making a release !! ADD_DEFINITIONS(-DPERFECTSPOT_VERSION=\"CVS\" ) @@ -31,7 +34,7 @@ qt4_add_resources(perfectspot_RESOURCES_SOURCES ${perfectspot_RESOURCES}) add_executable(perfectspot ${perfectspot_SOURCES} ${perfectspot_RESOURCES_SOURCES}) -target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES}) +target_link_libraries(perfectspot ${QT_LIBRARIES} ${LIBWPG_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPD_STREAM_LIBRARIES}) install(TARGETS ${PROGNAME} DESTINATION bin) install(FILES perfectspot.png DESTINATION share/pixmaps) Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- renderer.cpp 12 Jul 2008 00:07:05 -0000 1.14 +++ renderer.cpp 28 Nov 2008 15:09:15 -0000 1.15 @@ -27,7 +27,7 @@ #include <libwpg/libwpg.h> -#include <libwpg/WPGStreamImplementation.h> +#include <libwpd-stream/libwpd-stream.h> #include <QtGui> #include <QFile> @@ -36,7 +36,6 @@ #include "odg/femtozip.hxx" #include "odg/FileOutputHandler.hxx" - using namespace libwpg; class Painter : public WPGPaintInterface @@ -45,30 +44,29 @@ double width, height; Painter(QPainter* target); - void startGraphics(double imageWidth, double imageHeight); - void endGraphics(); - void startLayer(unsigned int id); - void endLayer(unsigned int id); + void startGraphics(const ::WPXPropertyList &propList); + void endGraphics(); + void startLayer(const ::WPXPropertyList& propList); + void endLayer(); + void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} + void endEmbeddedGraphics() {} - void setPen(const WPGPen& pen); - void setBrush(const WPGBrush& brush); - void setFillRule(FillRule rule); + void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); - void drawRectangle(const WPGRect& rect, double rx, double ry); - void drawEllipse(const WPGPoint& center, double rx, double ry); - void drawPolygon(const WPGPointArray& vertices); - void drawPath(const WPGPath& path); - void drawBitmap(const WPGBitmap& bitmap); - void drawImageObject(const libwpg::WPGBinaryData& binaryData) { /* TODO: how does one do this one in QT ? :-) */ } + void drawRectangle(const ::WPXPropertyList &propList); + void drawEllipse(const ::WPXPropertyList& propList); + void drawPolyline(const ::WPXPropertyListVector& vertices); + void drawPolygon(const ::WPXPropertyListVector& vertices); + void drawPath(const ::WPXPropertyListVector& path); + void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: QPainter* m_target; double m_zoomX; double m_zoomY; - FillRule m_fillRule; }; -Painter::Painter(QPainter* t): m_target(t), m_fillRule(AlternatingFill) +Painter::Painter(QPainter* t): m_target(t) { width = 100; height = 100; @@ -76,16 +74,16 @@ m_zoomY = 1.0; } -void Painter::startGraphics(double w, double h) +void Painter::startGraphics(const ::WPXPropertyList &propList) { - width = w; - height = h; + width = propList["svg:width"]->getFloat(); + height = propList["svg:height"]->getFloat(); - m_zoomX = m_target->viewport().width() / w; - m_zoomY = m_target->viewport().height() / h; + m_zoomX = m_target->viewport().width() / width; + m_zoomY = m_target->viewport().height() / height; } -void Painter::setPen(const WPGPen& pen) +void Painter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { QPen ppen(Qt::SolidLine); @@ -93,8 +91,8 @@ if(pen.width == 0) ppen.setStyle(Qt::NoPen); - QColor c(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue); - ppen.setColor(c); + QColor cPen(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue); + ppen.setColor(cPen); if(!pen.solid) { @@ -105,14 +103,11 @@ } m_target->setPen(ppen); -} -void Painter::setBrush(const WPGBrush& brush) -{ QBrush pbrush(Qt::SolidPattern); - QColor c(brush.foreColor.red, brush.foreColor.green, brush.foreColor.blue); - pbrush.setColor(c); + QColor cBrush(brush.foreColor.red, brush.foreColor.green, brush.foreColor.blue); + pbrush.setColor(cBrush); if(brush.style == WPGBrush::NoBrush) pbrush.setStyle(Qt::NoBrush); @@ -144,17 +139,12 @@ m_target->setBrush(pbrush); } -void Painter::setFillRule(FillRule rule) -{ - m_fillRule = rule; -} - -void Painter::startLayer(unsigned int id) +void Painter::startLayer(const ::WPXPropertyList& /* propList */) { // nothing to do } -void Painter::endLayer(unsigned int) +void Painter::endLayer() { // nothing to do } @@ -164,76 +154,72 @@ // nothing to do } -void Painter::drawRectangle(const WPGRect& rect, double rx, double ry) +void Painter::drawRectangle(const ::WPXPropertyList &propList) { - double roundx = rx * 200 / rect.width(); - double roundy = ry * 200 / rect.height(); - m_target->drawRoundRect((int)(m_zoomX*rect.x1), (int)(m_zoomY*rect.y1), (int)(m_zoomX*rect.width()), (int)(m_zoomY*rect.height()), (int)roundx, (int)roundy); + 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())); } -void Painter::drawEllipse(const WPGPoint& center, double rx, double ry) +void Painter::drawEllipse(const ::WPXPropertyList &propList) { - m_target->drawEllipse((int)(m_zoomX*(center.x - rx)), (int)(m_zoomY*(center.y - ry)), (int)(2*m_zoomX*rx), (int)(2*m_zoomY*ry)); + 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())); } -void Painter::drawPolygon(const WPGPointArray& vertices) +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].x, m_zoomY*vertices[i].y); + points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getFloat(), m_zoomY*vertices[i]["svg:y"]->getFloat()); m_target->drawPolygon(points, vertices.count()); delete [] points; } -void Painter::drawPath(const WPGPath& path) +void Painter::drawPolyline(const ::WPXPropertyListVector& vertices) { - QPainterPath p; - for(unsigned i = 0; i < path.count(); i++) - { - WPGPathElement element = path.element(i); - WPGPoint point = element.point; - switch(element.type) - { - case WPGPathElement::MoveToElement: - p.moveTo(m_zoomX*point.x, m_zoomY*point.y); - break; - - case WPGPathElement::LineToElement: - p.lineTo(m_zoomX*point.x, m_zoomY*point.y); - break; + 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()); - case WPGPathElement::CurveToElement: - p.cubicTo(m_zoomX*element.extra1.x, m_zoomY*element.extra1.y, - m_zoomX*element.extra2.x, m_zoomY*element.extra2.y, - m_zoomX*point.x, m_zoomY*point.y); - break; + m_target->drawPolyline(points, vertices.count()); + delete [] points; +} - default: - break; +void Painter::drawPath(const ::WPXPropertyListVector& path) +{ + QPainterPath p; + 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()); + 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()); + 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()); + else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i == path.count()) + p.closeSubpath(); } - } - - m_target->drawPath(p); + m_target->drawPath(p); } -void Painter::drawBitmap(const WPGBitmap& bitmap) +void Painter::drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData) { - QImage image; - image = QImage(bitmap.width(), bitmap.height(), QImage::Format_RGB32); - for(int x = 0; x < bitmap.width(); x++) - for(int y = 0; y < bitmap.height(); y++) - { - libwpg::WPGColor color = bitmap.pixel(x, y); - image.setPixel(x, y, qRgb(color.red, color.green, color.blue)); - } - + QImage image = QImage::fromData(binaryData.getDataBuffer(), binaryData.size()); + if (image.isNull()) + return; QRectF target; - target.setTopLeft( QPointF(m_zoomX*bitmap.rect.x1, m_zoomY*bitmap.rect.y1) ); - target.setBottomRight( QPointF(m_zoomX*bitmap.rect.x2, m_zoomY*bitmap.rect.y2) ); + 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())) ); - m_target->drawImage(target, image, QRectF(0, 0, bitmap.width(), bitmap.height()) ); + m_target->drawImage(target, image); } class RendererPrivate @@ -253,12 +239,12 @@ if(file.open(QFile::ReadOnly)) { QByteArray buf = file.readAll(); - const char* data = buf.data(); + const unsigned char* data = (const unsigned char *)buf.data(); int size = buf.size(); - d->stream = new WPGMemoryStream(data, size); + d->stream = new ::WPXStringStream(data, size); if (d->stream && d->stream->isOLEStream()) { - WPXInputStream *tempStream = d->stream->getDocumentOLEStream(); + WPXInputStream *tempStream = d->stream->getDocumentOLEStream("PerfectOffice_MAIN"); if (tempStream) { delete d->stream; @@ -294,7 +280,7 @@ bool Renderer::renderSVG(const QString& outputFile) { - libwpg::WPGString output; + ::WPXString output; if (!libwpg::WPGraphics::generateSVG(d->stream, output)) return false; @@ -340,7 +326,6 @@ zip.createEntry("styles.xml", 0); zip.writeString(tmpStringStream.str().c_str()); zip.closeEntry(); - return true; } |
From: Fridrich S. <str...@us...> - 2008-11-28 15:09:29
|
Update of /cvsroot/libwpg/perfectspot In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9173 Modified Files: CMakeLists.txt perfectspot.spec Log Message: Branching off the stable branch STABLE-0-1-0 and porting perfectspot to the recent libwpg changes Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/libwpg/perfectspot/CMakeLists.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CMakeLists.txt 9 Oct 2007 13:37:16 -0000 1.3 +++ CMakeLists.txt 28 Nov 2008 15:09:15 -0000 1.4 @@ -10,7 +10,7 @@ include(FindLibWpd) include(FindLibWpg) -include_directories(${LIBWPD_INCLUDE_DIR}/libwpd-0.8 ${LIBWPG_INCLUDE_DIR}/libwpg-0.1) +include_directories(${LIBWPD_INCLUDE_DIR}/libwpd-0.9 ${LIBWPG_INCLUDE_DIR}/libwpg-0.2) set(QT_MIN_VERSION "4.1.0") find_package(Qt4 REQUIRED) @@ -28,9 +28,9 @@ # for making a source tarball # note: adjust version and package filename before making a release set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "0") -set(CPACK_PACKAGE_VERSION_PATCH "1") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "perfectspot-0.0.1") +set(CPACK_PACKAGE_VERSION_MINOR "2") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "perfectspot-0.2.0") set(CPACK_PACKAGE_NAME ${PROGNAME}) set(CPACK_SOURCE_GENERATOR "TGZ") #set(CPACK_PACKAGE_VENDOR "libwpg.sf.net") Index: perfectspot.spec =================================================================== RCS file: /cvsroot/libwpg/perfectspot/perfectspot.spec,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- perfectspot.spec 10 Jul 2008 22:24:25 -0000 1.4 +++ perfectspot.spec 28 Nov 2008 15:09:15 -0000 1.5 @@ -6,13 +6,13 @@ Name: perfectspot BuildRequires: cmake libqt4-devel BuildRequires: gcc-c++, libstdc++-devel, pkgconfig -BuildRequires: libwpg-devel >= 0.1.0 -BuildRequires: libwpd-devel >= 0.8.0 +BuildRequires: libwpg-devel >= 0.2.0 +BuildRequires: libwpd-devel >= 0.2.0 URL: http://libwpg.sourceforge.net License: GPL v2 or later Group: Productivity/Graphics/Viewers Summary: WordPerfect Graphics Viewer -Version: 0.0.1 +Version: 0.2.0 Release: 1 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: perfectspot-%{version}.tar.gz |
From: Fridrich S. <str...@us...> - 2008-11-28 12:26:33
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28309/src/conv/raw Modified Files: wpg2raw.cpp Log Message: joining all the style related callback into one since we are calling them together Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- wpg2raw.cpp 28 Nov 2008 11:53:03 -0000 1.17 +++ wpg2raw.cpp 28 Nov 2008 12:25:45 -0000 1.18 @@ -43,9 +43,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} void endEmbeddedGraphics() {} - void setPen(const libwpg::WPGPen& pen); - void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -126,14 +124,9 @@ printf("RawPainter::endLayer\n"); } -void RawPainter::setPen(const libwpg::WPGPen& /*pen*/) -{ - printf("RawPainter::setPen\n"); -} - -void RawPainter::setBrush(const libwpg::WPGBrush& brush) +void RawPainter::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { - printf("RawPainter::setBrush\n"); + printf("RawPainter::setStyle(%s)\n", getPropString(propList).cstr()); printf(" Brush style: "); switch(brush.style) @@ -158,11 +151,6 @@ brush.gradient.stopColor(c).green, brush.gradient.stopColor(c).blue); } -void RawPainter::setFillRule(const ::WPXPropertyList &propList) -{ - printf("RawPainter::setFillRule (%s)\n", getPropString(propList).cstr()); -} - void RawPainter::drawRectangle(const ::WPXPropertyList &propList) { printf("RawPainter::drawRectangle (%s)\n", getPropString(propList).cstr()); |
From: Fridrich S. <str...@us...> - 2008-11-28 12:26:30
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28309/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: joining all the style related callback into one since we are calling them together Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPGPaintInterface.h 28 Nov 2008 11:53:03 -0000 1.16 +++ WPGPaintInterface.h 28 Nov 2008 12:25:45 -0000 1.17 @@ -41,11 +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 setPen(const WPGPen& pen) = 0; - - virtual void setBrush(const WPGBrush& brush) = 0; - - virtual void setFillRule(const ::WPXPropertyList &propList) = 0; + virtual void setStyle(const WPGPen& pen, const WPGBrush& brush, const ::WPXPropertyList &propList) = 0; virtual void startLayer(const ::WPXPropertyList& propList) = 0; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- WPG2Parser.cpp 28 Nov 2008 11:53:03 -0000 1.88 +++ WPG2Parser.cpp 28 Nov 2008 12:25:45 -0000 1.89 @@ -608,14 +608,14 @@ return; WPGGroupContext& context = m_groupStack.top(); - m_painter->setBrush( context.compoundFilled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( context.compoundFramed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(context.compoundWindingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + + m_painter->setStyle( context.compoundFramed ? m_pen : libwpg::WPGPen(), context.compoundFilled ? m_brush : libwpg::WPGBrush(), fillRule ); + if (context.compoundClosed) { WPXPropertyList element; @@ -1192,14 +1192,12 @@ else { // otherwise draw directly - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(objCh.windingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + 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 @@ -1287,14 +1285,12 @@ else { // otherwise draw directly - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(objCh.windingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); m_painter->drawPath(path); } } @@ -1332,8 +1328,7 @@ propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); m_painter->drawRectangle(propList); WPG_DEBUG_MSG((" X1 : %li\n", x1)); @@ -1375,8 +1370,7 @@ if (objCh.rotate) propList.insert("libwpg:rotate", (float)(objCh.rotationAngle)); - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); 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) */); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- WPG1Parser.cpp 28 Nov 2008 11:53:03 -0000 1.52 +++ WPG1Parser.cpp 28 Nov 2008 12:25:45 -0000 1.53 @@ -373,8 +373,8 @@ point.insert("svg:y", (float)((double)(m_height-ey)/1200.0)); points.append(point); - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Line\n")); @@ -400,8 +400,8 @@ points.append(point); } - m_painter->setBrush(libwpg::WPGBrush()); // not filled - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, libwpg::WPGBrush(),::WPXPropertyList()); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Polyline\n")); @@ -423,8 +423,8 @@ propList.insert("svg:width", (float)((double)w/1200.0)); propList.insert("svg:height",(float)((double)h/1200.0)); - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG(("Line\n")); @@ -451,8 +451,8 @@ points.append(point); } - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPolygon(points); WPG_DEBUG_MSG(("Polygon\n")); @@ -475,8 +475,8 @@ int endAngle = readS16(); unsigned flags = readU16(); #endif - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawEllipse(propList); WPG_DEBUG_MSG(("Ellipse\n")); @@ -496,7 +496,6 @@ ::WPXPropertyListVector path; ::WPXPropertyList element; - bool path_closed = false; long xInitial = readS16(); long yInitial = readS16(); element.insert("libwpg:path-action", "M"); @@ -523,8 +522,8 @@ } - m_painter->setBrush(path_closed ? m_brush : libwpg::WPGBrush()); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPath(path); WPG_DEBUG_MSG(("Curved Polyline\n")); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPGSVGGenerator.h 28 Nov 2008 11:53:03 -0000 1.16 +++ WPGSVGGenerator.h 28 Nov 2008 12:25:45 -0000 1.17 @@ -47,9 +47,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} - void setPen(const libwpg::WPGPen& pen); - void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- WPGSVGGenerator.cpp 28 Nov 2008 11:53:03 -0000 1.22 +++ WPGSVGGenerator.cpp 28 Nov 2008 12:25:45 -0000 1.23 @@ -79,13 +79,10 @@ m_outputSink << "</svg>\n"; } -void libwpg::WPGSVGGenerator::setPen(const libwpg::WPGPen& pen) +void libwpg::WPGSVGGenerator::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { m_pen = pen; -} -void libwpg::WPGSVGGenerator::setBrush(const libwpg::WPGBrush& brush) -{ m_brush = brush; if(m_brush.style == libwpg::WPGBrush::Gradient) @@ -129,11 +126,9 @@ m_outputSink << "</defs>\n"; } -} -void libwpg::WPGSVGGenerator::setFillRule(const ::WPXPropertyList &propList) -{ m_fillRule = propList; + } void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) |
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18191/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGBitmap.cpp WPGBitmap.h WPGBrush.cpp WPGBrush.h WPGGradient.cpp WPGGradient.h WPGPaintInterface.h WPGPen.cpp WPGPen.h WPGSVGGenerator.cpp WPGSVGGenerator.h WPGXParser.cpp WPGXParser.h libwpg.h.in Log Message: removing public visibility of WPGBitmap class since Qt4 is able to load a bitmap from a bmp Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- libwpg.h.in 27 Nov 2008 16:33:00 -0000 1.10 +++ libwpg.h.in 28 Nov 2008 11:53:03 -0000 1.11 @@ -39,6 +39,5 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGBitmap.h" #endif Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGBrush.h 27 Nov 2008 21:42:16 -0000 1.7 +++ WPGBrush.h 28 Nov 2008 11:53:03 -0000 1.8 @@ -54,10 +54,6 @@ WPGBrush(WPGBrushStyle brushStyle); -// explicit WPGBrush(const WPGColor& fore); - -// WPGBrush(const WPGColor& fore, const WPGColor& back); - WPGBrush(const WPGBrush& brush); WPGBrush& operator=(const WPGBrush& brush); Index: WPGGradient.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGGradient.cpp 27 Nov 2008 21:42:16 -0000 1.6 +++ WPGGradient.cpp 28 Nov 2008 11:53:03 -0000 1.7 @@ -103,13 +103,6 @@ return d->gradientStops[index].color; } -#if 0 -void libwpg::WPGGradient::clear() -{ - d->gradientStops.clear(); -} -#endif - void libwpg::WPGGradient::addStop(double offset, const libwpg::WPGColor& color) { libwpg::WPGGradientStop stop(offset, color); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- WPG1Parser.cpp 27 Nov 2008 16:33:00 -0000 1.51 +++ WPG1Parser.cpp 28 Nov 2008 11:53:03 -0000 1.52 @@ -665,17 +665,6 @@ } } - - // debugging only - if(buffer && 0) - { - for(unsigned x = 0; x < width; x++) - for(unsigned y = 0; y < height; y++) - { - libwpg::WPGColor color = bitmap.pixel(x,y); - WPG_DEBUG_MSG((" pixel at %d, %d: %3d %3d %3d\n", x, y, color.red, color.green, color.blue)); - } - } } void WPG1Parser::handleBitmapTypeOne() @@ -719,13 +708,14 @@ propList.insert("svg:y", 0.0f); propList.insert("svg:width", (float)((double)width/(double)hres)); propList.insert("svg:height", (float)((double)height/(double)vres)); + propList.insert("libwpg:mime-type", "image/bmp"); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } } @@ -787,13 +777,14 @@ propList.insert("svg:y", (float)((double)(ys1)/1200.0)); propList.insert("svg:width", (float)((double)(xs2-xs1)/1200.0)); propList.insert("svg:height", (float)((double)(ys2-ys1)/1200.0)); + propList.insert("libwpg:mime-type", "image/bmp"); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } } Index: WPGBitmap.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- WPGBitmap.h 27 Nov 2008 16:33:00 -0000 1.10 +++ WPGBitmap.h 28 Nov 2008 11:53:03 -0000 1.11 @@ -36,9 +36,7 @@ class WPGBitmap { public: - WPGBitmap(int width, int height); - - WPGBitmap(int width, int height, bool verticalFlip, bool horizontalFlip); + WPGBitmap(int width, int height, bool verticalFlip=false, bool horizontalFlip=false); WPGBitmap(const WPGBitmap&); @@ -54,8 +52,6 @@ // return height in pixel int height() const; - WPGColor pixel(int x, int y) const; - void setPixel(int x, int y, const WPGColor& color); const ::WPXBinaryData& getDIB() const; Index: WPGXParser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPGXParser.cpp 11 Dec 2007 14:44:32 -0000 1.16 +++ WPGXParser.cpp 28 Nov 2008 11:53:03 -0000 1.17 @@ -66,11 +66,6 @@ return (unsigned long)(p0|(p1<<8)|(p2<<16)|(p3<<24)); } -signed char WPGXParser::readS8() -{ - return (signed char)readU8(); -} - short WPGXParser::readS16() { return (short)readU16(); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- WPGSVGGenerator.h 27 Nov 2008 21:42:16 -0000 1.15 +++ WPGSVGGenerator.h 28 Nov 2008 11:53:03 -0000 1.16 @@ -56,7 +56,6 @@ void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); - void drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- WPG2Parser.h 27 Nov 2008 21:42:16 -0000 1.30 +++ WPG2Parser.h 28 Nov 2008 11:53:03 -0000 1.31 @@ -31,6 +31,7 @@ #include "WPGXParser.h" #include "WPGBrush.h" #include "WPGPen.h" +#include "WPGBitmap.h" #include <libwpd/libwpd.h> #include <map> Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- WPGBitmap.cpp 27 Nov 2008 16:33:00 -0000 1.23 +++ WPGBitmap.cpp 28 Nov 2008 11:53:03 -0000 1.24 @@ -70,11 +70,6 @@ Private(int w, int h): width(w), height(h), vFlip(false), hFlip(false), pixels(0), dib() {} }; -libwpg::WPGBitmap::WPGBitmap(int w, int h): d(new Private(w, h)) -{ - d->pixels = new WPGColor[w*h]; -} - libwpg::WPGBitmap::WPGBitmap(int w, int h, bool verticalFlip, bool horizontalFlip) : d(new Private(w, h)) { @@ -124,14 +119,6 @@ return d->height; } -libwpg::WPGColor libwpg::WPGBitmap::pixel(int x, int y) const -{ - if((x < 0) || (y <0) || (x >= d->width) || (y >= d->height)) - return libwpg::WPGColor(); - - return d->pixels[y*d->width + x]; -} - void libwpg::WPGBitmap::setPixel(int x, int y, const libwpg::WPGColor& color) { if((x < 0) || (y <0) || (x >= d->width) || (y >= d->height)) Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WPG1Parser.h 24 Jul 2008 13:52:24 -0000 1.19 +++ WPG1Parser.h 28 Nov 2008 11:53:03 -0000 1.20 @@ -31,6 +31,7 @@ #include "WPGXParser.h" #include "WPGBrush.h" #include "WPGPen.h" +#include "WPGBitmap.h" #include <vector> class WPG1Parser : public WPGXParser Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPGBrush.cpp 27 Nov 2008 21:42:16 -0000 1.4 +++ WPGBrush.cpp 28 Nov 2008 11:53:03 -0000 1.5 @@ -39,22 +39,6 @@ gradient() {} -#if 0 -libwpg::WPGBrush::WPGBrush(const WPGColor& fore): - style(Solid), - foreColor(fore), - backColor(0xFF,0xFF,0xFF), - gradient() -{} - -libwpg::WPGBrush::WPGBrush(const WPGColor& fore, const WPGColor& back): - style(Solid), - foreColor(fore), - backColor(back), - gradient() -{} -#endif - libwpg::WPGBrush::WPGBrush(const WPGBrush& brush): style(brush.style), foreColor(brush.foreColor), Index: WPGXParser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- WPGXParser.h 11 Dec 2007 14:44:32 -0000 1.15 +++ WPGXParser.h 28 Nov 2008 11:53:03 -0000 1.16 @@ -45,7 +45,6 @@ unsigned char readU8(); unsigned short readU16(); unsigned int readU32(); - signed char readS8(); short readS16(); int readS32(); unsigned int readVariableLengthInteger(); Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- WPGPaintInterface.h 27 Nov 2008 21:42:16 -0000 1.15 +++ WPGPaintInterface.h 28 Nov 2008 11:53:03 -0000 1.16 @@ -27,7 +27,6 @@ #ifndef __WPGPAINTINTERFACE_H__ #define __WPGPAINTINTERFACE_H__ -#include "WPGBitmap.h" #include <libwpd/libwpd.h> #include "WPGBrush.h" #include "WPGPen.h" @@ -66,8 +65,6 @@ virtual void drawPath(const ::WPXPropertyListVector& path) = 0; - virtual void drawBitmap(const ::WPXPropertyList &propList, const WPGBitmap& bitmap) = 0; - virtual void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData) = 0; // none of the other callback functions will be called after this function is called Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- Makefile.am 27 Nov 2008 16:33:00 -0000 1.31 +++ Makefile.am 28 Nov 2008 11:53:03 -0000 1.32 @@ -27,7 +27,6 @@ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ - WPGBitmap.h \ WPGPaintInterface.h AM_CXXFLAGS = $(LIBWPG_CXXFLAGS) $(DEBUG_CXXFLAGS) Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGPen.cpp 27 Nov 2008 21:42:16 -0000 1.8 +++ WPGPen.cpp 28 Nov 2008 11:53:03 -0000 1.9 @@ -83,28 +83,6 @@ { } -#if 0 -libwpg::WPGPen::WPGPen(const WPGColor& fore): - foreColor(fore), - backColor(0xFF,0xFF,0xFF), - width(0), - height(0), - solid(true), - dashArray() -{ -} - -libwpg::WPGPen::WPGPen(const WPGColor& fore, const WPGColor& back): - foreColor(fore), - backColor(back), - width(0), - height(0), - solid(true) , - dashArray() -{ -} -#endif - libwpg::WPGPen::WPGPen(const WPGPen& pen): foreColor(pen.foreColor), backColor(pen.backColor), Index: WPGGradient.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPGGradient.h 27 Nov 2008 21:42:16 -0000 1.3 +++ WPGGradient.h 28 Nov 2008 11:53:03 -0000 1.4 @@ -55,8 +55,6 @@ WPGColor stopColor(unsigned index) const; -// void clear(); - void addStop(double offset, const WPGColor& color); private: Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- WPG2Parser.cpp 27 Nov 2008 21:42:16 -0000 1.87 +++ WPG2Parser.cpp 28 Nov 2008 11:53:03 -0000 1.88 @@ -1639,6 +1639,7 @@ propList.insert("svg:y", (float)m_bitmap.y1); propList.insert("svg:width", (float)(m_bitmap.x2 - m_bitmap.x1)); propList.insert("svg:height", (float)(m_bitmap.y2 - m_bitmap.y1)); + propList.insert("libwpg:mime-type", "image/bmp"); // format 1: each byte represents 8 pixels, the color fetched from the palette if(color_format == 1) @@ -1653,7 +1654,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 2: each byte represents 4 pixels, the color fetched from the palette else if(color_format == 2) @@ -1668,7 +1669,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 3: each byte represents 2 pixels, the color fetched from the palette else if(color_format == 3) @@ -1683,7 +1684,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 4: each byte represents a pixel, the color fetched from the palette else if(color_format == 4) @@ -1696,7 +1697,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 5: greyscale of 16 bits else if (color_format == 5) @@ -1710,7 +1711,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 6: RGB, with 5 bits per colour else if (color_format == 6) @@ -1724,7 +1725,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } // format 7: else if (color_format == 7) @@ -1738,7 +1739,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } else if (color_format == 8) { @@ -1750,7 +1751,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } else if (color_format == 9) { @@ -1762,7 +1763,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } else if (color_format == 12) { @@ -1775,7 +1776,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(propList, bitmap); + m_painter->drawImageObject(propList, bitmap.getDIB()); } Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- WPGSVGGenerator.cpp 27 Nov 2008 21:42:16 -0000 1.21 +++ WPGSVGGenerator.cpp 28 Nov 2008 11:53:03 -0000 1.22 @@ -248,17 +248,6 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap) -{ - WPXString base64Bitmap = bitmap.getDIB().getBase64Data(); - m_outputSink << "<image "; - m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getFloat()) << "\" "; - m_outputSink << "xlink:href=\"data:image/bmp;base64,"; - m_outputSink << base64Bitmap.cstr(); - m_outputSink << "\" />\n"; -} - void libwpg::WPGSVGGenerator::drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData) { if (!propList["libwpg:mime-type"] || propList["libwpg:mime-type"]->getStr().len() <= 0) Index: WPGPen.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPGPen.h 27 Nov 2008 21:42:16 -0000 1.4 +++ WPGPen.h 28 Nov 2008 11:53:03 -0000 1.5 @@ -59,10 +59,6 @@ WPGDashArray dashArray; WPGPen(); -#if 0 - WPGPen(const WPGColor& fore); - WPGPen(const WPGColor& fore, const WPGColor& back); -#endif WPGPen(const WPGPen& pen); WPGPen& operator=(const WPGPen& pen); |
From: Fridrich S. <str...@us...> - 2008-11-28 11:56:53
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18191/src/conv/raw Modified Files: wpg2raw.cpp Log Message: removing public visibility of WPGBitmap class since Qt4 is able to load a bitmap from a bmp Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- wpg2raw.cpp 27 Nov 2008 21:42:16 -0000 1.16 +++ wpg2raw.cpp 28 Nov 2008 11:53:03 -0000 1.17 @@ -52,7 +52,6 @@ void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); - void drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); }; @@ -189,11 +188,6 @@ printf("RawPainter::drawPath (%s)\n", getPropString(path).cstr()); } -void RawPainter::drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& /*bitmap*/) -{ - printf("RawPainter::drawBitmap (%s)\n", getPropString(propList).cstr()); -} - void RawPainter::drawImageObject(const ::WPXPropertyList& propList, const ::WPXBinaryData& /*binaryData*/) { printf("RawPainter::drawImageObject (%s)\n", getPropString(propList).cstr()); |
From: Fridrich S. <str...@us...> - 2008-11-27 22:17:09
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18112/src/conv/raw Modified Files: wpg2raw.cpp Log Message: some more api change (and more to come) Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- wpg2raw.cpp 27 Nov 2008 16:33:00 -0000 1.15 +++ wpg2raw.cpp 27 Nov 2008 21:42:16 -0000 1.16 @@ -45,7 +45,7 @@ void setPen(const libwpg::WPGPen& pen); void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(FillRule rule); + void setFillRule(const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -159,9 +159,9 @@ brush.gradient.stopColor(c).green, brush.gradient.stopColor(c).blue); } -void RawPainter::setFillRule(FillRule /*rule*/) +void RawPainter::setFillRule(const ::WPXPropertyList &propList) { - printf("RawPainter::setFillRule\n"); + printf("RawPainter::setFillRule (%s)\n", getPropString(propList).cstr()); } void RawPainter::drawRectangle(const ::WPXPropertyList &propList) |
From: Fridrich S. <str...@us...> - 2008-11-27 22:07:12
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18112/src/lib Modified Files: WPG2Parser.cpp WPG2Parser.h WPGBrush.cpp WPGBrush.h WPGGradient.cpp WPGGradient.h WPGPaintInterface.h WPGPen.cpp WPGPen.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: some more api change (and more to come) Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGBrush.h 11 Jul 2008 22:19:09 -0000 1.6 +++ WPGBrush.h 27 Nov 2008 21:42:16 -0000 1.7 @@ -54,9 +54,9 @@ WPGBrush(WPGBrushStyle brushStyle); - explicit WPGBrush(const WPGColor& fore); +// explicit WPGBrush(const WPGColor& fore); - WPGBrush(const WPGColor& fore, const WPGColor& back); +// WPGBrush(const WPGColor& fore, const WPGColor& back); WPGBrush(const WPGBrush& brush); Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- WPG2Parser.h 27 Nov 2008 16:33:00 -0000 1.29 +++ WPG2Parser.h 27 Nov 2008 21:42:16 -0000 1.30 @@ -167,7 +167,7 @@ void handleCompoundPolygon(); void handlePenStyleDefinition(); - void handlePatternDefinition(); +// void handlePatternDefinition(); void handleColorPalette(); void handleDPColorPalette(); void handlePenForeColor(); Index: WPGGradient.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGGradient.cpp 9 May 2007 22:34:09 -0000 1.5 +++ WPGGradient.cpp 27 Nov 2008 21:42:16 -0000 1.6 @@ -103,10 +103,12 @@ return d->gradientStops[index].color; } +#if 0 void libwpg::WPGGradient::clear() { d->gradientStops.clear(); } +#endif void libwpg::WPGGradient::addStop(double offset, const libwpg::WPGColor& color) { Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- WPGSVGGenerator.h 27 Nov 2008 16:33:00 -0000 1.14 +++ WPGSVGGenerator.h 27 Nov 2008 21:42:16 -0000 1.15 @@ -49,7 +49,7 @@ void setPen(const libwpg::WPGPen& pen); void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(FillRule rule); + void setFillRule(const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); @@ -62,7 +62,7 @@ private: libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; - FillRule m_fillRule; + ::WPXPropertyList m_fillRule; int m_gradientIndex; void writeStyle(); void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPGBrush.cpp 11 Jul 2008 22:19:09 -0000 1.3 +++ WPGBrush.cpp 27 Nov 2008 21:42:16 -0000 1.4 @@ -39,6 +39,7 @@ gradient() {} +#if 0 libwpg::WPGBrush::WPGBrush(const WPGColor& fore): style(Solid), foreColor(fore), @@ -52,6 +53,7 @@ backColor(back), gradient() {} +#endif libwpg::WPGBrush::WPGBrush(const WPGBrush& brush): style(brush.style), Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- WPGSVGGenerator.cpp 27 Nov 2008 16:33:00 -0000 1.20 +++ WPGSVGGenerator.cpp 27 Nov 2008 21:42:16 -0000 1.21 @@ -47,7 +47,7 @@ } -libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_fillRule(AlternatingFill), m_gradientIndex(1), m_outputSink(output_sink) +libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_fillRule(), m_gradientIndex(1), m_outputSink(output_sink) { } @@ -131,9 +131,9 @@ } } -void libwpg::WPGSVGGenerator::setFillRule(FillRule rule) +void libwpg::WPGSVGGenerator::setFillRule(const ::WPXPropertyList &propList) { - m_fillRule = rule; + m_fillRule = propList; } void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) @@ -306,10 +306,8 @@ if(m_brush.style == libwpg::WPGBrush::Pattern) { - if(m_fillRule == WPGSVGGenerator::WindingFill) - m_outputSink << "fill-rule: nonzero; "; - else if(m_fillRule == WPGSVGGenerator::AlternatingFill) - m_outputSink << "fill-rule: evenodd; "; + if(m_fillRule["svg:fill-rule"]) + m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; } if(m_brush.style == libwpg::WPGBrush::Gradient) Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- WPGPaintInterface.h 27 Nov 2008 16:33:00 -0000 1.14 +++ WPGPaintInterface.h 27 Nov 2008 21:42:16 -0000 1.15 @@ -46,8 +46,7 @@ virtual void setBrush(const WPGBrush& brush) = 0; - typedef enum { AlternatingFill, WindingFill } FillRule; - virtual void setFillRule(FillRule rule ) = 0; + virtual void setFillRule(const ::WPXPropertyList &propList) = 0; virtual void startLayer(const ::WPXPropertyList& propList) = 0; Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGPen.cpp 11 Jul 2008 22:19:09 -0000 1.7 +++ WPGPen.cpp 27 Nov 2008 21:42:16 -0000 1.8 @@ -83,6 +83,7 @@ { } +#if 0 libwpg::WPGPen::WPGPen(const WPGColor& fore): foreColor(fore), backColor(0xFF,0xFF,0xFF), @@ -102,6 +103,7 @@ dashArray() { } +#endif libwpg::WPGPen::WPGPen(const WPGPen& pen): foreColor(pen.foreColor), Index: WPGGradient.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGGradient.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- WPGGradient.h 8 Jul 2006 10:26:14 -0000 1.2 +++ WPGGradient.h 27 Nov 2008 21:42:16 -0000 1.3 @@ -55,7 +55,7 @@ WPGColor stopColor(unsigned index) const; - void clear(); +// void clear(); void addStop(double offset, const WPGColor& color); Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- WPG2Parser.cpp 27 Nov 2008 16:33:00 -0000 1.86 +++ WPG2Parser.cpp 27 Nov 2008 21:42:16 -0000 1.87 @@ -610,10 +610,12 @@ m_painter->setBrush( context.compoundFilled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( context.compoundFramed ? m_pen : libwpg::WPGPen() ); + ::WPXPropertyList fillRule; if(context.compoundWindingRule) - m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); + fillRule.insert("svg:fill-rule", "nonzero"); else - m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); + fillRule.insert("svg:fill-rule", "evenodd"); + m_painter->setFillRule(fillRule); if (context.compoundClosed) { WPXPropertyList element; @@ -644,6 +646,7 @@ WPG_DEBUG_MSG((" Segment pairs : %d\n", segments)); } +#if 0 // TODO void WPG2Parser::handlePatternDefinition() { @@ -651,6 +654,7 @@ return; WPG_DEBUG_MSG(("PatternDefinition\n")); } +#endif void WPG2Parser::handleColorPalette() { @@ -1190,10 +1194,12 @@ // otherwise draw directly m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + ::WPXPropertyList fillRule; if(objCh.windingRule) - m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); + fillRule.insert("svg:fill-rule", "nonzero"); else - m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); + fillRule.insert("svg:fill-rule", "evenodd"); + m_painter->setFillRule(fillRule); if (objCh.filled || objCh.closed) m_painter->drawPolygon(points); else @@ -1283,10 +1289,12 @@ // otherwise draw directly m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + ::WPXPropertyList fillRule; if(objCh.windingRule) - m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); + fillRule.insert("svg:fill-rule", "nonzero"); else - m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); + fillRule.insert("svg:fill-rule", "evenodd"); + m_painter->setFillRule(fillRule); m_painter->drawPath(path); } } Index: WPGPen.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPGPen.h 14 Dec 2006 14:39:57 -0000 1.3 +++ WPGPen.h 27 Nov 2008 21:42:16 -0000 1.4 @@ -59,8 +59,10 @@ WPGDashArray dashArray; WPGPen(); +#if 0 WPGPen(const WPGColor& fore); WPGPen(const WPGColor& fore, const WPGColor& back); +#endif WPGPen(const WPGPen& pen); WPGPen& operator=(const WPGPen& pen); |
From: Fridrich S. <str...@us...> - 2008-11-27 16:33:05
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16195/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGBitmap.cpp WPGBitmap.h WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in makefile.mk Removed Files: WPGRect.cpp WPGRect.h Log Message: WPGRect gone + simplify WPGBitmap so that it doesn't duplicat functionalities in other classes Index: makefile.mk =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/makefile.mk,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- makefile.mk 24 Nov 2008 10:16:19 -0000 1.9 +++ makefile.mk 27 Nov 2008 16:33:00 -0000 1.10 @@ -31,11 +31,8 @@ $(SLO)$/WPGGradient.obj \ $(SLO)$/WPGHeader.obj \ $(SLO)$/WPGInternalStream.obj \ - $(SLO)$/WPGPath.obj \ $(SLO)$/WPGPen.obj \ - $(SLO)$/WPGPoint.obj \ $(SLO)$/WPGraphics.obj \ - $(SLO)$/WPGRect.obj \ $(SLO)$/WPGSVGGenerator.obj \ $(SLO)$/WPGXParser.obj Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- WPG1Parser.cpp 27 Nov 2008 14:15:17 -0000 1.50 +++ WPG1Parser.cpp 27 Nov 2008 16:33:00 -0000 1.51 @@ -416,16 +416,16 @@ int w = readS16(); int h = readS16(); - libwpg::WPGRect rect; - rect.x1 = (double)x/1200.0; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)((double)x/1200.0)); // in WPG, we have the coordinate of lower left point, in SVG-ish coordinates we have to get upper left - rect.y1 = (double)(m_height - h - y)/1200.0; - rect.x2 = rect.x1 + (double)w/1200.0; - rect.y2 = rect.y1 + (double)h/1200.0; + propList.insert("svg:y", (float)((double)(m_height - h - y)/1200.0)); + propList.insert("svg:width", (float)((double)w/1200.0)); + propList.insert("svg:height",(float)((double)h/1200.0)); m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawRectangle(rect, 0, 0); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG(("Line\n")); WPG_DEBUG_MSG((" Corner point: %d,%d\n", x, y)); @@ -714,17 +714,18 @@ // Bitmap Type 1 does not specify position // Assume on the corner (0,0) libwpg::WPGBitmap bitmap(width, height); - bitmap.rect.x1 = 0; - bitmap.rect.y1 = 0; - bitmap.rect.x2 = (double)width/(double)hres; - bitmap.rect.y2 = (double)height/(double)vres; + ::WPXPropertyList propList; + propList.insert("svg:x", 0.0f); + propList.insert("svg:y", 0.0f); + propList.insert("svg:width", (float)((double)width/(double)hres)); + propList.insert("svg:height", (float)((double)height/(double)vres)); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } } @@ -781,17 +782,18 @@ WPG_DEBUG_MSG(("%li %li %li %li\n", xs1, ys1, xs2, ys2)); libwpg::WPGBitmap bitmap(width, height); - bitmap.rect.x1 = (double)xs1/1200.0; - bitmap.rect.y1 = (double)(ys1)/1200.0; - bitmap.rect.x2 = (double)xs2/1200.0; - bitmap.rect.y2 = (double)(ys2)/1200.0; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)((double)xs1/1200.0)); + propList.insert("svg:y", (float)((double)(ys1)/1200.0)); + propList.insert("svg:width", (float)((double)(xs2-xs1)/1200.0)); + propList.insert("svg:height", (float)((double)(ys2-ys1)/1200.0)); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } } Index: WPGBitmap.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGBitmap.h 24 Nov 2008 10:16:19 -0000 1.9 +++ WPGBitmap.h 27 Nov 2008 16:33:00 -0000 1.10 @@ -27,9 +27,8 @@ #ifndef __WPGBITMAP_H__ #define __WPGBITMAP_H__ -#include "WPGRect.h" #include "WPGColor.h" -#include <libwpd/WPXString.h> +#include <libwpd/libwpd.h> namespace libwpg { @@ -37,8 +36,6 @@ class WPGBitmap { public: - WPGRect rect; - WPGBitmap(int width, int height); WPGBitmap(int width, int height, bool verticalFlip, bool horizontalFlip); @@ -61,16 +58,11 @@ void setPixel(int x, int y, const WPGColor& color); - void generateBase64DIB(::WPXString& bmp) const; - - static void base64Encode(::WPXString& base64, const char *data, const int len); + const ::WPXBinaryData& getDIB() const; private: class Private; Private* const d; - static void writeU16(char *buffer, unsigned &position, const int value); - static void writeU32(char *buffer, unsigned &position, const int value); - static void writeU8(char *buffer, unsigned &position, const int value); }; } // namespace libwpg Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPGSVGGenerator.h 27 Nov 2008 14:15:17 -0000 1.13 +++ WPGSVGGenerator.h 27 Nov 2008 16:33:00 -0000 1.14 @@ -51,12 +51,12 @@ void setBrush(const libwpg::WPGBrush& brush); void setFillRule(FillRule rule); - void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); + void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); - void drawBitmap(const libwpg::WPGBitmap& bitmap); + void drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- WPG2Parser.h 27 Nov 2008 14:15:17 -0000 1.28 +++ WPG2Parser.h 27 Nov 2008 16:33:00 -0000 1.29 @@ -67,14 +67,24 @@ return propList; } - libwpg::WPGRect transform(const libwpg::WPGRect& r) const + ::WPXPropertyList transformRect(const ::WPXPropertyList& r) const { - libwpg::WPGRect rect; - rect.x1 = element[0][0]*r.x1 + element[1][0]*r.y1 + element[2][0]; - rect.y1 = element[0][1]*r.x1 + element[1][1]*r.y1 + element[2][1]; - rect.x2 = element[0][0]*r.x2 + element[1][0]*r.y2 + element[2][0]; - rect.y2 = element[0][1]*r.x2 + element[1][1]*r.y2 + element[2][1]; - return rect; + ::WPXPropertyList propList; + double oldx1 = r["svg:x"]->getFloat(); + double oldy1 = r["svg:y"]->getFloat(); + double oldx2 = r["svg:x"]->getFloat() + r["svg:width"]->getFloat(); + double oldy2 = r["svg:y"]->getFloat() + r["svg:height"]->getFloat(); + + double newx1 = element[0][0]*oldx1 + element[1][0]*oldy1 + element[2][0]; + double newy1 = element[0][1]*oldx1 + element[1][1]*oldy1 + element[2][1]; + double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0]; + double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1]; + + propList.insert("svg:x", (float)newx1); + propList.insert("svg:y", (float)newy1); + propList.insert("svg:width", (float)(newx2-newx1)); + propList.insert("svg:height", (float)(newy2-newy1)); + return propList; } WPG2TransformMatrix& transformBy(const WPG2TransformMatrix& m) --- WPGRect.cpp DELETED --- --- WPGRect.h DELETED --- Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WPGSVGGenerator.cpp 27 Nov 2008 14:15:17 -0000 1.19 +++ WPGSVGGenerator.cpp 27 Nov 2008 16:33:00 -0000 1.20 @@ -146,13 +146,13 @@ m_outputSink << "</g>\n"; } -void libwpg::WPGSVGGenerator::drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) +void libwpg::WPGSVGGenerator::drawRectangle(const ::WPXPropertyList& propList) { m_outputSink << "<rect "; - m_outputSink << "x=\"" << doubleToString(72*rect.x1) << "\" y=\"" << doubleToString(72*rect.y1) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*rect.width()) << "\" height=\"" << doubleToString(72*rect.height()) << "\" "; - if((rx !=0) || (ry !=0)) - m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" "; + if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"]->getInt() !=0)) + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; writeStyle(); m_outputSink << "/>\n"; } @@ -248,13 +248,12 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawBitmap(const libwpg::WPGBitmap& bitmap) +void libwpg::WPGSVGGenerator::drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap) { - WPXString base64Bitmap; - bitmap.generateBase64DIB(base64Bitmap); + WPXString base64Bitmap = bitmap.getDIB().getBase64Data(); m_outputSink << "<image "; - m_outputSink << "x=\"" << doubleToString(72*bitmap.rect.x1) << "\" y=\"" << doubleToString(72*bitmap.rect.y1) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*bitmap.rect.width()) << "\" height=\"" << doubleToString(72*bitmap.rect.height()) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getFloat()) << "\" "; m_outputSink << "xlink:href=\"data:image/bmp;base64,"; m_outputSink << base64Bitmap.cstr(); m_outputSink << "\" />\n"; Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPGPaintInterface.h 27 Nov 2008 14:15:17 -0000 1.13 +++ WPGPaintInterface.h 27 Nov 2008 16:33:00 -0000 1.14 @@ -31,7 +31,6 @@ #include <libwpd/libwpd.h> #include "WPGBrush.h" #include "WPGPen.h" -#include "WPGRect.h" namespace libwpg { @@ -58,7 +57,7 @@ virtual void endEmbeddedGraphics() = 0; - virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; + virtual void drawRectangle(const ::WPXPropertyList& propList) = 0; virtual void drawEllipse(const ::WPXPropertyList& propList) = 0; @@ -68,7 +67,7 @@ virtual void drawPath(const ::WPXPropertyListVector& path) = 0; - virtual void drawBitmap(const WPGBitmap& bitmap) = 0; + virtual void drawBitmap(const ::WPXPropertyList &propList, const WPGBitmap& bitmap) = 0; virtual void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- Makefile.am 27 Nov 2008 14:15:17 -0000 1.30 +++ Makefile.am 27 Nov 2008 16:33:00 -0000 1.31 @@ -27,7 +27,6 @@ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ - WPGRect.h \ WPGBitmap.h \ WPGPaintInterface.h @@ -42,7 +41,6 @@ WPGPen.cpp \ WPGColor.cpp \ WPGGradient.cpp \ - WPGRect.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ WPGXParser.cpp \ Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- WPGBitmap.cpp 24 Nov 2008 10:16:19 -0000 1.22 +++ WPGBitmap.cpp 27 Nov 2008 16:33:00 -0000 1.23 @@ -34,6 +34,29 @@ #include <sstream> #endif +namespace +{ +void writeU16(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); + buffer[position++] = (unsigned char)((value >> 8) & 0xFF); +} + +void writeU32(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); + buffer[position++] = (unsigned char)((value >> 8) & 0xFF); + buffer[position++] = (unsigned char)((value >> 16) & 0xFF); + buffer[position++] = (unsigned char)((value >> 24) & 0xFF); +} + +void writeU8(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); +} + +} + class libwpg::WPGBitmap::Private { public: @@ -42,17 +65,17 @@ bool vFlip; bool hFlip; WPGColor* pixels; + ::WPXBinaryData dib; - Private(int w, int h): width(w), height(h), vFlip(false), hFlip(false), pixels(0) {} + Private(int w, int h): width(w), height(h), vFlip(false), hFlip(false), pixels(0), dib() {} }; -libwpg::WPGBitmap::WPGBitmap(int w, int h): rect(), d(new Private(w, h)) +libwpg::WPGBitmap::WPGBitmap(int w, int h): d(new Private(w, h)) { d->pixels = new WPGColor[w*h]; } libwpg::WPGBitmap::WPGBitmap(int w, int h, bool verticalFlip, bool horizontalFlip) : - rect(), d(new Private(w, h)) { d->vFlip = verticalFlip; @@ -70,7 +93,7 @@ } } -libwpg::WPGBitmap::WPGBitmap(const WPGBitmap& bitmap): rect(), d(new Private(0,0)) +libwpg::WPGBitmap::WPGBitmap(const WPGBitmap& bitmap): d(new Private(0,0)) { copyFrom(bitmap); } @@ -83,7 +106,6 @@ void libwpg::WPGBitmap::copyFrom(const WPGBitmap& bitmap) { - rect = bitmap.rect; d->width = bitmap.d->width; d->height = bitmap.d->height; delete [] d->pixels; @@ -118,26 +140,26 @@ d->pixels[y*d->width + x] = color; } -void libwpg::WPGBitmap::generateBase64DIB(::WPXString& bmp) const +const ::WPXBinaryData & libwpg::WPGBitmap::getDIB() const { - if (d->height <= 0 || d->width <= 0) - return; + if (d->dib.size() || d->height <= 0 || d->width <= 0) + return d->dib; unsigned tmpPixelSize = (unsigned)(d->height * d->width); if (tmpPixelSize < (unsigned)d->height) // overflow - return; + return d->dib; unsigned tmpBufferPosition = 0; unsigned tmpDIBImageSize = tmpPixelSize * 4; if (tmpPixelSize > tmpDIBImageSize) // overflow !!! - return; + return d->dib; unsigned tmpDIBOffsetBits = 14 + 40; unsigned tmpDIBFileSize = tmpDIBOffsetBits + tmpDIBImageSize; if (tmpDIBImageSize > tmpDIBFileSize) // overflow !!! - return; + return d->dib; - char *tmpDIBBuffer = new char[tmpDIBFileSize]; + unsigned char *tmpDIBBuffer = new unsigned char[tmpDIBFileSize]; // Create DIB file header writeU16(tmpDIBBuffer, tmpBufferPosition, 0x4D42); // Type @@ -209,7 +231,7 @@ WPG_DEBUG_MSG(("WPGBitmap: DIB file size = %i\n", tmpBufferPosition - 1)); - base64Encode(bmp, tmpDIBBuffer, tmpDIBFileSize); + d->dib.append(tmpDIBBuffer, tmpDIBFileSize); // temporary for debug - dump the binary bmp (need to have write access in the current directory #if DUMP_BITMAP @@ -226,73 +248,6 @@ // Cleanup things before returning delete [] tmpDIBBuffer; -} - -void libwpg::WPGBitmap::writeU16(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); - buffer[position++] = (char)((value >> 8) & 0xFF); -} - -void libwpg::WPGBitmap::writeU32(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); - buffer[position++] = (char)((value >> 8) & 0xFF); - buffer[position++] = (char)((value >> 16) & 0xFF); - buffer[position++] = (char)((value >> 24) & 0xFF); -} - -void libwpg::WPGBitmap::writeU8(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); -} - -void libwpg::WPGBitmap::base64Encode(::WPXString& base64, const char *data, const int len) -{ - static const char* base64Chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - char tempCharsToEncode[3]; - int i = 0; int j = 0; int modifiedLen; - if (len % 3) - modifiedLen = 3 * ((int)(len / 3) + 1); - else - modifiedLen = len; - bool shouldIexit = false; - for (; i < modifiedLen; i++) - { - if (i < len) - tempCharsToEncode[j++] = data[i]; - else - { - tempCharsToEncode[j++] = '\0'; - shouldIexit = true; - } - if (shouldIexit) - { - if (j == 3) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append(base64Chars[((tempCharsToEncode[1] & 0x0f) << 2) | ((tempCharsToEncode[2] & 0xc0) >> 6)]); - base64.append('='); - break; - } - if (j == 2) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append('='); base64.append('='); - break; - } - } - else if (j == 3) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append(base64Chars[((tempCharsToEncode[1] & 0x0f) << 2) | ((tempCharsToEncode[2] & 0xc0) >> 6)]); - base64.append(base64Chars[tempCharsToEncode[2] & 0x3f]); - j = 0; - } - } + return d->dib; } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- WPG2Parser.cpp 27 Nov 2008 14:15:17 -0000 1.85 +++ WPG2Parser.cpp 27 Nov 2008 16:33:00 -0000 1.86 @@ -1315,18 +1315,18 @@ long rx = (m_doublePrecision) ? readS32() : readS16(); long ry = (m_doublePrecision) ? readS32() : readS16(); - libwpg::WPGRect rect; - rect.x1 = TO_DOUBLE(xs1) / m_xres; - rect.x2 = TO_DOUBLE(xs2) / m_xres; - rect.y1 = TO_DOUBLE(ys1) / m_yres; - rect.y2 = TO_DOUBLE(ys2) / m_yres; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)(TO_DOUBLE(xs1) / m_xres)); + propList.insert("svg:width", (float)(TO_DOUBLE(xs2-xs1) / m_xres)); + propList.insert("svg:y", (float)(TO_DOUBLE(ys1) / m_yres)); + propList.insert("svg:height", (float)(TO_DOUBLE(ys2-ys1) / m_yres)); - double roundx = TO_DOUBLE(rx)/m_xres; - double roundy = TO_DOUBLE(ry)/m_yres; + propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); + propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); - m_painter->drawRectangle(rect, roundx, roundy); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG((" X1 : %li\n", x1)); WPG_DEBUG_MSG((" Y1 : %li\n", y1)); @@ -1626,10 +1626,11 @@ // prepare the bitmap structure for the listener libwpg::WPGBitmap bitmap(width, height, m_vFlipped, m_hFlipped); - bitmap.rect.x1 = m_bitmap.x1; - bitmap.rect.y1 = m_bitmap.y1; - bitmap.rect.x2 = m_bitmap.x2; - bitmap.rect.y2 = m_bitmap.y2; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)m_bitmap.x1); + propList.insert("svg:y", (float)m_bitmap.y1); + propList.insert("svg:width", (float)(m_bitmap.x2 - m_bitmap.x1)); + propList.insert("svg:height", (float)(m_bitmap.y2 - m_bitmap.y1)); // format 1: each byte represents 8 pixels, the color fetched from the palette if(color_format == 1) @@ -1644,7 +1645,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 2: each byte represents 4 pixels, the color fetched from the palette else if(color_format == 2) @@ -1659,7 +1660,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 3: each byte represents 2 pixels, the color fetched from the palette else if(color_format == 3) @@ -1674,7 +1675,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 4: each byte represents a pixel, the color fetched from the palette else if(color_format == 4) @@ -1687,7 +1688,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 5: greyscale of 16 bits else if (color_format == 5) @@ -1701,7 +1702,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 6: RGB, with 5 bits per colour else if (color_format == 6) @@ -1715,7 +1716,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 7: else if (color_format == 7) @@ -1729,7 +1730,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 8) { @@ -1741,7 +1742,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 9) { @@ -1753,7 +1754,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 12) { @@ -1766,7 +1767,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- libwpg.h.in 27 Nov 2008 14:15:17 -0000 1.9 +++ libwpg.h.in 27 Nov 2008 16:33:00 -0000 1.10 @@ -39,7 +39,6 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGRect.h" #include "WPGBitmap.h" #endif |
From: Fridrich S. <str...@us...> - 2008-11-27 16:33:05
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16195/src/conv/raw Modified Files: wpg2raw.cpp Log Message: WPGRect gone + simplify WPGBitmap so that it doesn't duplicat functionalities in other classes Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- wpg2raw.cpp 27 Nov 2008 14:15:17 -0000 1.14 +++ wpg2raw.cpp 27 Nov 2008 16:33:00 -0000 1.15 @@ -47,12 +47,12 @@ void setBrush(const libwpg::WPGBrush& brush); void setFillRule(FillRule rule); - void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); + void drawRectangle(const ::WPXPropertyList &propList); void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); - void drawBitmap(const libwpg::WPGBitmap& bitmap); + void drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); }; @@ -164,11 +164,9 @@ printf("RawPainter::setFillRule\n"); } -void RawPainter::drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) +void RawPainter::drawRectangle(const ::WPXPropertyList &propList) { - printf("RawPainter::drawRoundedRectangle "); - printf(" (%g %g)-(%g,%g)", rect.x1, rect.y1, rect.x2, rect.y2); - printf(" Roundndess: %g %g\n", rx, ry); + printf("RawPainter::drawRectangle (%s)\n", getPropString(propList).cstr()); } void RawPainter::drawEllipse(const ::WPXPropertyList& propList) @@ -191,9 +189,9 @@ printf("RawPainter::drawPath (%s)\n", getPropString(path).cstr()); } -void RawPainter::drawBitmap(const libwpg::WPGBitmap& /*bitmap*/) +void RawPainter::drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& /*bitmap*/) { - printf("RawPainter::drawBitmap\n"); + printf("RawPainter::drawBitmap (%s)\n", getPropString(propList).cstr()); } void RawPainter::drawImageObject(const ::WPXPropertyList& propList, const ::WPXBinaryData& /*binaryData*/) |
From: Fridrich S. <str...@us...> - 2008-11-27 14:15:28
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3768/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in Removed Files: WPGPoint.cpp WPGPoint.h Log Message: removing another libwpg type: WPGPoint Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- WPG2Parser.h 25 Nov 2008 11:58:28 -0000 1.27 +++ WPG2Parser.h 27 Nov 2008 14:15:17 -0000 1.28 @@ -31,6 +31,7 @@ #include "WPGXParser.h" #include "WPGBrush.h" #include "WPGPen.h" +#include <libwpd/libwpd.h> #include <map> #include <stack> @@ -58,12 +59,12 @@ y = ry; } - libwpg::WPGPoint transform(const libwpg::WPGPoint& p) const + ::WPXPropertyList transformPoint(const ::WPXPropertyList& p) const { - libwpg::WPGPoint point; - point.x = element[0][0]*p.x + element[1][0]*p.y + element[2][0]; - point.y = element[0][1]*p.x + element[1][1]*p.y + element[2][1]; - return point; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getFloat() + element[1][0]*p["svg:y"]->getFloat() + element[2][0])); + propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getFloat() + element[1][1]*p["svg:y"]->getFloat() + element[2][1])); + return propList; } libwpg::WPGRect transform(const libwpg::WPGRect& r) const @@ -209,7 +210,7 @@ unsigned int m_layerId; WPG2TransformMatrix m_matrix; double m_gradientAngle; - libwpg::WPGPoint m_gradientRef; + ::WPXPropertyList m_gradientRef; std::stack<WPGGroupContext> m_groupStack; WPG2TransformMatrix m_compoundMatrix; bool m_compoundWindingRule; --- WPGPoint.h DELETED --- Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- WPG1Parser.cpp 25 Nov 2008 11:58:28 -0000 1.49 +++ WPG1Parser.cpp 27 Nov 2008 14:15:17 -0000 1.50 @@ -462,26 +462,22 @@ { if (!m_graphicsStarted) return; - int cx = readS16(); - int cy = readS16(); - int rx = readS16(); - int ry = readS16(); - double rotation = (double)readS16(); + + ::WPXPropertyList propList; + propList.insert("svg:cx", (float)((double)readS16()/1200.0)); + propList.insert("svg:cy", (float)((double)(m_height-readS16())/1200.0)); + propList.insert("svg:rx", (float)((double)readS16()/1200.0)); + propList.insert("svg:ry", (float)((double)readS16()/1200.0)); + propList.insert("libwpg:rotate", (float)readS16()); + #if 0 int beginAngle = readS16(); int endAngle = readS16(); unsigned flags = readU16(); #endif - libwpg::WPGPoint center; - center.x = (double)cx/1200.0; - center.y = (double)(m_height-cy)/1200.0; - - double radx = (double)rx/1200.0; - double rady = (double)ry/1200.0; - m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawEllipse(center, radx, rady, (double)rotation, libwpg::WPGPoint(), libwpg::WPGPoint()); + m_painter->drawEllipse(propList); WPG_DEBUG_MSG(("Ellipse\n")); WPG_DEBUG_MSG((" Center point: %d,%d\n", cx, cy)); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGSVGGenerator.h 25 Nov 2008 11:58:28 -0000 1.12 +++ WPGSVGGenerator.h 27 Nov 2008 14:15:17 -0000 1.13 @@ -42,8 +42,8 @@ void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); - void startLayer(unsigned int id); - void endLayer(unsigned int id); + void startLayer(const ::WPXPropertyList& propList); + void endLayer(); void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} @@ -52,7 +52,7 @@ void setFillRule(FillRule rule); void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to); + void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- WPGSVGGenerator.cpp 25 Nov 2008 11:58:28 -0000 1.18 +++ WPGSVGGenerator.cpp 27 Nov 2008 14:15:17 -0000 1.19 @@ -136,12 +136,12 @@ m_fillRule = rule; } -void libwpg::WPGSVGGenerator::startLayer(unsigned int id) +void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) { - m_outputSink << "<g id=\"Layer" << id << "\" >\n"; + m_outputSink << "<g id=\"Layer" << propList["svg:id"]->getInt() << "\" >\n"; } -void libwpg::WPGSVGGenerator::endLayer(unsigned int) +void libwpg::WPGSVGGenerator::endLayer() { m_outputSink << "</g>\n"; } @@ -157,15 +157,17 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& /* from */, const WPGPoint& /* to */) +void libwpg::WPGSVGGenerator::drawEllipse(const WPXPropertyList& propList) { m_outputSink << "<ellipse "; - m_outputSink << "cx=\"" << doubleToString(72*center.x) << "\" cy=\"" << doubleToString(72*center.y) << "\" "; - m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; + m_outputSink << "cx=\"" << doubleToString(72*propList["svg:cx"]->getFloat()) << "\" cy=\"" << doubleToString(72*propList["svg:cy"]->getFloat()) << "\" "; + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; writeStyle(); - if (rotation != 0.0) - m_outputSink << " transform=\" translate(" << doubleToString(72*center.x) << ", " << doubleToString(72*center.y) - << ") rotate(" << doubleToString(-rotation) << ") translate(" << doubleToString(-72*center.x) << ", " << doubleToString(-72*center.y) + if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getFloat() != 0.0) + m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getFloat()) << ", " << doubleToString(72*propList["svg:cy"]->getFloat()) + << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getFloat()) + << ") translate(" << doubleToString(-72*propList["svg:cx"]->getFloat()) + << ", " << doubleToString(-72*propList["svg:cy"]->getFloat()) << ")\" "; m_outputSink << "/>\n"; } Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGPaintInterface.h 25 Nov 2008 11:58:28 -0000 1.12 +++ WPGPaintInterface.h 27 Nov 2008 14:15:17 -0000 1.13 @@ -31,7 +31,6 @@ #include <libwpd/libwpd.h> #include "WPGBrush.h" #include "WPGPen.h" -#include "WPGPoint.h" #include "WPGRect.h" namespace libwpg @@ -51,9 +50,9 @@ typedef enum { AlternatingFill, WindingFill } FillRule; virtual void setFillRule(FillRule rule ) = 0; - virtual void startLayer(unsigned int id) = 0; + virtual void startLayer(const ::WPXPropertyList& propList) = 0; - virtual void endLayer(unsigned int id) = 0; + virtual void endLayer() = 0; virtual void startEmbeddedGraphics(const ::WPXPropertyList &propList) = 0; @@ -61,7 +60,7 @@ virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; - virtual void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to) = 0; + virtual void drawEllipse(const ::WPXPropertyList& propList) = 0; virtual void drawPolygon(const ::WPXPropertyListVector& vertices) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile.am 25 Nov 2008 11:58:28 -0000 1.29 +++ Makefile.am 27 Nov 2008 14:15:17 -0000 1.30 @@ -27,14 +27,13 @@ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ - WPGPoint.h \ WPGRect.h \ WPGBitmap.h \ WPGPaintInterface.h AM_CXXFLAGS = $(LIBWPG_CXXFLAGS) $(DEBUG_CXXFLAGS) -libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LIBADD = @LIBWPG_WIN32_RESOURCE@ +libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LIBADD = $(LIBWPG_LIBS) @LIBWPG_WIN32_RESOURCE@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_DEPENDENCIES = @LIBWPG_WIN32_RESOURCE@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_SOURCES = \ @@ -43,7 +42,6 @@ WPGPen.cpp \ WPGColor.cpp \ WPGGradient.cpp \ - WPGPoint.cpp \ WPGRect.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ --- WPGPoint.cpp DELETED --- Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- WPG2Parser.cpp 25 Nov 2008 11:58:28 -0000 1.84 +++ WPG2Parser.cpp 27 Nov 2008 14:15:17 -0000 1.85 @@ -565,7 +565,7 @@ return; // sentinel if(m_layerOpened) - m_painter->endLayer(m_layerId); + m_painter->endLayer(); m_painter->endGraphics(); m_exit = true; @@ -575,13 +575,14 @@ { if (!m_graphicsStarted) return; - m_layerId = readU16(); + WPXPropertyList propList; + propList.insert("svg:id", (int)readU16()); // close previous one if(m_layerOpened) - m_painter->endLayer(m_layerId); + m_painter->endLayer(); - m_painter->startLayer(m_layerId); + m_painter->startLayer(propList); m_layerOpened = true; WPG_DEBUG_MSG((" Layer Id: %d\n", m_layerId)); @@ -823,8 +824,8 @@ // TODO: get gradient extent m_gradientAngle = angleInteger + (double)angleFraction/65536.0; - m_gradientRef.x = xref; - m_gradientRef.y = yref; + m_gradientRef.insert("svg:x", (float)xref); + m_gradientRef.insert("svg:y", (float)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -853,8 +854,8 @@ // TODO: get gradient extent (in double precision) m_gradientAngle = angleFraction + (double)angleInteger/65536.0; - m_gradientRef.x = xref; - m_gradientRef.y = yref; + m_gradientRef.insert("svg:x", (float)xref); + m_gradientRef.insert("svg:y", (float)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -915,8 +916,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)m_gradientRef.x/65536.0; - double yref = (double)m_gradientRef.y/65536.0; + double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; + double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle < 1e2 && tanangle > -1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; @@ -924,7 +925,7 @@ gradient.setAngle(-m_gradientAngle); // upside down gradient.addStop(0, colors[1]); gradient.addStop(ref, colors[0]); - if((m_gradientRef.x != 65535) && (m_gradientRef.y != 65535)) + if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1]); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; @@ -982,8 +983,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)m_gradientRef.x/65536.0; - double yref = (double)m_gradientRef.y/65536.0; + double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; + double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle<1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; @@ -991,7 +992,7 @@ gradient.setAngle(-m_gradientAngle); // upside down gradient.addStop(0, colors[1]); gradient.addStop(ref, colors[0]); - if((m_gradientRef.x != 65535) && (m_gradientRef.y != 65536)) + if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1]); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; @@ -1252,10 +1253,6 @@ long ty = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(tx,ty); - libwpg::WPGPoint initialPoint( TO_DOUBLE(ix)/m_xres, TO_DOUBLE(iy)/m_yres ); - libwpg::WPGPoint terminalPoint( TO_DOUBLE(tx)/m_xres, TO_DOUBLE(ty)/m_yres ); - libwpg::WPGPoint anchorPoint( TO_DOUBLE(ax)/m_xres, TO_DOUBLE(ay)/m_yres ); - element.insert("svg:x", (float)(TO_DOUBLE(ax)/m_xres)); element.insert("svg:y", (float)(TO_DOUBLE(ay)/m_yres)); if (i == 0) @@ -1362,16 +1359,18 @@ long ey = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ex,ey); - libwpg::WPGPoint center; - center.x = TO_DOUBLE(cx) / m_xres; - center.y = TO_DOUBLE(cy) / m_xres; - double rx = TO_DOUBLE(radx) / m_xres; - double ry = TO_DOUBLE(rady) / m_xres; + ::WPXPropertyList propList; + propList.insert("svg:cx", (float)(TO_DOUBLE(cx) / m_xres)); + propList.insert("svg:cy", (float)(TO_DOUBLE(cy) / m_xres)); + propList.insert("svg:rx", (float)(TO_DOUBLE(radx) / m_xres)); + propList.insert("svg:ry", (float)(TO_DOUBLE(rady) / m_xres)); + if (objCh.rotate) + propList.insert("libwpg:rotate", (float)(objCh.rotationAngle)); m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); - m_painter->drawEllipse(center, rx, ry, objCh.rotate ? objCh.rotationAngle : 0.0, - libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres)); + 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) */); WPG_DEBUG_MSG((" Center point x : %li\n", cx)); WPG_DEBUG_MSG((" Center point y : %li\n", cy)); Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- libwpg.h.in 25 Nov 2008 11:58:28 -0000 1.8 +++ libwpg.h.in 27 Nov 2008 14:15:17 -0000 1.9 @@ -39,7 +39,6 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGPoint.h" #include "WPGRect.h" #include "WPGBitmap.h" |
From: Fridrich S. <str...@us...> - 2008-11-27 14:15:28
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3768/src/conv/raw Modified Files: wpg2raw.cpp Log Message: removing another libwpg type: WPGPoint Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- wpg2raw.cpp 25 Nov 2008 11:58:28 -0000 1.13 +++ wpg2raw.cpp 27 Nov 2008 14:15:17 -0000 1.14 @@ -38,8 +38,8 @@ void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); - void startLayer(unsigned int id); - void endLayer(unsigned int id); + void startLayer(const ::WPXPropertyList& propList); + void endLayer(); void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} void endEmbeddedGraphics() {} @@ -48,7 +48,7 @@ void setFillRule(FillRule rule); void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry, double rotation, const libwpg::WPGPoint& from, const libwpg::WPGPoint& to); + void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); @@ -117,14 +117,14 @@ printf("RawPainter::endGraphics\n"); } -void RawPainter::startLayer(unsigned int id) +void RawPainter::startLayer(const ::WPXPropertyList& propList) { - printf("RawPainter::startLayer %d\n", id); + printf("RawPainter::startLayer (%s)\n", getPropString(propList).cstr()); } -void RawPainter::endLayer(unsigned int id) +void RawPainter::endLayer() { - printf("RawPainter::endLayer %d\n", id); + printf("RawPainter::endLayer\n"); } void RawPainter::setPen(const libwpg::WPGPen& /*pen*/) @@ -171,10 +171,9 @@ printf(" Roundndess: %g %g\n", rx, ry); } -void RawPainter::drawEllipse(const libwpg::WPGPoint& /* center */, double rx, double ry, double /* rotation */, const libwpg::WPGPoint& /* from */, const libwpg::WPGPoint& /* to */) +void RawPainter::drawEllipse(const ::WPXPropertyList& propList) { - printf("RawPainter::drawEllipse "); - printf(" Radius: %g %g\n", rx, ry); + printf("RawPainter::drawEllipse (%s)\n", getPropString(propList).cstr()); } void RawPainter::drawPolyline(const ::WPXPropertyListVector& vertices) |
From: Fridrich S. <str...@us...> - 2008-11-25 11:58:33
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28859/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in Removed Files: WPGPath.cpp WPGPath.h Log Message: getting rid of another data structure in favour of libwpd framework WPXProperty* classes Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- WPG2Parser.h 24 Nov 2008 10:16:19 -0000 1.26 +++ WPG2Parser.h 25 Nov 2008 11:58:28 -0000 1.27 @@ -112,7 +112,7 @@ public: unsigned subIndex; int parentType; - libwpg::WPGPath compoundPath; + ::WPXPropertyListVector compoundPath; WPG2TransformMatrix compoundMatrix; bool compoundWindingRule; bool compoundFilled; --- WPGPath.h DELETED --- Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- WPG1Parser.cpp 24 Nov 2008 10:16:19 -0000 1.48 +++ WPG1Parser.cpp 25 Nov 2008 11:58:28 -0000 1.49 @@ -273,10 +273,11 @@ m_input->seek(2, WPX_SEEK_CUR); m_width = readU16(); m_height = readU16(); - - double width = (double)m_width / 1200.0; - double height = (double)m_height / 1200.0; - m_painter->startGraphics(width, height); + + ::WPXPropertyList propList; + propList.insert("svg:width", (float)((double)m_width/1200.0)); + propList.insert("svg:height", (float)((double)m_height/1200.0)); + m_painter->startGraphics(propList); m_graphicsStarted = true; WPG_DEBUG_MSG(("StartWPG\n")); @@ -362,9 +363,15 @@ int ex = readS16(); int ey = readS16(); - libwpg::WPGPointArray points; - points.add(libwpg::WPGPoint((double)sx/1200.0, (double)(m_height-sy)/1200.0)); - points.add(libwpg::WPGPoint((double)ex/1200.0, (double)(m_height-ey)/1200.0)); + ::WPXPropertyListVector points; + ::WPXPropertyList point; + point.insert("svg:x", (float)((double)sx/1200.0)); + point.insert("svg:y", (float)((double)(m_height-sy)/1200.0)); + points.append(point); + point.clear(); + point.insert("svg:x", (float)((double)ex/1200.0)); + point.insert("svg:y", (float)((double)(m_height-ey)/1200.0)); + points.append(point); m_painter->setBrush(m_brush); m_painter->setPen(m_pen); @@ -381,12 +388,16 @@ return; unsigned int count = readU16(); - libwpg::WPGPointArray points; + ::WPXPropertyListVector points; + ::WPXPropertyList point; for(unsigned int i = 0; i < count; i++ ) { + point.clear(); long x = readS16(); long y = readS16(); - points.add(libwpg::WPGPoint((double)x/1200.0, (double)(m_height-y)/1200.0)); + point.insert("svg:x", (float)((double)x/1200.0)); + point.insert("svg:y", (float)((double)(m_height-y)/1200.0)); + points.append(point); } m_painter->setBrush(libwpg::WPGBrush()); // not filled @@ -428,12 +439,16 @@ return; unsigned int count = readU16(); - libwpg::WPGPointArray points; + ::WPXPropertyListVector points; + ::WPXPropertyList point; for(unsigned int i = 0; i < count; i++ ) { + point.clear(); long x = readS16(); long y = readS16(); - points.add(libwpg::WPGPoint((double)x/1200.0, (double)(m_height-y)/1200.0)); + point.insert("svg:x", (float)((double)x/1200.0)); + point.insert("svg:y", (float)((double)(m_height-y)/1200.0)); + points.append(point); } m_painter->setBrush(m_brush); @@ -482,25 +497,37 @@ unsigned int count = readU16(); if (!count) return; - libwpg::WPGPath path; - path.closed = false; + ::WPXPropertyListVector path; + ::WPXPropertyList element; + + bool path_closed = false; long xInitial = readS16(); long yInitial = readS16(); - path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)(m_height-yInitial)/1200.0)); + element.insert("libwpg:path-action", "M"); + element.insert("svg:x", (float)((double)xInitial/1200.0)); + element.insert("svg:y", (float)((double)(m_height-yInitial)/1200.0)); + path.append(element); for (unsigned i = 1; i < (count-1)/3; i++) { + element.clear(); long xControl1 = readS16(); long yControl1 = readS16(); long xControl2 = readS16(); long yControl2 = readS16(); long xCoordinate = readS16(); long yCoordinate = readS16(); - path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)(m_height-yControl1)/1200.0), - libwpg::WPGPoint((double)xControl2/1200.0, (double)(m_height-yControl2)/1200.0), - libwpg::WPGPoint((double)xCoordinate/1200.0, (double)(m_height-yCoordinate)/1200.0)); + + element.insert("libwpg:path-action", "C"); + element.insert("svg:x1", (float)((double)xControl1/1200.0)); + element.insert("svg:y1", (float)((double)(m_height-yControl1)/1200.0)); + element.insert("svg:x2", (float)((double)xControl2/1200.0)); + element.insert("svg:y2", (float)((double)(m_height-yControl2)/1200.0)); + element.insert("svg:x", (float)((double)xCoordinate/1200.0)); + element.insert("svg:y", (float)((double)(m_height-yCoordinate)/1200.0)); + } - m_painter->setBrush(path.closed ? m_brush : libwpg::WPGBrush()); + m_painter->setBrush(path_closed ? m_brush : libwpg::WPGBrush()); m_painter->setPen(m_pen); m_painter->drawPath(path); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- WPGSVGGenerator.h 24 Nov 2008 10:16:19 -0000 1.11 +++ WPGSVGGenerator.h 25 Nov 2008 11:58:28 -0000 1.12 @@ -40,11 +40,11 @@ WPGSVGGenerator(std::ostream & output_sink); ~WPGSVGGenerator(); - void startGraphics(double imageWidth, double imageHeight); + void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); void startLayer(unsigned int id); void endLayer(unsigned int id); - void startEmbeddedGraphics(double /* imageWidth */, double /* imageHeight */) {} + void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} void setPen(const libwpg::WPGPen& pen); @@ -53,9 +53,9 @@ void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to); - void drawPolyline(const libwpg::WPGPointArray& vertices); - void drawPolygon(const libwpg::WPGPointArray& vertices); - void drawPath(const libwpg::WPGPath& path); + void drawPolyline(const ::WPXPropertyListVector& vertices); + void drawPolygon(const ::WPXPropertyListVector& vertices); + void drawPath(const ::WPXPropertyListVector& path); void drawBitmap(const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); @@ -65,7 +65,7 @@ FillRule m_fillRule; int m_gradientIndex; void writeStyle(); - void drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed); + void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); std::ostream & m_outputSink; }; --- WPGPath.cpp DELETED --- Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- WPGSVGGenerator.cpp 24 Nov 2008 10:16:19 -0000 1.17 +++ WPGSVGGenerator.cpp 25 Nov 2008 11:58:28 -0000 1.18 @@ -55,7 +55,7 @@ { } -void libwpg::WPGSVGGenerator::startGraphics(double width, double height) +void libwpg::WPGSVGGenerator::startGraphics(const WPXPropertyList &propList) { m_outputSink << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"; m_outputSink << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\""; @@ -65,7 +65,11 @@ m_outputSink << "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" "; m_outputSink << "xmlns:xlink=\"http://www.w3.org/1999/xlink\" "; - m_outputSink << "width=\"" << doubleToString(72*width) << "\" height=\"" << doubleToString(72*height) << "\" >\n"; + if (propList["svg:width"]) + m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getFloat())) << "\" "; + if (propList["svg:height"]) + m_outputSink << "height=\"" << doubleToString(72*(propList["svg:height"]->getFloat())) << "\""; + m_outputSink << " >\n"; m_gradientIndex = 1; } @@ -166,28 +170,26 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawPolyline(const libwpg::WPGPointArray& vertices) +void libwpg::WPGSVGGenerator::drawPolyline(const ::WPXPropertyListVector& vertices) { drawPolySomething(vertices, false); } -void libwpg::WPGSVGGenerator::drawPolygon(const libwpg::WPGPointArray& vertices) +void libwpg::WPGSVGGenerator::drawPolygon(const ::WPXPropertyListVector& vertices) { drawPolySomething(vertices, true); } -void libwpg::WPGSVGGenerator::drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed) +void libwpg::WPGSVGGenerator::drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed) { if(vertices.count() < 2) return; if(vertices.count() == 2) { - const libwpg::WPGPoint& p1 = vertices[0]; - const libwpg::WPGPoint& p2 = vertices[1]; m_outputSink << "<line "; - m_outputSink << "x1=\"" << doubleToString(72*p1.x) << "\" y1=\"" << doubleToString(72*p1.y) << "\" "; - m_outputSink << "x2=\"" << doubleToString(72*p2.x) << "\" y2=\"" << doubleToString(72*p2.y) << "\"\n"; + m_outputSink << "x1=\"" << doubleToString(72*(vertices[0]["svg:x"]->getFloat())) << "\" y1=\"" << doubleToString(72*(vertices[0]["svg:y"]->getFloat())) << "\" "; + m_outputSink << "x2=\"" << doubleToString(72*(vertices[1]["svg:x"]->getFloat())) << "\" y2=\"" << doubleToString(72*(vertices[1]["svg:y"]->getFloat())) << "\"\n"; writeStyle(); m_outputSink << "/>\n"; } @@ -199,10 +201,11 @@ m_outputSink << "<polyline "; m_outputSink << "points=\""; - for(unsigned i = 0; i < vertices.count(); i++) + WPXPropertyListVector::Iter i(vertices); + for(i.rewind(); i.next();) { - m_outputSink << doubleToString(72*vertices[i].x) << " " << doubleToString(72*vertices[i].y); - if(i < vertices.count()-1) m_outputSink << ", "; + m_outputSink << doubleToString(72*(i()["svg:x"]->getFloat())) << " " << doubleToString(72*(i()["svg:y"]->getFloat())); + if(!i.last()) m_outputSink << ", "; } m_outputSink << "\"\n"; writeStyle(); @@ -210,38 +213,34 @@ } } -void libwpg::WPGSVGGenerator::drawPath(const libwpg::WPGPath& path) +void libwpg::WPGSVGGenerator::drawPath(const ::WPXPropertyListVector& path) { m_outputSink << "<path d=\""; - for(unsigned i = 0; i < path.count(); i++) + WPXPropertyListVector::Iter i(path); + for(i.rewind(); i.next();) { - libwpg::WPGPathElement element = path.element(i); - libwpg::WPGPoint point = element.point; - switch(element.type) + WPXPropertyList propList = i(); + if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M") { - case libwpg::WPGPathElement::MoveToElement: - m_outputSink << "\n M" << doubleToString(72*point.x) << "," << doubleToString(72*point.y) << " "; - break; - - case libwpg::WPGPathElement::LineToElement: - m_outputSink << "\n L" << doubleToString(72*point.x) << "," << doubleToString(72*point.y) << " "; - break; - - case libwpg::WPGPathElement::CurveToElement: - m_outputSink << "C"; - m_outputSink << doubleToString(72*element.extra1.x) << "," << doubleToString(72*element.extra1.y) << " "; - m_outputSink << doubleToString(72*element.extra2.x) << "," << doubleToString(72*element.extra2.y) << " "; - m_outputSink << doubleToString(72*point.x) << "," << doubleToString(72*point.y); - break; - - default: - break; + m_outputSink << "\n M"; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; + } + else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L") + { + m_outputSink << "\n L"; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; + } + else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C") + { + m_outputSink << "C"; + m_outputSink << doubleToString(72*(propList["svg:x1"]->getFloat())) << "," << doubleToString(72*(propList["svg:y1"]->getFloat())) << " "; + m_outputSink << doubleToString(72*(propList["svg:x2"]->getFloat())) << "," << doubleToString(72*(propList["svg:y2"]->getFloat())) << " "; + m_outputSink << doubleToString(72*(propList["svg:x"]->getFloat())) << "," << doubleToString(72*(propList["svg:y"]->getFloat())) << " "; } + else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z") + m_outputSink << "Z"; } - if(path.closed) - m_outputSink << "Z"; - m_outputSink << "\" \n"; writeStyle(); m_outputSink << "/>\n"; Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- WPGPaintInterface.h 24 Nov 2008 10:16:19 -0000 1.11 +++ WPGPaintInterface.h 25 Nov 2008 11:58:28 -0000 1.12 @@ -30,7 +30,6 @@ #include "WPGBitmap.h" #include <libwpd/libwpd.h> #include "WPGBrush.h" -#include "WPGPath.h" #include "WPGPen.h" #include "WPGPoint.h" #include "WPGRect.h" @@ -43,7 +42,7 @@ virtual ~WPGPaintInterface() {} // none of the other callback functions will be called before this function is called - virtual void startGraphics(double width, double height) = 0; + virtual void startGraphics(const ::WPXPropertyList &propList) = 0; virtual void setPen(const WPGPen& pen) = 0; @@ -56,7 +55,7 @@ virtual void endLayer(unsigned int id) = 0; - virtual void startEmbeddedGraphics(double width, double height) = 0; + virtual void startEmbeddedGraphics(const ::WPXPropertyList &propList) = 0; virtual void endEmbeddedGraphics() = 0; @@ -64,11 +63,11 @@ virtual void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to) = 0; - virtual void drawPolygon(const WPGPointArray& vertices) = 0; + virtual void drawPolygon(const ::WPXPropertyListVector& vertices) = 0; - virtual void drawPolyline(const WPGPointArray& vertices) = 0; + virtual void drawPolyline(const ::WPXPropertyListVector &vertices) = 0; - virtual void drawPath(const WPGPath& path) = 0; + virtual void drawPath(const ::WPXPropertyListVector& path) = 0; virtual void drawBitmap(const WPGBitmap& bitmap) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Makefile.am 24 Nov 2008 10:16:19 -0000 1.28 +++ Makefile.am 25 Nov 2008 11:58:28 -0000 1.29 @@ -29,7 +29,6 @@ WPGGradient.h \ WPGPoint.h \ WPGRect.h \ - WPGPath.h \ WPGBitmap.h \ WPGPaintInterface.h @@ -45,7 +44,6 @@ WPGColor.cpp \ WPGGradient.cpp \ WPGPoint.cpp \ - WPGPath.cpp \ WPGRect.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ @@ -59,7 +57,6 @@ WPGColor.h \ WPGPen.h \ WPGBrush.h \ - WPGPath.h \ WPGGradient.h \ WPGHeader.h \ WPGSVGGenerator.h \ Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.83 retrieving revision 1.84 diff -u -d -r1.83 -r1.84 --- WPG2Parser.cpp 24 Nov 2008 10:16:19 -0000 1.83 +++ WPG2Parser.cpp 25 Nov 2008 11:58:28 -0000 1.84 @@ -518,10 +518,11 @@ WPG_DEBUG_MSG((" width : %li\n", m_width)); WPG_DEBUG_MSG((" height : %li\n", m_height)); - double width = (TO_DOUBLE(m_width)) / m_xres; - double height = (TO_DOUBLE(m_height)) / m_yres; + ::WPXPropertyList propList; + propList.insert("svg:width", (float)((TO_DOUBLE(m_width)) / m_xres)); + propList.insert("svg:height", (float)((TO_DOUBLE(m_height)) / m_yres)); - m_painter->startGraphics(width, height); + m_painter->startGraphics(propList); static const int WPG2_defaultPenDashes[] = { 1, 291, 0, // style #0 (actually solid) @@ -612,7 +613,12 @@ m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); else m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); - context.compoundPath.closed = context.compoundClosed; + if (context.compoundClosed) + { + WPXPropertyList element; + element.insert("libwpg:path-action", "Z"); + context.compoundPath.append(element); + } m_painter->drawPath(context.compoundPath); } @@ -1145,14 +1151,17 @@ unsigned long count = readU16(); - libwpg::WPGPointArray points; + ::WPXPropertyListVector points; + ::WPXPropertyList point; for(unsigned long i = 0; i < count; i++ ) { + point.clear(); long x = (m_doublePrecision) ? readS32() : readS16(); long y = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(x,y); - libwpg::WPGPoint p(TO_DOUBLE(x)/m_xres, TO_DOUBLE(y)/m_yres); - points.add(p); + point.insert("svg:x", (float)(TO_DOUBLE(x)/m_xres)); + point.insert("svg:y", (float)(TO_DOUBLE(y)/m_yres)); + points.append(point); } if(insideCompound) @@ -1161,10 +1170,18 @@ { // inside a compound ? convert it into path because for compound // we will only use paths - libwpg::WPGPath& path = m_groupStack.top().compoundPath; - path.moveTo(points[0]); + ::WPXPropertyListVector& path = m_groupStack.top().compoundPath; + ::WPXPropertyList element; + element = points[0]; + element.insert("libwpg:path-action", "M"); + path.append(element); for(unsigned long ii = 1; ii < count; ii++) - path.lineTo(points[ii]); + { + element.clear(); + element = points[ii]; + element.insert("libwpg:path-action", "L"); + path.append(element); + } } } else @@ -1217,36 +1234,49 @@ unsigned int count = readU16(); - libwpg::WPGPointArray vertices; - libwpg::WPGPointArray controlPoints; + ::WPXPropertyListVector path; + ::WPXPropertyList element; + ::WPXPropertyListVector vertices; + ::WPXPropertyListVector controlPoints; for(unsigned int i = 0; i < count; i++ ) { long ix = (m_doublePrecision) ? readS32() : readS16(); long iy = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ix,iy); - libwpg::WPGPoint initialPoint( TO_DOUBLE(ix)/m_xres, TO_DOUBLE(iy)/m_yres ); long ax = (m_doublePrecision) ? readS32() : readS16(); long ay = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ax,ay); - libwpg::WPGPoint anchorPoint( TO_DOUBLE(ax)/m_xres, TO_DOUBLE(ay)/m_yres ); long tx = (m_doublePrecision) ? readS32() : readS16(); long ty = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(tx,ty); - libwpg::WPGPoint terminalPoint( TO_DOUBLE(tx)/m_xres, TO_DOUBLE(ty)/m_yres ); - vertices.add(anchorPoint); - if(i > 0) - controlPoints.add(initialPoint); - controlPoints.add(terminalPoint); + libwpg::WPGPoint initialPoint( TO_DOUBLE(ix)/m_xres, TO_DOUBLE(iy)/m_yres ); + libwpg::WPGPoint terminalPoint( TO_DOUBLE(tx)/m_xres, TO_DOUBLE(ty)/m_yres ); + libwpg::WPGPoint anchorPoint( TO_DOUBLE(ax)/m_xres, TO_DOUBLE(ay)/m_yres ); + + element.insert("svg:x", (float)(TO_DOUBLE(ax)/m_xres)); + element.insert("svg:y", (float)(TO_DOUBLE(ay)/m_yres)); + if (i == 0) + element.insert("libwpg:path-action", "M"); + else + { + element.insert("svg:x2", (float)(TO_DOUBLE(ix)/m_xres)); + element.insert("svg:y2", (float)(TO_DOUBLE(iy)/m_yres)); + element.insert("libwpg:path-action", "C"); + } + path.append(element); + element.insert("svg:x1", (float)(TO_DOUBLE(tx)/m_xres)); + element.insert("svg:y1", (float)(TO_DOUBLE(ty)/m_yres)); } - libwpg::WPGPath path; - path.closed = objCh.closed; - path.moveTo(vertices[0]); - for(unsigned j = 1; j < vertices.count(); j++) - path.curveTo(controlPoints[j*2-2], controlPoints[j*2-1], vertices[j]); + element.clear(); + if (objCh.closed) + { + element.insert("libwpg:path-action", "Z"); + path.append(element); + } if(insideCompound) // inside a compound ? just collect the path together Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- libwpg.h.in 24 Nov 2008 10:16:19 -0000 1.7 +++ libwpg.h.in 25 Nov 2008 11:58:28 -0000 1.8 @@ -39,7 +39,6 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGPath.h" #include "WPGPoint.h" #include "WPGRect.h" #include "WPGBitmap.h" |
From: Fridrich S. <str...@us...> - 2008-11-25 11:58:33
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28859/src/conv/raw Modified Files: wpg2raw.cpp Log Message: getting rid of another data structure in favour of libwpd framework WPXProperty* classes Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- wpg2raw.cpp 24 Nov 2008 10:16:19 -0000 1.12 +++ wpg2raw.cpp 25 Nov 2008 11:58:28 -0000 1.13 @@ -36,11 +36,11 @@ public: RawPainter(); - void startGraphics(double imageWidth, double imageHeight); + void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); void startLayer(unsigned int id); void endLayer(unsigned int id); - void startEmbeddedGraphics(double /* imageWidth */, double /* imageHeight */) {} + void startEmbeddedGraphics(const ::WPXPropertyList& /*propList*/) {} void endEmbeddedGraphics() {} void setPen(const libwpg::WPGPen& pen); @@ -49,20 +49,67 @@ void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry, double rotation, const libwpg::WPGPoint& from, const libwpg::WPGPoint& to); - void drawPolyline(const libwpg::WPGPointArray& vertices); - void drawPolygon(const libwpg::WPGPointArray& vertices); - void drawPath(const libwpg::WPGPath& path); + void drawPolyline(const ::WPXPropertyListVector& vertices); + void drawPolygon(const ::WPXPropertyListVector& vertices); + void drawPath(const ::WPXPropertyListVector& path); void drawBitmap(const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); }; +WPXString getPropString(const WPXPropertyList &propList) +{ + WPXString propString; + WPXPropertyList::Iter i(propList); + if (!i.last()) + { + propString.append(i.key()); + propString.append(": "); + propString.append(i()->getStr().cstr()); + for (; i.next(); ) + { + propString.append(", "); + propString.append(i.key()); + propString.append(": "); + propString.append(i()->getStr().cstr()); + } + } + + return propString; +} + +WPXString getPropString(const WPXPropertyListVector &itemList) +{ + WPXString propString; + + propString.append("("); + WPXPropertyListVector::Iter i(itemList); + + if (!i.last()) + { + propString.append("("); + propString.append(getPropString(i())); + propString.append(")"); + + for (; i.next();) + { + propString.append(", ("); + propString.append(getPropString(i())); + propString.append(")"); + } + + } + propString.append(")"); + + return propString; +} + RawPainter::RawPainter(): libwpg::WPGPaintInterface() { } -void RawPainter::startGraphics(double width, double height) +void RawPainter::startGraphics(const ::WPXPropertyList &propList) { - printf("RawPainter::startGraphics(width: %.4fin, height: %.4fin)\n", width, height); + printf("RawPainter::startGraphics(%s)\n", getPropString(propList).cstr()); } void RawPainter::endGraphics() @@ -130,23 +177,19 @@ printf(" Radius: %g %g\n", rx, ry); } -void RawPainter::drawPolyline(const libwpg::WPGPointArray& vertices) +void RawPainter::drawPolyline(const ::WPXPropertyListVector& vertices) { - printf("RawPainter::drawPolyline %d points\n", vertices.count()); - for(unsigned i = 0; i < vertices.count(); i++) - printf(" (%g %g)\n", vertices[i].x, vertices[i].y); + printf("RawPainter::drawPolyline (%s)\n", getPropString(vertices).cstr()); } -void RawPainter::drawPolygon(const libwpg::WPGPointArray& vertices) +void RawPainter::drawPolygon(const ::WPXPropertyListVector& vertices) { - printf("RawPainter::drawPolygon %d points\n", vertices.count()); - for(unsigned i = 0; i < vertices.count(); i++) - printf(" (%g %g)\n", vertices[i].x, vertices[i].y); + printf("RawPainter::drawPolygon (%s)\n", getPropString(vertices).cstr()); } -void RawPainter::drawPath(const libwpg::WPGPath& path) +void RawPainter::drawPath(const ::WPXPropertyListVector& path) { - printf("RawPainter::drawPath %d elements\n", path.count()); + printf("RawPainter::drawPath (%s)\n", getPropString(path).cstr()); } void RawPainter::drawBitmap(const libwpg::WPGBitmap& /*bitmap*/) @@ -154,9 +197,9 @@ printf("RawPainter::drawBitmap\n"); } -void RawPainter::drawImageObject(const ::WPXPropertyList& /* propList */, const ::WPXBinaryData& /*binaryData*/) +void RawPainter::drawImageObject(const ::WPXPropertyList& propList, const ::WPXBinaryData& /*binaryData*/) { - printf("RawPainter::drawBinaryData\n"); + printf("RawPainter::drawImageObject (%s)\n", getPropString(propList).cstr()); } namespace { |
From: Fridrich S. <str...@us...> - 2008-11-24 10:16:28
|
Update of /cvsroot/libwpg/libwpg/src/conv/svg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12228/src/conv/svg Modified Files: wpg2svg.cpp Log Message: first step in the struggle to simplify libwpg api Index: wpg2svg.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/svg/wpg2svg.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- wpg2svg.cpp 27 Jul 2008 20:56:16 -0000 1.5 +++ wpg2svg.cpp 24 Nov 2008 10:16:19 -0000 1.6 @@ -27,7 +27,8 @@ #include <sstream> #include <string.h> #include "libwpg.h" -#include <libwpd-stream/WPXStreamImplementation.h> +#include <libwpd-stream/libwpd-stream.h> +#include <libwpd/libwpd.h> namespace { @@ -77,7 +78,7 @@ return 1; } - libwpg::WPGString output; + ::WPXString output; if (!libwpg::WPGraphics::generateSVG(&input, output)) { std::cerr << "ERROR: SVG Generation failed!" << std::endl; |
From: Fridrich S. <str...@us...> - 2008-11-24 10:16:27
|
Update of /cvsroot/libwpg/libwpg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12228 Modified Files: configure.in Log Message: first step in the struggle to simplify libwpg api Index: configure.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/configure.in,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- configure.in 8 Apr 2008 12:12:42 -0000 1.18 +++ configure.in 24 Nov 2008 10:16:19 -0000 1.19 @@ -71,6 +71,7 @@ dnl *********************************************************************************** PKG_CHECK_MODULES(LIBWPG,[ +libwpd-0.9 >= $LIBWPD_REQUIRED_VERSION libwpd-stream-0.9 >= $LIBWPD_REQUIRED_VERSION ]) |