Update of /cvsroot/libwpg/libwpg/src/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6270/src/lib
Modified Files:
Tag: STABLE-0-1-0
WPG1Parser.cpp WPG1Parser.h
Log Message:
handle bezier curve in WPG1 too
Index: WPG1Parser.h
===================================================================
RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- WPG1Parser.h 16 Jul 2007 12:03:33 -0000 1.15
+++ WPG1Parser.h 16 Jul 2008 09:25:06 -0000 1.15.2.1
@@ -51,6 +51,8 @@
void handleRectangle();
void handlePolygon();
void handleEllipse();
+
+ void handleCurvedPolyline();
unsigned char* decodeRLE(int width, int height, int depth);
void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth);
Index: WPG1Parser.cpp
===================================================================
RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v
retrieving revision 1.33.2.3
retrieving revision 1.33.2.4
diff -u -d -r1.33.2.3 -r1.33.2.4
--- WPG1Parser.cpp 11 Jul 2008 14:44:48 -0000 1.33.2.3
+++ WPG1Parser.cpp 16 Jul 2008 09:25:06 -0000 1.33.2.4
@@ -166,11 +166,24 @@
{ 0x07, "Rectangle", &WPG1Parser::handleRectangle },
{ 0x08, "Polygon", &WPG1Parser::handlePolygon },
{ 0x09, "Ellipse", &WPG1Parser::handleEllipse },
+ { 0x0a, "Reserved", 0 },
{ 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne },
+ { 0x0c, "Graphics Text (Type 1)", 0 },
+ { 0x0d, "Grephics Text Attributes", 0 },
{ 0x0e, "Colormap", &WPG1Parser::handleColormap },
{ 0x0f, "Start WPG", &WPG1Parser::handleStartWPG },
{ 0x10, "End WPG", &WPG1Parser::handleEndWPG },
+ { 0x11, "Postscript Data Follows", 0 },
+ { 0x12, "Output Attributes", 0 },
+ { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline },
{ 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo },
+ { 0x15, "Start Figure", 0 },
+ { 0x16, "Start Chart", 0 },
+ { 0x17, "Planperfect Data", 0 },
+ { 0x18, "Graphics Text (Type 2)", 0 },
+ { 0x19, "Start WPG (Type 2)", 0 },
+ { 0x1a, "Graphics Text (Type 3)", 0 },
+ { 0x1b, "Ellipse", 0 },
{ 0x00, 0, 0 } // end marker
};
@@ -449,6 +462,39 @@
WPG_DEBUG_MSG((" Radius y: %d\n", ry));
}
+void WPG1Parser::handleCurvedPolyline()
+{
+ if (!m_graphicsStarted)
+ return;
+ readU32();
+ unsigned int count = readU16();
+ if (!count)
+ return;
+ libwpg::WPGPath path;
+ path.closed = false;
+ long xInitial = readS16();
+ long yInitial = readS16();
+ path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)yInitial/1200.0));
+ for (unsigned i = 1; i < (count-1)/3; i++)
+ {
+ 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)yControl1/1200.0),
+ libwpg::WPGPoint((double)xControl2/1200.0, (double)yControl2/1200.0),
+ libwpg::WPGPoint((double)xCoordinate/1200.0, (double)yCoordinate/1200.0));
+ }
+
+ m_painter->setBrush(m_brush);
+ m_painter->setPen(m_pen);
+ m_painter->drawPath(path);
+
+ WPG_DEBUG_MSG(("Curved Polyline\n"));
+}
+
// allocate a buffer (of specified bitmap size), then start decoding RLE data
// from the input stream to fill the buffer
// NOTE: delete the buffer by yourself!
|