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