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...> - 2006-06-21 12:06:11
|
Update of /cvsroot/libwpg/libwpg/src/conv/svg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30939/src/conv/svg Modified Files: main.cpp Log Message: Add Memory stream implementation; make wpg2foo ole2 ready; modify some indents Index: main.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/svg/main.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- main.cpp 18 Jun 2006 14:43:57 -0000 1.11 +++ main.cpp 21 Jun 2006 12:05:59 -0000 1.12 @@ -210,7 +210,17 @@ } const char* filename = argv[1]; - WPGFileStream* input = new WPGFileStream(filename); + WPGInputStream* input = new WPGFileStream(filename); + if (input->isOle()) + { + WPGInputStream* olestream = input->getWPGOleStream(); + if (olestream) + { + delete input; + input = olestream; + } + } + if (!WPGraphics::isSupported(input)) { printf("ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); |
From: Fridrich S. <str...@us...> - 2006-06-21 12:06:11
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30939/src/lib Modified Files: WPGHeader.cpp WPGStreamImplementation.cpp WPGStreamImplementation.h Log Message: Add Memory stream implementation; make wpg2foo ole2 ready; modify some indents Index: WPGStreamImplementation.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGStreamImplementation.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGStreamImplementation.cpp 18 Jun 2006 14:43:57 -0000 1.1 +++ WPGStreamImplementation.cpp 21 Jun 2006 12:06:00 -0000 1.2 @@ -26,6 +26,8 @@ #include "WPGStreamImplementation.h" #include <fstream> +#include <sstream> +#include <string> namespace libwpg { @@ -36,10 +38,22 @@ std::fstream file; }; +class WPGMemoryStreamPrivate +{ +public: + WPGMemoryStreamPrivate(const std::string str); + std::stringstream buffer; +}; + } // namespace libwpg using namespace libwpg; +WPGMemoryStreamPrivate::WPGMemoryStreamPrivate(const std::string str) : + buffer(str, std::ios::binary | std::ios::in) +{ +} + WPGFileStream::WPGFileStream(const char* filename) { @@ -87,3 +101,87 @@ { return d->file.eof(); } + +bool WPGFileStream::isOle() +{ +/* TODO: Here we should use basically pole to check whether + the d->file is an ole2 document and return true if + it is so +*/ + return false; +} + +WPGInputStream* WPGFileStream::getWPGOleStream() +{ +/* TODO: Here we should look for the "PerfectOffice_MAIN" stream + and constuct a new WPGMemoryStream from the data contained + and return pointer to that stream. If the stream is not present, + we should return null pointer +*/ + return 0; +} + + +WPGMemoryStream::WPGMemoryStream(const char *data, const unsigned int dataSize) +{ + d = new WPGMemoryStreamPrivate(std::string(data, dataSize)); +} + +WPGMemoryStream::~WPGMemoryStream() +{ + delete d; +} + +unsigned char WPGMemoryStream::getc() +{ + return d->buffer.get(); +} + +long WPGMemoryStream::read(long nbytes, char* buffer) +{ + long nread = 0; + + if(d->buffer.good()) + { + long curpos = d->buffer.tellg(); + d->buffer.read(buffer, nbytes); + nread = (long)d->buffer.tellg() - curpos; + } + + return nread; +} + +long WPGMemoryStream::tell() +{ + return d->buffer.good() ? (long)d->buffer.tellg() : -1L; +} + +void WPGMemoryStream::seek(long offset) +{ + if(d->buffer.good()) + d->buffer.seekg(offset); +} + +bool WPGMemoryStream::atEnd() +{ + return d->buffer.eof(); +} + +bool WPGMemoryStream::isOle() +{ +/* TODO: Here we should use basically pole to check whether + the d->buffer is an ole2 document and return true if + it is so +*/ + return false; +} + +WPGInputStream* WPGMemoryStream::getWPGOleStream() +{ +/* TODO: Here we should look for the "PerfectOffice_MAIN" stream + and constuct a new WPGMemoryStream from the data contained + and return pointer to that stream. If the stream is not present, + we should return null pointer +*/ + return 0; +} Index: WPGStreamImplementation.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGStreamImplementation.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGStreamImplementation.h 18 Jun 2006 14:43:57 -0000 1.1 +++ WPGStreamImplementation.h 21 Jun 2006 12:06:00 -0000 1.2 @@ -45,8 +45,8 @@ virtual void seek(long offset); virtual bool atEnd(); - virtual bool isOle() { return false; }; - virtual WPGInputStream *getWPGOleStream() { return 0; }; + virtual bool isOle(); + virtual WPGInputStream *getWPGOleStream(); private: WPGFileStreamPrivate* d; @@ -54,6 +54,29 @@ WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed }; +class WPGMemoryStreamPrivate; + +class WPGMemoryStream: public WPGInputStream +{ +public: + WPGMemoryStream(const char *data, const unsigned int dataSize); + ~WPGMemoryStream(); + + virtual unsigned char getc(); + virtual long read(long n, char* buffer); + virtual long tell(); + virtual void seek(long offset); + virtual bool atEnd(); + + virtual bool isOle(); + virtual WPGInputStream *getWPGOleStream(); + +private: + WPGMemoryStreamPrivate* d; + WPGMemoryStream(const WPGMemoryStream&); // copy is not allowed + WPGMemoryStream& operator=(const WPGMemoryStream&); // assignment is not allowed +}; + } // namespace wpg #endif // __WPGSTREAMIMPLEMENTATION_H__ Index: WPGHeader.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGHeader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGHeader.cpp 17 Jun 2006 08:11:53 -0000 1.1 +++ WPGHeader.cpp 21 Jun 2006 12:06:00 -0000 1.2 @@ -87,7 +87,7 @@ m_startOfPacketData = readU16(prefix+14); WPG_DEBUG_MSG(("Header Identifier = %c%c%c\n", m_identifier[1], - m_identifier[2],m_identifier[3])); + m_identifier[2], m_identifier[3])); WPG_DEBUG_MSG(("Product type = 0x%x\n", m_productType)); WPG_DEBUG_MSG(("File type = 0x%x\n", m_fileType)); WPG_DEBUG_MSG(("Major version = 0x%x\n", m_majorVersion)); |
From: Fridrich S. <str...@us...> - 2006-06-20 20:16:19
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32245/src/lib Modified Files: WPG1Parser.cpp Log Message: Reverse engineered WPG1 default palette. It should work now, maybe some errors due to the fact that it was entered manually Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPG1Parser.cpp 20 Jun 2006 09:41:40 -0000 1.13 +++ WPG1Parser.cpp 20 Jun 2006 20:16:04 -0000 1.14 @@ -46,20 +46,20 @@ 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x38, 0x45, 0x55, 0x61, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x61, 0x55, 0x45, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x51, 0x59, 0x61, 0x69, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x69, 0x61, 0x59, + 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, + 0x00, 0x10, 0x20, 0x30, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x30, 0x20, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x28, 0x30, 0x38, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x38, 0x30, 0x28, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x3C, 0x30, 0x34, 0x3C, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x3C, 0x34, 0x30, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -81,20 +81,20 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, - 0xB8, 0xBF, 0xC6, 0xCD, 0xD4, 0xDB, 0xE2, 0xE9, - 0x2B, 0x32, 0x39, 0x40, 0x47, 0x4E, 0x55, 0x63, - 0x71, 0x7F, 0x8D, 0x9B, 0xA9, 0xB7, 0xC5, 0xD3, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x45, 0x55, 0x61, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x61, 0x55, 0x45, + 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, + 0x51, 0x59, 0x61, 0x69, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x69, 0x61, 0x59, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x20, 0x30, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x30, 0x20, 0x10, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x28, 0x30, 0x38, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x38, 0x30, 0x28, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, + 0x3C, 0x30, 0x34, 0x3C, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x3C, 0x34, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -116,20 +116,20 @@ 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x61, 0x55, 0x45, + 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, + 0x38, 0x45, 0x55, 0x61, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x69, 0x61, 0x59, + 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, + 0x51, 0x59, 0x61, 0x69, 0x71, 0x71, 0x71, 0x71, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x30, 0x20, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x20, 0x30, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x38, 0x30, 0x28, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x28, 0x30, 0x38, 0x41, 0x41, 0x41, 0x41, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x3C, 0x34, 0x30, + 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x2C, 0x30, 0x34, 0x3C, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; |
From: Fridrich S. <str...@us...> - 2006-06-20 09:41:52
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27502/src/lib Modified Files: WPG1Parser.cpp Log Message: First 32 colours should be OK now Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPG1Parser.cpp 20 Jun 2006 04:29:25 -0000 1.12 +++ WPG1Parser.cpp 20 Jun 2006 09:41:40 -0000 1.13 @@ -30,10 +30,10 @@ #include "libwpg_utils.h" static const unsigned char defaultWPG1PaletteRed[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, - 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, + 0xC0, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x14, 0x20, 0x2C, 0x38, 0x45, 0x51, 0x61, + 0x71, 0x82, 0x92, 0xA2, 0xB6, 0xCB, 0xE3, 0xFF, 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -65,10 +65,10 @@ }; static const unsigned char defaultWPG1PaletteGreen[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, - 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x3F, 0x7F, + 0xC0, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, + 0x00, 0x14, 0x20, 0x2C, 0x38, 0x45, 0x51, 0x61, + 0x71, 0x82, 0x92, 0xA2, 0xB6, 0xCB, 0xE3, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, @@ -100,10 +100,10 @@ }; static const unsigned char defaultWPG1PaletteBlue[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, - 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, + 0xC0, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0x14, 0x20, 0x2C, 0x38, 0x45, 0x51, 0x61, + 0x71, 0x82, 0x92, 0xA2, 0xB6, 0xCB, 0xE3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, |
From: Fridrich S. <str...@us...> - 2006-06-20 04:29:38
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8307/src/lib Modified Files: WPG1Parser.cpp Log Message: Another line of WPG1 Palette Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- WPG1Parser.cpp 19 Jun 2006 15:20:36 -0000 1.11 +++ WPG1Parser.cpp 20 Jun 2006 04:29:25 -0000 1.12 @@ -60,7 +60,7 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, + 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -95,7 +95,7 @@ 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x3C, 0x34, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -130,7 +130,7 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, + 0x2C, 0x30, 0x34, 0x3C, 0x41, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; |
From: Fridrich S. <str...@us...> - 2006-06-19 15:20:58
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12310/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGXParser.cpp WPGXParser.h Log Message: Some more work on WPG1 Palette + some refactoring given that the Palettes for WPG1 and WPG2 are different Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WPG2Parser.h 17 Jun 2006 08:11:53 -0000 1.3 +++ WPG2Parser.h 19 Jun 2006 15:20:36 -0000 1.4 @@ -67,6 +67,8 @@ void handleRectangle(); void handleArc(); + void resetPalette(); + // parsing context bool m_success; bool m_exit; Index: WPGXParser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGXParser.cpp 19 Jun 2006 12:36:15 -0000 1.7 +++ WPGXParser.cpp 19 Jun 2006 15:20:36 -0000 1.8 @@ -29,113 +29,6 @@ using namespace libwpg; -// FIXME (ariya) this color palette does not seem to be correct ! - -static const unsigned char defaultPaletteRed[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, - 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, - 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, -}; - -static const unsigned char defaultPaletteGreen[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, - 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, - 0xB8, 0xBF, 0xC6, 0xCD, 0xD4, 0xDB, 0xE2, 0xE9, - 0x2B, 0x32, 0x39, 0x40, 0x47, 0x4E, 0x55, 0x63, - 0x71, 0x7F, 0x8D, 0x9B, 0xA9, 0xB7, 0xC5, 0xD3, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, - 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, -}; - -static const unsigned char defaultPaletteBlue[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, - 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, - 0x47, 0x57, 0x69, 0x78, 0x8C, 0x9C, 0xB0, 0xC7, -}; - WPGXParser::WPGXParser(WPGInputStream *input, WPGPaintInterface* painter): m_input(input), m_painter(painter) { @@ -208,16 +101,3 @@ // unreachable return 0; } - -void WPGXParser::resetPalette() -{ - m_colorPalette.clear(); - for (int i=0; i<256; i++) - { - WPGColor color; - color.red = defaultPaletteRed[i]; - color.green = defaultPaletteGreen[i]; - color.blue = defaultPaletteBlue[i]; - m_colorPalette[i] = color; - } -} Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPG1Parser.h 19 Jun 2006 12:36:15 -0000 1.7 +++ WPG1Parser.h 19 Jun 2006 15:20:36 -0000 1.8 @@ -38,9 +38,6 @@ WPG1Parser(WPGInputStream *input, WPGPaintInterface* painter); bool parse(); -protected: - void resetPalette(); - private: void handleStartWPG(); void handleEndWPG(); @@ -55,6 +52,8 @@ void handlePolygon(); void handleEllipse(); + void resetPalette(); + // parsing context bool m_success; bool m_exit; Index: WPGXParser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPGXParser.h 19 Jun 2006 12:36:15 -0000 1.7 +++ WPGXParser.h 19 Jun 2006 15:20:36 -0000 1.8 @@ -54,7 +54,6 @@ WPGInputStream* m_input; WPGPaintInterface* m_painter; std::map<int,WPGColor> m_colorPalette; - virtual void resetPalette(); }; #endif // __WPGXPARSER_H__ Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPG2Parser.cpp 18 Jun 2006 07:26:30 -0000 1.6 +++ WPG2Parser.cpp 19 Jun 2006 15:20:36 -0000 1.7 @@ -29,6 +29,111 @@ #include "WPGPaintInterface.h" #include "libwpg_utils.h" +static const unsigned char defaultWPG2PaletteRed[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, + 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, + 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, +}; + +static const unsigned char defaultWPG2PaletteGreen[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, + 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, + 0xB8, 0xBF, 0xC6, 0xCD, 0xD4, 0xDB, 0xE2, 0xE9, + 0x2B, 0x32, 0x39, 0x40, 0x47, 0x4E, 0x55, 0x63, + 0x71, 0x7F, 0x8D, 0x9B, 0xA9, 0xB7, 0xC5, 0xD3, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, + 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, +}; + +static const unsigned char defaultWPG2PaletteBlue[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, + 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, + 0x47, 0x57, 0x69, 0x78, 0x8C, 0x9C, 0xB0, 0xC7, +}; + class WPG2Parser::ObjectCharacterization { public: @@ -833,3 +938,16 @@ WPG_DEBUG_MSG((" End point y : %d\n", ey)); } + +void WPG2Parser::resetPalette() +{ + m_colorPalette.clear(); + for (int i=0; i<256; i++) + { + WPGColor color; + color.red = defaultWPG2PaletteRed[i]; + color.green = defaultWPG2PaletteGreen[i]; + color.blue = defaultWPG2PaletteBlue[i]; + m_colorPalette[i] = color; + } +} Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- WPG1Parser.cpp 19 Jun 2006 12:36:15 -0000 1.10 +++ WPG1Parser.cpp 19 Jun 2006 15:20:36 -0000 1.11 @@ -38,14 +38,14 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7D, 0x9E, 0xBE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xBE, 0x9E, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0xB6, 0xC7, 0xDB, 0xEB, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEB, 0xDB, 0xC7, + 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, + 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, @@ -61,7 +61,7 @@ 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, - 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static const unsigned char defaultWPG1PaletteGreen[] = { @@ -73,14 +73,14 @@ 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7D, 0x9E, 0xBE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xBE, 0x9E, + 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, + 0xB6, 0xC7, 0xDB, 0xEB, 0xFF, 0xFF, 0xFF, 0xFF, + 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEB, 0xDB, 0xC7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, @@ -96,7 +96,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, - 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static const unsigned char defaultWPG1PaletteBlue[] = { @@ -108,14 +108,14 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xBE, 0x9E, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x7D, 0x9E, 0xBE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEB, 0xDB, 0xC7, + 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, 0xB6, + 0xB6, 0xC7, 0xDB, 0xEB, 0xFF, 0xFF, 0xFF, 0xFF, + 0x71, 0x71, 0x71, 0x71, 0x71, 0x55, 0x38, 0x1C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1C, 0x38, 0x55, 0x71, 0x71, 0x71, 0x71, 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, @@ -131,7 +131,7 @@ 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, - 0x47, 0x57, 0x69, 0x78, 0x8C, 0x9C, 0xB0, 0xC7, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; |
From: Fridrich S. <str...@us...> - 2006-06-19 12:36:27
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5100/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPGXParser.cpp WPGXParser.h Log Message: Beginning of work reverse engineering the WPG1 Palette Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPG1Parser.h 17 Jun 2006 08:11:53 -0000 1.6 +++ WPG1Parser.h 19 Jun 2006 12:36:15 -0000 1.7 @@ -37,6 +37,9 @@ public: WPG1Parser(WPGInputStream *input, WPGPaintInterface* painter); bool parse(); + +protected: + void resetPalette(); private: void handleStartWPG(); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPG1Parser.cpp 17 Jun 2006 08:11:53 -0000 1.9 +++ WPG1Parser.cpp 19 Jun 2006 12:36:15 -0000 1.10 @@ -29,6 +29,111 @@ #include "WPGPaintInterface.h" #include "libwpg_utils.h" +static const unsigned char defaultWPG1PaletteRed[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, + 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7D, 0x9E, 0xBE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, + 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, +}; + +static const unsigned char defaultWPG1PaletteGreen[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, + 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, + 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, 0x7D, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, + 0xB8, 0xBF, 0xC6, 0xCD, 0xD4, 0xDB, 0xE2, 0xE9, + 0x2B, 0x32, 0x39, 0x40, 0x47, 0x4E, 0x55, 0x63, + 0x71, 0x7F, 0x8D, 0x9B, 0xA9, 0xB7, 0xC5, 0xD3, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, + 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, +}; + +static const unsigned char defaultWPG1PaletteBlue[] = { + 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, + 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0x7D, 0x41, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x7D, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xBE, 0x9E, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, + 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, + 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, + 0x47, 0x57, 0x69, 0x78, 0x8C, 0x9C, 0xB0, 0xC7, +}; + WPG1Parser::WPG1Parser(WPGInputStream *input, WPGPaintInterface* painter): WPGXParser(input, painter), @@ -303,3 +408,17 @@ WPG_DEBUG_MSG((" Radius x: %d\n", rx)); WPG_DEBUG_MSG((" Radius y: %d\n", ry)); } + +void WPG1Parser::resetPalette() +{ + m_colorPalette.clear(); + for (int i=0; i<256; i++) + { + WPGColor color; + color.red = defaultWPG1PaletteRed[i]; + color.green = defaultWPG1PaletteGreen[i]; + color.blue = defaultWPG1PaletteBlue[i]; + m_colorPalette[i] = color; + } +} + Index: WPGXParser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGXParser.cpp 17 Jun 2006 08:11:53 -0000 1.6 +++ WPGXParser.cpp 19 Jun 2006 12:36:15 -0000 1.7 @@ -221,4 +221,3 @@ m_colorPalette[i] = color; } } - Index: WPGXParser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGXParser.h 17 Jun 2006 08:11:53 -0000 1.6 +++ WPGXParser.h 19 Jun 2006 12:36:15 -0000 1.7 @@ -54,7 +54,7 @@ WPGInputStream* m_input; WPGPaintInterface* m_painter; std::map<int,WPGColor> m_colorPalette; - void resetPalette(); + virtual void resetPalette(); }; #endif // __WPGXPARSER_H__ |
From: Fridrich S. <str...@us...> - 2006-06-18 14:44:12
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8436/src/lib Modified Files: Makefile.am WPGStream.h Added Files: WPGStreamImplementation.cpp WPGStreamImplementation.h libwpg-stream.rc.in Removed Files: WPGStream.cpp Log Message: Separate stream implementation from the rest of the library Index: WPGStream.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGStream.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGStream.h 17 Jun 2006 08:11:53 -0000 1.1 +++ WPGStream.h 18 Jun 2006 14:43:57 -0000 1.2 @@ -29,8 +29,6 @@ namespace libwpg { -class WPGFileStreamPrivate; - class WPGInputStream { public: @@ -39,24 +37,9 @@ virtual long tell() = 0; virtual void seek(long offset) = 0; virtual bool atEnd() = 0; -}; -class WPGFileStream: public WPGInputStream -{ -public: - WPGFileStream(const char* filename); - ~WPGFileStream(); - - virtual unsigned char getc(); - virtual long read(long n, char* buffer); - virtual long tell(); - virtual void seek(long offset); - virtual bool atEnd(); - -private: - WPGFileStreamPrivate* d; - WPGFileStream(const WPGFileStream&); // copy is not allowed - WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed + virtual bool isOle() = 0; + virtual WPGInputStream *getWPGOleStream() = 0; }; } // namespace wpg --- WPGStream.cpp DELETED --- --- NEW FILE: libwpg-stream.rc.in --- #include <winver.h> VS_VERSION_INFO VERSIONINFO FILEVERSION @WPG_MAJOR_VERSION@,@WPG_MINOR_VERSION@,@WPG_MICRO_VERSION@,BUILDNUMBER PRODUCTVERSION @WPG_MAJOR_VERSION@,@WPG_MINOR_VERSION@,@WPG_MICRO_VERSION@,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE VFT2_UNKNOWN BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "CompanyName", "The libwpg developer community" VALUE "FileDescription", "libwpg-stream" VALUE "FileVersion", "@WPG_MAJOR_VERSION@.@WPG_MINOR_VERSION@.@WPG_MICRO_VERSION@.BUILDNUMBER" VALUE "InternalName", "libwpg-stream-1" VALUE "LegalCopyright", "Copyright (C) 2004 Marc Oude Kotte, other contributers" VALUE "OriginalFilename", "libwpg-stream-1.dll" VALUE "ProductName", "libwpg" VALUE "ProductVersion", "@WPG_MAJOR_VERSION@.@WPG_MINOR_VERSION@.@WPG_MICRO_VERSION@" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 17 Jun 2006 08:11:53 -0000 1.5 +++ Makefile.am 18 Jun 2006 14:43:57 -0000 1.6 @@ -1,9 +1,11 @@ -EXTRA_DIST = \ - libwpg.rc.in +EXTRA_DIST = \ + libwpg.rc.in \ + libwpg-stream.rc.in # These may be in the builddir too -BUILD_EXTRA_DIST = \ - libwpg.rc +BUILD_EXTRA_DIST = \ + libwpg.rc \ + libwpg-stream.rc if PLATFORM_WIN32 no_undefined = -no-undefined @@ -16,16 +18,18 @@ if OS_WIN32 install-libtool-import-lib: $(INSTALL) .libs/libwpg-1.dll.a $(DESTDIR)$(libdir) + $(INSTALL) .libs/libwpg-stream-1.dll.a $(DESTDIR)$(libdir) uninstall-libtool-import-lib: -rm $(DESTDIR)$(libdir)/libwpg-1.dll.a + -rm $(DESTDIR)$(libdir)/libwpg-stream-1.dll.a else install-libtool-import-lib: uninstall-libtool-import-lib: endif -lib_LTLIBRARIES = libwpg-1.la +lib_LTLIBRARIES = libwpg-1.la libwpg-stream-1.la libwpg_1_includedir = $(includedir)/libwpg-1/libwpg libwpg_1_include_HEADERS = \ libwpg.h \ @@ -45,7 +49,6 @@ libwpg_1_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_1_la_SOURCES = \ WPGraphics.cpp \ - WPGStream.cpp \ WPGPen.cpp \ WPGPoint.cpp \ WPGHeader.cpp \ @@ -62,11 +65,24 @@ WPG1Parser.h \ WPG2Parser.h \ WPGPaintInterface.h - + +libwpg_stream_1_includedir = $(includedir)/libwpg-1/libwpg +libwpg_stream_1_include_HEADERS = WPGStreamImplementation.h + +libwpg_stream_1_la_LIBADD = $(LIBWPG_LIBS) @LIBWPG_STREAM_WIN32_RESOURCE@ +libwpg_stream_1_la_DEPENDENCIES = @LIBWPG_STREAM_WIN32_RESOURCE@ +libwpg_stream_1_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) +libwpg_stream_1_la_SOURCES = WPGStreamImplementation.cpp + + if OS_WIN32 @LIBWPG_WIN32_RESOURCE@ : libwpg.rc $(top_srcdir)/build/win32/lt-compile-resource libwpg.rc @LIBWPG_WIN32_RESOURCE@ + +@LIBWPG_STREAM_WIN32_RESOURCE@ : libwpg.rc + $(top_srcdir)/build/win32/lt-compile-resource libwpg-stream.rc @LIBWPG_STREAM_WIN32_RESOURCE@ + endif --- NEW FILE: WPGStreamImplementation.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGStreamImplementation.h" #include <fstream> namespace libwpg { class WPGFileStreamPrivate { public: std::fstream file; }; } // namespace libwpg using namespace libwpg; WPGFileStream::WPGFileStream(const char* filename) { d = new WPGFileStreamPrivate; d->file.open( filename, std::ios::binary | std::ios::in ); } WPGFileStream::~WPGFileStream() { delete d; } unsigned char WPGFileStream::getc() { return d->file.get(); } long WPGFileStream::read(long nbytes, char* buffer) { long nread = 0; if(d->file.good()) { long curpos = d->file.tellg(); d->file.read(buffer, nbytes); nread = (long)d->file.tellg() - curpos; } return nread; } long WPGFileStream::tell() { return d->file.good() ? (long)d->file.tellg() : -1L; } void WPGFileStream::seek(long offset) { if(d->file.good()) d->file.seekg(offset); } bool WPGFileStream::atEnd() { return d->file.eof(); } --- NEW FILE: WPGStreamImplementation.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGSTREAMIMPLEMENTATION_H__ #define __WPGSTREAMIMPLEMENTATION_H__ #include "WPGStream.h" namespace libwpg { class WPGFileStreamPrivate; class WPGFileStream: public WPGInputStream { public: WPGFileStream(const char* filename); ~WPGFileStream(); virtual unsigned char getc(); virtual long read(long n, char* buffer); virtual long tell(); virtual void seek(long offset); virtual bool atEnd(); virtual bool isOle() { return false; }; virtual WPGInputStream *getWPGOleStream() { return 0; }; private: WPGFileStreamPrivate* d; WPGFileStream(const WPGFileStream&); // copy is not allowed WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed }; } // namespace wpg #endif // __WPGSTREAMIMPLEMENTATION_H__ |
From: Fridrich S. <str...@us...> - 2006-06-18 14:44:12
|
Update of /cvsroot/libwpg/libwpg/src/conv/svg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8436/src/conv/svg Modified Files: Makefile.am main.cpp Log Message: Separate stream implementation from the rest of the library Index: main.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/svg/main.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- main.cpp 17 Jun 2006 08:11:53 -0000 1.10 +++ main.cpp 18 Jun 2006 14:43:57 -0000 1.11 @@ -25,7 +25,8 @@ #include <stdio.h> -#include "libwpg.h" +#include "libwpg.h" +#include "WPGStreamImplementation.h" using namespace libwpg; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/svg/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 1 Feb 2005 17:15:58 -0000 1.2 +++ Makefile.am 18 Jun 2006 14:43:57 -0000 1.3 @@ -11,7 +11,7 @@ wpg2svg_LDFLAGS = -L../../lib/ wpg2svg_DEPENDENCIES = @WPG2SVG_WIN32_RESOURCE@ -wpg2svg_LDADD = -lwpg-1 $(LIBWPG_LIBS) @WPG2SVG_WIN32_RESOURCE@ +wpg2svg_LDADD = -lwpg-1 -lwpg-stream-1 $(LIBWPG_LIBS) @WPG2SVG_WIN32_RESOURCE@ wpg2svg_SOURCES = \ main.cpp |
From: Fridrich S. <str...@us...> - 2006-06-18 14:44:11
|
Update of /cvsroot/libwpg/libwpg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8436 Modified Files: Makefile.am configure.in libwpg-1.pc.in Added Files: libwpg-stream-1.pc.in Log Message: Separate stream implementation from the rest of the library --- NEW FILE: libwpg-stream-1.pc.in --- prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libwpg-stream-1 Description: Library for importing and converting Corel WordPerfect(tm) Graphics images Version: @VERSION@ Requires: libwpg-1 Libs: -L${libdir} -lwpg-stream-1 Cflags: -I${includedir}/libwpg-1 Index: configure.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/configure.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- configure.in 18 Jun 2006 07:24:51 -0000 1.4 +++ configure.in 18 Jun 2006 14:43:57 -0000 1.5 @@ -48,12 +48,14 @@ *-*-mingw*) native_win32=yes LIBWPG_WIN32_RESOURCE=libwpg-win32res.lo + LIBWPG_STREAM_WIN32_RESOURCE=libwpg-stream-win32res.lo WPG2RAW_WIN32_RESOURCE=wpg2raw-win32res.lo WPG2SVG_WIN32_RESOURCE=wpg2svg-win32res.lo ;; *) native_win32=no LIBWPG_WIN32_RESOURCE= + LIBWPG_STREAM_WIN32_RESOURCE= WPG2RAW_WIN32_RESOURCE= WPG2SVG_WIN32_RESOURCE= ;; @@ -61,6 +63,7 @@ AC_MSG_RESULT([$native_win32]) AM_CONDITIONAL(OS_WIN32, test "$native_win32" = yes) AC_SUBST(LIBWPG_WIN32_RESOURCE) +AC_SUBST(LIBWPG_STREAM_WIN32_RESOURCE) AC_SUBST(WPG2RAW_WIN32_RESOURCE) AC_SUBST(WPG2SVG_WIN32_RESOURCE) @@ -142,9 +145,11 @@ src/conv/svg/wpg2svg.rc src/lib/Makefile src/lib/libwpg.rc +src/lib/libwpg-stream.rc build/Makefile build/win32/Makefile libwpg-1.pc +libwpg-stream-1.pc libwpg.spec ]) Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 26 Jan 2005 09:51:27 -0000 1.3 +++ Makefile.am 18 Jun 2006 14:43:57 -0000 1.4 @@ -1,6 +1,6 @@ pkgconfdir = $(libdir)/pkgconfig -pkgconf_DATA = libwpg-1.pc +pkgconf_DATA = libwpg-1.pc libwpg-stream-1.pc SUBDIRS = src build Index: libwpg-1.pc.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/libwpg-1.pc.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- libwpg-1.pc.in 28 Jan 2004 13:01:35 -0000 1.1 +++ libwpg-1.pc.in 18 Jun 2006 14:43:57 -0000 1.2 @@ -6,6 +6,5 @@ Name: libwpg-1 Description: Library for importing and converting Corel WordPerfect(tm) Graphics images Version: @VERSION@ -Requires: libgsf-1 Libs: -L${libdir} -lwpg-1 Cflags: -I${includedir}/libwpg-1 |
From: Fridrich S. <str...@us...> - 2006-06-18 14:44:11
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8436/src/conv/raw Modified Files: Makefile.am main.cpp Log Message: Separate stream implementation from the rest of the library Index: main.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/main.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- main.cpp 17 Jun 2006 08:11:53 -0000 1.8 +++ main.cpp 18 Jun 2006 14:43:57 -0000 1.9 @@ -28,6 +28,7 @@ #include <stdio.h> #include "libwpg.h" +#include "WPGStreamImplementation.h" using namespace libwpg; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 1 Feb 2005 17:15:56 -0000 1.3 +++ Makefile.am 18 Jun 2006 14:43:57 -0000 1.4 @@ -11,7 +11,7 @@ wpg2raw_LDFLAGS = -L../../lib/ wpg2raw_DEPENDENCIES = @WPG2RAW_WIN32_RESOURCE@ -wpg2raw_LDADD = -lwpg-1 $(LIBWPG_LIBS) @WPG2RAW_WIN32_RESOURCE@ +wpg2raw_LDADD = -lwpg-1 -lwpg-stream-1 $(LIBWPG_LIBS) @WPG2RAW_WIN32_RESOURCE@ wpg2raw_SOURCES = \ main.cpp |
From: Ariya H. <ar...@us...> - 2006-06-18 07:26:33
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24989/src/lib Modified Files: WPG2Parser.cpp Log Message: sanity check regarding dimension based on patch by Fridrich Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPG2Parser.cpp 17 Jun 2006 08:11:53 -0000 1.5 +++ WPG2Parser.cpp 18 Jun 2006 07:26:30 -0000 1.6 @@ -308,10 +308,10 @@ unsigned long imageY2 = (m_doublePrecision) ? readU32() : readU16(); // used to adjust coordinates - m_xofs = imageX1; - m_yofs = imageY1; - m_width = imageX2-imageX1; - m_height = imageY2-imageY1; + m_xofs = (imageX1 < imageX2) ? imageX1 : imageX2; + m_yofs = (imageY1 < imageY2) ? imageY1 : imageX2; + m_width = (imageX2 > imageX1 ) ? imageX2-imageX1 : imageX1-imageX2; + m_height = (imageY2 > imageY1) ? imageY2-imageY1 : imageY1-imageY2; WPG_DEBUG_MSG(("StartWPG\n")); WPG_DEBUG_MSG((" Horizontal unit of measure : %d pixels/inch\n", horizontalUnit)); |
From: Ariya H. <ar...@us...> - 2006-06-18 07:24:54
|
Update of /cvsroot/libwpg/libwpg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24193 Modified Files: configure.in Log Message: remove gsf check patch by Fridrich Index: configure.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/configure.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configure.in 17 Jun 2006 08:20:53 -0000 1.3 +++ configure.in 18 Jun 2006 07:24:51 -0000 1.4 @@ -43,12 +43,6 @@ AC_HEADER_STDC -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - -PKG_CHECK_MODULES(LIBWPG,[ -libgsf-1 >= 1.8.0 -]) - AC_MSG_CHECKING([for native Win32]) case "$host" in *-*-mingw*) |
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14544/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGXParser.cpp WPGXParser.h libwpg.h libwpg_utils.h Added Files: WPGBrush.h WPGColor.h WPGHeader.cpp WPGHeader.h WPGPaintInterface.h WPGPen.cpp WPGPen.h WPGPoint.cpp WPGPoint.h WPGRect.h WPGStream.cpp WPGStream.h WPGraphics.cpp WPGraphics.h Removed Files: WPG1Record.cpp WPG1Record.h WPG2Record.cpp WPG2Record.h WPGXRecord.cpp WPGXRecord.h libwpg.cpp libwpg_defaults.h libwpg_exception.h libwpg_utils.cpp wpgheader.cpp wpgheader.h wpglistener.h Log Message: - important records for WPG2 (pen, brush, lines, curve) - the listener is now PaintInterface, using PostScript-like rendering model - simplified SVG generation (due to the above PaintInterface) - fixed coding style to follow libwpd (tab-indentation, camelcase function names, correct file names, ...) - fixed FSF address - added notices on implementation details (first commit for my Google Summer of Code project) --- NEW FILE: WPGRect.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGRECT_H__ #define __WPGRECT_H__ #include "WPGColor.h" namespace libwpg { class WPGRect { public: double x1; double y1; double x2; double y2; WPGRect(): x1(0.0), y1(0.0), x2(0.0), y2(0.0) {} WPGRect(double xx1, double yy1, double xx2, double yy2): x1(xx1), y1(yy1), x2(xx2), y2(yy2) {} WPGRect(const WPGRect& rect) { x1 = rect.x1; y1 = rect.y1; x2 = rect.x2; y2 = rect.y2; } WPGRect& operator=(const WPGRect& rect) { x1 = rect.x1; y1 = rect.y1; x2 = rect.x2; y2 = rect.y2; return *this; } double width() const { return x2-x1; } double height() const { return y2-y1; } }; } // namespace libwpg #endif // __WPGRECT_H__ Index: WPGXParser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGXParser.h 1 Feb 2005 17:15:58 -0000 1.5 +++ WPGXParser.h 17 Jun 2006 08:11:53 -0000 1.6 @@ -1,49 +1,60 @@ -/* libwpg - * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) - * Copyright (C) 2005 Fridrich Strba (fri...@bl...) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For further information visit http://libwpg.sourceforge.net - */ - -/* "This product is not manufactured, approved, or supported by - * Corel Corporation or Corel Corporation Limited." - */ - -#ifndef __WPGXPARSER_H__ -#define __WPGXPARSER_H__ - -#include <gsf/gsf-input.h> -#include "wpglistener.h" -#include "libwpg.h" - -class WPGXParser -{ -public: - WPGXParser(GsfInput *input, WPGListener* listener); - virtual void parse() = 0; - -protected: - std::vector <RGBColor> m_colorPalette; - unsigned char m_lineColorIndex; - unsigned char m_fillColorIndex; - float m_lineWidth; - unsigned char m_lineStyle; - unsigned char m_fillStyle; -}; - - -#endif +/* libwpg + * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) + * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) + * Copyright (C) 2005 Fridrich Strba (fri...@bl...) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02111-1301 USA + * + * For further information visit http://libwpg.sourceforge.net + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#ifndef __WPGXPARSER_H__ +#define __WPGXPARSER_H__ + +#include "WPGPaintInterface.h" +#include "WPGStream.h" +#include "WPGColor.h" + +#include <map> + +using namespace libwpg; + +class WPGXParser +{ +public: + WPGXParser(WPGInputStream *input, WPGPaintInterface* painter); + virtual bool parse() = 0; + + unsigned char readU8(); + unsigned short readU16(); + unsigned long readU32(); + char readS8(); + short readS16(); + long readS32(); + unsigned int readVariableLengthInteger(); + +protected: + WPGInputStream* m_input; + WPGPaintInterface* m_painter; + std::map<int,WPGColor> m_colorPalette; + void resetPalette(); +}; + +#endif // __WPGXPARSER_H__ --- libwpg.cpp DELETED --- --- NEW FILE: WPGStream.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGStream.h" #include <fstream> namespace libwpg { class WPGFileStreamPrivate { public: std::fstream file; }; } // namespace libwpg using namespace libwpg; WPGFileStream::WPGFileStream(const char* filename) { d = new WPGFileStreamPrivate; d->file.open( filename, std::ios::binary | std::ios::in ); } WPGFileStream::~WPGFileStream() { delete d; } unsigned char WPGFileStream::getc() { return d->file.get(); } long WPGFileStream::read(long nbytes, char* buffer) { long nread = 0; if(d->file.good()) { long curpos = d->file.tellg(); d->file.read(buffer, nbytes); nread = (long)d->file.tellg() - curpos; } return nread; } long WPGFileStream::tell() { return d->file.good() ? (long)d->file.tellg() : -1L; } void WPGFileStream::seek(long offset) { if(d->file.good()) d->file.seekg(offset); } bool WPGFileStream::atEnd() { return d->file.eof(); } --- wpgheader.h DELETED --- --- NEW FILE: WPGHeader.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGHEADER_H__ #define __WPGHEADER_H__ #include "WPGStream.h" using namespace libwpg; class WPGHeader { public: WPGHeader(); bool load(WPGInputStream *input); bool isSupported() const; unsigned long startOfDocument() const; int majorVersion() const; private: unsigned char m_identifier[4]; // should always be 0xFF followed by "WPC" unsigned long m_startOfDocument; // index into file unsigned char m_productType; // should always be 1 for WPG files unsigned char m_fileType; // should always be 22 for WPG files unsigned char m_majorVersion; // 2 for WPG 8.0 files unsigned char m_minorVersion; // 0 for WPG 8.0 files unsigned int m_encryptionKey; // 0 when not encrypted unsigned int m_startOfPacketData; // unused, since according to the docs no packets are defined unsigned char m_entryCount; // number of entries in extension unsigned char m_resourceComplete; // resource completeness indicator unsigned int m_encryptionBlockOffset; // encryption block offset unsigned long m_fileSize; // size of the entire wpg file unsigned int m_encryptVersion; // encryption version information }; #endif // WPGHEADER --- NEW FILE: WPGBrush.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGBRUSH_H__ #define __WPGBRUSH_H__ #include "WPGColor.h" namespace libwpg { class WPGBrush { public: typedef enum { NoBrush, Solid, Pattern, Gradient } WPGBrushStyle; WPGBrushStyle style; WPGColor foreColor; WPGColor backColor; WPGBrush(): style(NoBrush), foreColor(0,0,0), backColor(0,0,0) {}; WPGBrush(const WPGColor& fore): style(Solid), foreColor(fore), backColor(0,0,0) {}; WPGBrush(const WPGColor& fore, const WPGColor& back): style(Solid), foreColor(fore), backColor(back) {}; WPGBrush(const WPGBrush& brush) { style = brush.style; foreColor = brush.foreColor; backColor = brush.backColor; } WPGBrush& operator=(const WPGBrush& brush) { style = brush.style; foreColor = brush.foreColor; backColor = brush.backColor; return *this; } }; } // namespace libwpg #endif // __WPGBRUSH_H__ --- NEW FILE: WPGStream.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGSTREAM_H__ #define __WPGSTREAM_H__ namespace libwpg { class WPGFileStreamPrivate; class WPGInputStream { public: virtual unsigned char getc() = 0; virtual long read(long n, char* buffer) = 0; virtual long tell() = 0; virtual void seek(long offset) = 0; virtual bool atEnd() = 0; }; class WPGFileStream: public WPGInputStream { public: WPGFileStream(const char* filename); ~WPGFileStream(); virtual unsigned char getc(); virtual long read(long n, char* buffer); virtual long tell(); virtual void seek(long offset); virtual bool atEnd(); private: WPGFileStreamPrivate* d; WPGFileStream(const WPGFileStream&); // copy is not allowed WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed }; } // namespace wpg #endif // __WPGSTREAM_H__ --- NEW FILE: WPGPoint.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGPOINT_H__ #define __WPGPOINT_H__ #include "WPGColor.h" namespace libwpg { class WPGPoint { public: double x; double y; WPGPoint(): x(0.0), y(0.0) {} WPGPoint(double xx, double yy): x(xx), y(yy) {} WPGPoint(const WPGPoint& point) { x = point.x; y = point.y; } WPGPoint& operator=(const WPGPoint& point) { x = point.x; y = point.y; return *this; } }; class WPGPointArrayPrivate; class WPGPointArray { public: WPGPointArray(); ~WPGPointArray(); WPGPointArray(const WPGPointArray&); WPGPointArray& operator=(const WPGPointArray&); unsigned count() const; WPGPoint& at(unsigned i); const WPGPoint& at(unsigned i) const; const WPGPoint& operator[](unsigned i) const; void add(const WPGPoint& p); private: WPGPointArrayPrivate *d; }; } // namespace libwpg #endif // __WPGPOINT_H__ --- NEW FILE: WPGraphics.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGRAPHICS_H__ #define __WPGRAPHICS_H__ namespace libwpg { class WPGInputStream; class WPGPaintInterface; class WPGraphics { public: static bool isSupported(WPGInputStream* input); static bool parse(WPGInputStream* input, WPGPaintInterface* painter); }; } // namespace libwpg #endif // __WPGRAPHICS_H__ --- NEW FILE: WPGHeader.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGHeader.h" #include "libwpg_utils.h" namespace { static inline unsigned short readU16( const void* p ) { const unsigned char* ptr = (const unsigned char*) p; return ptr[0]+(ptr[1]<<8); } static inline unsigned long readU32( const void* p ) { const unsigned char* ptr = (const unsigned char*) p; return ptr[0]+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24); } } using namespace libwpg; WPGHeader::WPGHeader() { // create a sensible default header m_identifier[0] = 0xff; m_identifier[1] = 'W'; m_identifier[2] = 'P'; m_identifier[3] = 'C'; m_productType = 0x01; m_fileType = 0x16; m_encryptionKey = 0x00; m_majorVersion = 0x02; m_minorVersion = 0x00; m_encryptionKey = 0; m_startOfPacketData = 0; m_entryCount = 0; m_resourceComplete = 0; m_encryptionBlockOffset = 0; m_fileSize = 0; m_encryptVersion = 0; } bool WPGHeader::load(WPGInputStream *input) { input->seek(0); unsigned char prefix[26]; long n = input->read(26, (char*)prefix); if(n < 26) return false; m_identifier[0] = prefix[0]; m_identifier[1] = prefix[1]; m_identifier[2] = prefix[2]; m_identifier[3] = prefix[3]; m_startOfDocument = readU32(prefix+4); m_productType = prefix[8]; m_fileType = prefix[9]; m_majorVersion = prefix[10]; m_minorVersion = prefix[11]; m_encryptionKey = readU16(prefix+12); m_startOfPacketData = readU16(prefix+14); WPG_DEBUG_MSG(("Header Identifier = %c%c%c\n", m_identifier[1], m_identifier[2],m_identifier[3])); WPG_DEBUG_MSG(("Product type = 0x%x\n", m_productType)); WPG_DEBUG_MSG(("File type = 0x%x\n", m_fileType)); WPG_DEBUG_MSG(("Major version = 0x%x\n", m_majorVersion)); WPG_DEBUG_MSG(("Minor version = 0x%x\n", m_minorVersion)); WPG_DEBUG_MSG(("Encryption key = 0x%x\n", m_encryptionKey)); return true; } bool WPGHeader::isSupported() const { return ( (m_identifier[0] == 0xFF) && (m_identifier[1] == 'W') && (m_identifier[2] == 'P') && (m_identifier[3] == 'C') && (m_productType == 0x01) && (m_fileType == 0x16) && (m_encryptionKey == 0x00) && // we don't support encryption ((m_majorVersion == 0x02) || (m_majorVersion == 0x01)) && (m_minorVersion == 0x00) ); } unsigned long WPGHeader::startOfDocument() const { return m_startOfDocument; } int WPGHeader::majorVersion() const { return m_majorVersion; } --- WPG2Record.cpp DELETED --- Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 28 Jan 2005 10:23:09 -0000 1.4 +++ Makefile.am 17 Jun 2006 08:11:53 -0000 1.5 @@ -28,9 +28,15 @@ lib_LTLIBRARIES = libwpg-1.la libwpg_1_includedir = $(includedir)/libwpg-1/libwpg libwpg_1_include_HEADERS = \ - wpglistener.h \ - libwpg.h \ - libwpg_exception.h + libwpg.h \ + WPGraphics.h \ + WPGColor.h \ + WPGPen.h \ + WPGBrush.h \ + WPGPoint.h \ + WPGRect.h \ + WPGStream.h \ + WPGPaintInterface.h AM_CXXFLAGS = $(LIBWPG_CXXFLAGS) $(DEBUG_CXXFLAGS) @@ -38,24 +44,24 @@ libwpg_1_la_DEPENDENCIES = @LIBWPG_WIN32_RESOURCE@ libwpg_1_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_1_la_SOURCES = \ - WPG1Record.cpp \ - WPG2Record.cpp \ - WPGXRecord.cpp \ + WPGraphics.cpp \ + WPGStream.cpp \ + WPGPen.cpp \ + WPGPoint.cpp \ + WPGHeader.cpp \ + WPGXParser.cpp \ WPG1Parser.cpp \ WPG2Parser.cpp \ - WPGXParser.cpp \ - wpgheader.cpp \ - libwpg.cpp \ - libwpg_utils.cpp \ + libwpg.h \ + libwpg_utils.h \ + WPGColor.h \ + WPGPen.h \ + WPGBrush.h \ + WPGHeader.h \ + WPGXParser.h \ WPG1Parser.h \ WPG2Parser.h \ - WPGXParser.h \ - WPG1Record.h \ - WPG2Record.h \ - WPGXRecord.h \ - wpgheader.h \ - libwpg_defaults.h \ - libwpg_utils.h + WPGPaintInterface.h if OS_WIN32 --- NEW FILE: WPGPoint.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGPoint.h" #include <vector> namespace libwpg { class WPGPointArrayPrivate { public: std::vector<WPGPoint> points; }; } using namespace libwpg; WPGPointArray::WPGPointArray() { d = new WPGPointArrayPrivate; } WPGPointArray::~WPGPointArray() { delete d; } WPGPointArray::WPGPointArray(const WPGPointArray& pa) { d = new WPGPointArrayPrivate; d->points = pa.d->points; } WPGPointArray& WPGPointArray::operator=(const WPGPointArray& pa) { d->points = pa.d->points; return *this; } unsigned WPGPointArray::count() const { return d->points.size(); } WPGPoint& WPGPointArray::at(unsigned i) { return d->points[i]; } const WPGPoint& WPGPointArray::at(unsigned i) const { return d->points[i]; } const WPGPoint& WPGPointArray::operator[](unsigned i) const { return d->points[i]; } void WPGPointArray::add(const WPGPoint& p) { d->points.push_back(p); } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPG2Parser.cpp 31 Jan 2005 11:37:47 -0000 1.4 +++ WPG2Parser.cpp 17 Jun 2006 08:11:53 -0000 1.5 @@ -1,6 +1,7 @@ /* libwpg - * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) + * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * Copyright (C) 2005 Fridrich Strba (fri...@bl...) + * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -13,8 +14,9 @@ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 */ @@ -23,47 +25,811 @@ * Corel Corporation or Corel Corporation Limited." */ -#include <gsf/gsf-input.h> -#include "libwpg.h" -#include "libwpg_defaults.h" -#include "libwpg_utils.h" -#include "WPG2Record.h" #include "WPG2Parser.h" +#include "WPGPaintInterface.h" +#include "libwpg_utils.h" -WPG2Parser::WPG2Parser(GsfInput *input, WPGListener* listener): - WPGXParser(input, listener), - m_exit(false), - m_input(input), - m_listener(listener) +class WPG2Parser::ObjectCharacterization +{ +public: + bool taper; + bool translate; + bool skew; + bool scale; + bool rotate; + bool hasObjectId; + bool editLock; + bool filled; + bool closed; + bool framed; + + unsigned long objectId; + unsigned long lockFlags; + long rotationAngle; + long sxcos; + long sycos; + long kxsin; + long kysin; + long txinteger; + short txfraction; + long tyinteger; + short tyfraction; + long px; + long py; + + ObjectCharacterization(): + taper(false), + translate(false), + skew(false), + scale(false), + rotate(false), + hasObjectId(false), + editLock(false), + objectId(0), + lockFlags(0), + filled(false), + closed(false), + framed(true), + rotationAngle(0), + sxcos(0), + sycos(0), + kxsin(0), + kysin(0), + txinteger(0), + txfraction(0), + tyinteger(0), + tyfraction(0), + px(0), + py(0) + {} +}; + + +WPG2Parser::WPG2Parser(WPGInputStream *input, WPGPaintInterface* painter): + WPGXParser(input, painter), + m_success(true), m_exit(false), + m_xres(1200), m_yres(1200), + m_xofs(0), m_yofs(0), + m_width(0), m_height(0), + m_doublePrecision(false), + m_layerOpened(false), m_layerId(0) { } -void WPG2Parser::parse() +bool WPG2Parser::parse() { - WPG_DEBUG_MSG(("input: %p, listener: %p\n", m_input, m_listener)); + typedef void (WPG2Parser::*Method)(); - // start mainloop - while (!gsf_input_eof(m_input) && !m_exit) { - // create record from stream - WPG2RecordHeader record(m_input); + struct RecordHandler + { + int type; + const char *name; + Method handler; + }; - // check for record type - unsigned int nextPosition = gsf_input_tell(m_input) + record.GetLength(); - switch (record.GetType()) { - case 0x01: // Start WPG - WPG_DEBUG_MSG(("Start WPG record: class=%d, type=%d, extension=%d, length=%d\n", record.GetClass(), record.GetType(), record.GetExtension(), record.GetLength())); - m_listener->StartDocument(0.0f, 0.0f); - break; - case 0x02: // End WPG - WPG_DEBUG_MSG(("End WPG record: class=%d, type=%d, extension=%d, length=%d\n", record.GetClass(), record.GetType(), record.GetExtension(), record.GetLength())); - m_listener->EndDocument(); - m_exit=true; // Exit always after the "End WPG" record. Even though file may contain garbage after. - break; - default: - WPG_DEBUG_MSG(("unsupported record: class=%d, type=%d, extension=%d, length=%d\n", record.GetClass(), record.GetType(), record.GetExtension(), record.GetLength())); - break; + static const struct RecordHandler handlers[] = + { + { 0x01, "Start WPG", &WPG2Parser::handleStartWPG }, + { 0x02, "End WPG", &WPG2Parser::handleEndWPG }, + { 0x03, "Form Settings", 0 }, // ignored + { 0x04, "Ruler Settings", 0 }, // ignored + { 0x05, "Grid Settings", 0 }, // ignored + { 0x06, "Layer", &WPG2Parser::handleLayer }, + { 0x08, "Pen Style Definition", &WPG2Parser::handlePenStyleDefinition }, + { 0x09, "Pattern Definition", 0 }, + { 0x0a, "Comment", 0 }, // ignored + { 0x0b, "Color Transfer", 0 }, + { 0x0c, "Color Palette", &WPG2Parser::handleColorPalette }, + { 0x0d, "DP Color Palette", &WPG2Parser::handleDPColorPalette }, + { 0x0e, "Bitmap Data", 0 }, + { 0x0f, "Text Data", 0 }, + { 0x10, "Chart Style", 0 }, // ignored + { 0x11, "Chart Data", 0 }, // ignored + { 0x12, "Object Image", 0 }, + { 0x15, "Polyline", &WPG2Parser::handlePolyline }, + { 0x16, "Polyspline", 0 }, + { 0x17, "Polycurve", &WPG2Parser::handlePolycurve }, + { 0x18, "Rectangle", &WPG2Parser::handleRectangle }, + { 0x19, "Arc", &WPG2Parser::handleArc }, + { 0x1a, "Compound Polygon", 0 }, + { 0x1b, "Bitmap", 0 }, + { 0x1c, "Text Line", 0 }, + { 0x1d, "Text Block", 0 }, + { 0x1e, "Text Path", 0 }, + { 0x1f, "Chart", 0 }, + { 0x20, "Group", 0 }, + { 0x21, "Object Capsule", 0 }, + { 0x22, "Font Settings", 0 }, + { 0x25, "Pen Fore Color", &WPG2Parser::handlePenForeColor }, + { 0x26, "DP Pen Fore Color", &WPG2Parser::handleDPPenForeColor }, + { 0x27, "Pen Back Color", &WPG2Parser::handlePenBackColor }, + { 0x28, "DP Pen Back Color", &WPG2Parser::handleDPPenBackColor }, + { 0x29, "Pen Style", &WPG2Parser::handlePenStyle }, + { 0x2a, "Pen Pattern", 0 }, + { 0x2b, "Pen Size", &WPG2Parser::handlePenSize }, + { 0x2c, "DP Pen Size", &WPG2Parser::handleDPPenSize }, + { 0x2d, "Line Cap", 0 }, + { 0x2e, "Line Join", 0 }, + { 0x2f, "Brush Gradient", 0 }, + { 0x30, "DP Brush Gradient", 0 }, + { 0x31, "Brush Fore Color", &WPG2Parser::handleBrushForeColor }, + { 0x32, "DP Brush Fore Color", &WPG2Parser::handleDPBrushForeColor }, + { 0x33, "Brush Back Color", &WPG2Parser::handleBrushBackColor }, + { 0x34, "DP Brush Back Color", &WPG2Parser::handleDPBrushBackColor }, + { 0x35, "Brush Pattern", &WPG2Parser::handleBrushPattern }, + { 0x36, "Horizontal Line", 0 }, + { 0x37, "Vertical Line", 0 }, + { 0x38, "Poster Settings", 0 }, + { 0x39, "Image State", 0 }, + { 0x3a, "Envelope Definition", 0 }, + { 0x3b, "Envelope", 0 }, + { 0x3c, "Texture Definition", 0 }, + { 0x3d, "Brush Texture", 0 }, + { 0x3e, "Texture Alignment", 0 }, + { 0x3f, "Pen Texture ", 0 }, + { 0x00, 0, 0 } // end marker + }; + + // initialization + m_success = true; + m_exit = false; + m_xres = m_yres = 1200; + m_doublePrecision = false; + m_layerOpened = false; + + // default style + m_pen.foreColor = WPGColor(0,0,0); + m_pen.backColor = WPGColor(0,0,0); + m_pen.width = 0.001; + m_pen.height = 0.001; + m_pen.solid = true; + m_pen.dashArray = WPGDashArray(); + m_brush.foreColor = WPGColor(0,0,0); + m_brush.backColor = WPGColor(0,0,0); + + while(!m_input->atEnd()) + { + long recordPos = m_input->tell(); + int recordClass = readU8(); + int recordType = readU8(); + int extension = readVariableLengthInteger(); + int length = readVariableLengthInteger(); + long nextPos = m_input->tell() + length; + + // search function to handler this record + int index = -1; + for(int i = 0; (index < 0) && handlers[i].name; i++) + if(handlers[i].type == recordType) + index = i; + + WPG_DEBUG_MSG(("\n")); + if(index < 0) + WPG_DEBUG_MSG(("Unknown record type 0x%02x at %d size %d\n", + recordType, recordPos, length)); + else + { + Method recordHandler = handlers[index].handler; + if(!recordHandler) + WPG_DEBUG_MSG(("Record '%s' (ignored) type 0x%02x at %d size %d\n", + handlers[index].name, recordType, recordPos, length)); + else + { + WPG_DEBUG_MSG(("Record '%s' type 0x%02x at %d size %d\n", + handlers[index].name, recordType, recordPos, length)); + + // invoke the handler for this record + (this->*recordHandler)(); + } } - gsf_input_seek(m_input, nextPosition, G_SEEK_SET); + //if(m_input->tell() > nextPos) + { + //WPG_DEBUG_MSG(("Record 0x%x consumes more bytes than necessary!\n", recordType)); + WPG_DEBUG_MSG(("Current stream position: %d\n", m_input->tell())); + } + + if(m_exit) break; + + m_input->seek(nextPos); + } + + return m_success; +} + +static const char* describePrecision(unsigned char precision) +{ + const char* result = "Unknown"; + switch(precision) + { + case 0: result = "single"; break; + case 1: result = "double"; break; + default: break; + } + return result; +} + +static const char* describeGradient(unsigned char gradientType) +{ + const char* result = "Unknown"; + switch(gradientType) + { + case 0: result = "None"; break; + case 1: result = "Linear"; break; + case 2: result = "Polygonal"; break; + case 3: result = "Concentric Circles"; break; + case 4: result = "Convergent Circles"; break; + case 5: result = "Concentric Ellipses"; break; + case 6: result = "Convergent Ellipses"; break; + case 7: result = "Concentric Squares"; break; + case 8: result = "Convergent Squares"; break; + case 9: result = "Concentric Rectangles"; break; + case 10: result = "Convergent Rectangles"; break; + default: break; + } + return result; +} + +#define TO_DOUBLE(x) ( (m_doublePrecision) ? ((double)(x)/65536.0) : (double)(x) ) +#define TRANSFORM_XY(x,y) { (x)-= m_xofs; (y)-= m_yofs; (y)=m_height-(y); } + +void WPG2Parser::handleStartWPG() +{ + unsigned int horizontalUnit = readU16(); + unsigned int verticalUnit = readU16(); + unsigned char precision = readU8(); + + // sanity check + m_xres = horizontalUnit; + m_yres = verticalUnit; + if((horizontalUnit==0) || (verticalUnit==0)) + { + m_xres = m_yres = 1200; + WPG_DEBUG_MSG(("Warning ! Insane unit of measure")); + } + + // danger if we do not recognize the precision code + if(precision != 0) + if(precision != 1) + { + m_success = false; + m_exit = true; + return; + } + m_doublePrecision = (precision == 1); + + unsigned long viewportX1 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long viewportY1 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long viewportX2 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long viewportY2 = (m_doublePrecision) ? readU32() : readU16(); + + unsigned long imageX1 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long imageY1 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long imageX2 = (m_doublePrecision) ? readU32() : readU16(); + unsigned long imageY2 = (m_doublePrecision) ? readU32() : readU16(); + + // used to adjust coordinates + m_xofs = imageX1; + m_yofs = imageY1; + m_width = imageX2-imageX1; + m_height = imageY2-imageY1; + + WPG_DEBUG_MSG(("StartWPG\n")); + WPG_DEBUG_MSG((" Horizontal unit of measure : %d pixels/inch\n", horizontalUnit)); + WPG_DEBUG_MSG((" Vertical unit of measure : %d pixels/inch\n", verticalUnit)); + WPG_DEBUG_MSG((" Data precision : %d (%s)\n", precision, describePrecision(precision))); + WPG_DEBUG_MSG((" Viewport X1 : %d\n", viewportX1)); + WPG_DEBUG_MSG((" Viewport Y1 : %d\n", viewportY1)); + WPG_DEBUG_MSG((" Viewport X2 : %d\n", viewportX2)); + WPG_DEBUG_MSG((" Viewport Y2 : %d\n", viewportY2)); + WPG_DEBUG_MSG((" Image X1 : %d\n", imageX1)); + WPG_DEBUG_MSG((" Image Y1 : %d\n", imageY1)); + WPG_DEBUG_MSG((" Image X2 : %d\n", imageX2)); + WPG_DEBUG_MSG((" Image Y2 : %d\n", imageY2)); + + double width = (TO_DOUBLE(imageX2)-TO_DOUBLE(imageX1)) / m_xres; + double height = (TO_DOUBLE(imageY2)-TO_DOUBLE(imageY1)) / m_yres; + + m_painter->startDocument(width, height); + + static const int WPG2_defaultPenDashes[] = { + 1, 291, 0, // style #0 (actually solid) + 1, 218, 73, // style #1 + 1, 145, 73, // style #2 + 1, 73, 73, // style #3 + 1, 36, 36, // style #4 + 1, 18, 18, // style #5 + 1, 18, 55, // style #6 + 3, 18, 55, 18, 55, 18, 127, // style #7 + 2, 164, 55, 18, 55, // style #8 + 3, 145, 36, 138, 36, 18, 36, // style #9 + 3, 91, 55, 91, 55, 18, 55, // style #10 + 4, 91, 36, 91, 36, 18, 36, 18, 36, // style #11 + 2, 182, 73, 73, 73, // style #12 + 3, 182, 36, 55, 36, 55, 36, // style #13 + 3, 255, 73, 255, 73, 73, 73, // style #14 + 4, 273, 36, 273, 36, 55, 36, 55, 36, // style #15 + 0 // end marker + }; + + // create default pen styles + int styleNo = 0; + for(int i = 0; i < sizeof(WPG2_defaultPenDashes)/sizeof(WPG2_defaultPenDashes[0]);) + { + int segments = 2 * WPG2_defaultPenDashes[i++]; + if(segments == 0) break; + WPGDashArray dashArray; + for(int j = 0; j < segments; j++, i++) + dashArray.add(WPG2_defaultPenDashes[i]*3.6/218.0); + m_penStyles[styleNo] = dashArray; + styleNo++; + } +} + +void WPG2Parser::handleEndWPG() +{ + // sentinel + if(m_layerOpened) + m_painter->endLayer(m_layerId); + + m_painter->endDocument(); + m_exit = true; + + WPG_DEBUG_MSG(("EndWPG\n")); +} + +void WPG2Parser::handleLayer() +{ + m_layerId = readU16(); + + // close previous one + if(m_layerOpened) + m_painter->endLayer(m_layerId); + + m_painter->startLayer(m_layerId); + m_layerOpened = true; + + WPG_DEBUG_MSG(("Layer\n")); + WPG_DEBUG_MSG((" Id: %d\n", m_layerId)); +} + +void WPG2Parser::handlePenStyleDefinition() +{ + unsigned int style = readU16(); + unsigned int segments = readU16(); + + WPGDashArray dashArray; + for(int i = 0; i < segments; i++) + { + unsigned int p = (m_doublePrecision) ? readU32() : readU16(); + unsigned int q = (m_doublePrecision) ? readU32() : readU16(); + dashArray.add(TO_DOUBLE(p)*3.6/218.0); + dashArray.add(TO_DOUBLE(q)*3.6/218.0); + } + m_penStyles[style] = dashArray; + + WPG_DEBUG_MSG(("PenStyleDefinition\n")); + WPG_DEBUG_MSG((" Style : %d\n", style)); + WPG_DEBUG_MSG((" Segment pairs : %d\n", segments)); +} + +// TODO +void WPG2Parser::handlePatternDefinition() +{ + WPG_DEBUG_MSG(("PatternDefinition\n")); +} + +void WPG2Parser::handleColorPalette() +{ + unsigned startIndex = readU16(); + unsigned numEntries = readU16(); + + WPG_DEBUG_MSG(("Color Palette\n")); + for(int i = 0; i < numEntries; i++) + { + WPGColor color; + color.red = readU8(); + color.green = readU8(); + color.blue = readU8(); + m_colorPalette[startIndex+i] = color; + WPG_DEBUG_MSG(("Index#%d: RGB %d %d %d\n", startIndex+i, color.red, color.green, color.blue)); + } +} + +void WPG2Parser::handleDPColorPalette() +{ + unsigned startIndex = readU16(); + unsigned numEntries = readU16(); + + WPG_DEBUG_MSG(("Color Palette\n")); + for(int i = 0; i < numEntries; i++) + { + WPGColor color; + color.red = readU16() >> 8 ; + color.green = readU16() >> 8 ; + color.blue = readU16() >> 8 ; + m_colorPalette[startIndex+i] = color; + WPG_DEBUG_MSG(("Index#%d: RGB %d %d %d\n", startIndex+i, color.red, color.green, color.blue)); + } +} + +void WPG2Parser::handlePenForeColor() +{ + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + unsigned char alpha = readU8(); + + m_pen.foreColor = WPGColor(red, green, blue, alpha); + + WPG_DEBUG_MSG(("PenForeColor\n")); + WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleDPPenForeColor() +{ + unsigned int red = readU16(); + unsigned int green = readU16(); + unsigned int blue = readU16(); + unsigned int alpha = readU16(); + + // we just ignore the least significant 8 bits + m_pen.foreColor = WPGColor(red>>8, green>>8, blue>>8, alpha>>8); + + WPG_DEBUG_MSG(("PenForeColor\n")); + WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handlePenBackColor() +{ + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + unsigned char alpha = readU8(); + + m_pen.backColor = WPGColor(red, green, blue, alpha); + + WPG_DEBUG_MSG(("PenBackColor\n")); + WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleDPPenBackColor() +{ + unsigned int red = readU16(); + unsigned int green = readU16(); + unsigned int blue = readU16(); + unsigned int alpha = readU16(); + + // we just ignore the least significant 8 bits + m_pen.backColor = WPGColor(red>>8, green>>8, blue>>8, alpha>>8); + + WPG_DEBUG_MSG(("PenBackColor\n")); + WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handlePenStyle() +{ + unsigned int style = readU16(); + + m_pen.dashArray = m_penStyles[style]; + m_pen.solid = (style == 0); + + WPG_DEBUG_MSG(("PenStyle\n")); + WPG_DEBUG_MSG((" Pen style : %d\n", style)); + WPG_DEBUG_MSG((" Segments : %d\n", m_pen.dashArray.count())); +} + +void WPG2Parser::handlePenSize() +{ + unsigned int width = readU16(); + unsigned int height = readU16(); + + m_pen.width = TO_DOUBLE(width) / m_xres; + m_pen.height = TO_DOUBLE(height) / m_yres; + + WPG_DEBUG_MSG(("PenSize\n")); + WPG_DEBUG_MSG((" Width: %d\n", width)); + WPG_DEBUG_MSG((" Height: %d\n", height)); +} + +void WPG2Parser::handleDPPenSize() +{ + unsigned long width = readU32(); + unsigned long height = readU32(); + + m_pen.width = TO_DOUBLE(width) / m_xres / 256; + m_pen.height = TO_DOUBLE(height) / m_yres / 256; + + WPG_DEBUG_MSG(("PenSize\n")); + WPG_DEBUG_MSG((" Width: %d\n", width)); + WPG_DEBUG_MSG((" Height: %d\n", height)); +} + +void WPG2Parser::handleBrushForeColor() +{ + unsigned char gradientType = readU8(); + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + unsigned char alpha = readU8(); + + m_brush.foreColor = WPGColor(red, green, blue, alpha); + if(m_brush.style == WPGBrush::NoBrush) + m_brush.style = WPGBrush::Solid; + + WPG_DEBUG_MSG(("BrushForeColor\n")); + WPG_DEBUG_MSG((" Gradient type : %d (%s)\n", gradientType, describeGradient(gradientType))); + WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleDPBrushForeColor() +{ + unsigned char gradientType = readU8(); + unsigned int red = readU16(); + unsigned int green = readU16(); + unsigned int blue = readU16(); + unsigned int alpha = readU16(); + + // we just ignore the least significant 8 bits + m_brush.foreColor = WPGColor(red>>8, green>>8, blue>>8, alpha>>8); + if(m_brush.style == WPGBrush::NoBrush) + m_brush.style = WPGBrush::Solid; + + WPG_DEBUG_MSG(("BrushForeColor\n")); + WPG_DEBUG_MSG((" Gradient type : %d (%s)\n", gradientType, describeGradient(gradientType))); + WPG_DEBUG_MSG((" Foreground color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleBrushBackColor() +{ + unsigned char red = readU8(); + unsigned char green = readU8(); + unsigned char blue = readU8(); + unsigned char alpha = readU8(); + + m_brush.backColor = WPGColor(red, green, blue, alpha); + if(m_brush.style == WPGBrush::NoBrush) + m_brush.style = WPGBrush::Solid; + + WPG_DEBUG_MSG(("BrushBackColor\n")); + WPG_DEBUG_MSG((" Backround color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleDPBrushBackColor() +{ + unsigned int red = readU16(); + unsigned int green = readU16(); + unsigned int blue = readU16(); + unsigned int alpha = readU16(); + + // we just ignore the least significant 8 bits + m_brush.backColor = WPGColor(red>>8, green>>8, blue>>8, alpha>>8); + if(m_brush.style == WPGBrush::NoBrush) + m_brush.style = WPGBrush::Solid; + + WPG_DEBUG_MSG(("PenBackColor\n")); + WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); +} + +void WPG2Parser::handleBrushPattern() +{ + unsigned int pattern = readU16(); + + // TODO + + WPG_DEBUG_MSG(("BrushPattern\n")); + WPG_DEBUG_MSG((" Pattern : %d\n", pattern)); +} + +void WPG2Parser::parseCharacterization(ObjectCharacterization* ch) +{ + // sanity check + if(!ch) return; + + unsigned int flags = readU16(); + ch->taper = (flags & 0x01) != 0; + ch->translate = (flags & 0x02) != 0; + ch->skew = (flags & 0x04) != 0; + ch->scale = (flags & 0x08) != 0; + ch->rotate = (flags & 0x10) != 0; + ch->hasObjectId = (flags & 0x20) != 0; + ch->editLock = (flags & 0x80) != 0; + ch->filled = (flags & (1<<13)) != 0; + ch->closed = (flags & (1<<14)) != 0; + ch->framed = (flags & (1<<15)) != 0; + + if(ch->editLock) ch->lockFlags = readU32(); + + // object ID can be 2 or 4 bytes + if(ch->hasObjectId) ch->objectId = readU16(); + if(ch->objectId >> 15) ch->objectId = ((ch->objectId & 0x7fff) << 16) | readU16(); + + if(ch->rotate) ch->rotationAngle = readS32(); + + if(ch->rotate || ch->scale) + { + ch->sxcos = readS32(); + ch->sycos = readS32(); } + + if(ch->rotate || ch->skew) + { + ch->kxsin = readS32(); + ch->kysin = readS32(); + } + + if(ch->translate) + { + ch->txfraction = readU16(); + ch->txinteger = readS32(); + ch->tyfraction = readU16(); + ch->tyinteger = readS32(); + } + + if(ch->taper) + { + ch->px = readS32(); + ch->py = readS32(); + } + + WPG_DEBUG_MSG(("ObjectCharacterization\n")); + WPG_DEBUG_MSG((" taper : %s\n", (ch->taper ? "yes" : "no"))); + WPG_DEBUG_MSG((" translate : %s\n", (ch->translate ? "yes" : "no"))); + WPG_DEBUG_MSG((" skew : %s\n", (ch->skew ? "yes" : "no"))); + WPG_DEBUG_MSG((" scale : %s\n", (ch->scale ? "yes" : "no"))); + WPG_DEBUG_MSG((" rotate : %s\n", (ch->rotate ? "yes" : "no"))); + WPG_DEBUG_MSG((" hasObjectId : %s\n", (ch->hasObjectId ? "yes" : "no"))); + WPG_DEBUG_MSG((" editLock : %s\n", (ch->editLock ? "yes" : "no"))); + if(ch->editLock) WPG_DEBUG_MSG((" lock flags : 0x%x\n", ch->lockFlags)); + if(ch->hasObjectId) WPG_DEBUG_MSG((" object ID : 0x%x\n", ch->objectId)); + if(ch->translate) WPG_DEBUG_MSG((" tx ty : %d %d\n", ch->txinteger, ch->tyinteger)); + if(ch->translate) WPG_DEBUG_MSG((" tx ty : %d %d\n", ch->txfraction, ch->tyfraction)); +} + +void WPG2Parser::handlePolyline() +{ + ObjectCharacterization objCh; + parseCharacterization(&objCh); + + unsigned long count = readU16(); + + WPGPointArray points; + for(unsigned long i = 0; i < count; i++ ) + { + long x = (m_doublePrecision) ? readU32() : readU16(); + long y = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(x,y); + points.add(WPGPoint(TO_DOUBLE(x)/m_xres, TO_DOUBLE(y)/m_yres)); + } + + m_painter->setBrush( objCh.filled ? m_brush : WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : WPGPen() ); + m_painter->drawPolyline(points); + + WPG_DEBUG_MSG(("Polyline\n")); + WPG_DEBUG_MSG((" Vertices count : %d\n", count)); + for(int i = 0; i < count; i++ ) + WPG_DEBUG_MSG((" Point #%d : %g,%g\n", i+1, points[i].x, points[i].y)); } + +void WPG2Parser::handlePolycurve() +{ + ObjectCharacterization objCh; + parseCharacterization(&objCh); + + unsigned int count = readU16(); + + WPGPointArray vertices; + WPGPointArray controlPoints; + for(int i = 0; i < count; i++ ) + { + long ix = (m_doublePrecision) ? readU32() : readU16(); + long iy = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(ix,iy); + WPGPoint initialPoint( TO_DOUBLE(ix)/m_xres, TO_DOUBLE(iy)/m_yres ); + + long ax = (m_doublePrecision) ? readU32() : readU16(); + long ay = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(ax,ay); + WPGPoint anchorPoint( TO_DOUBLE(ax)/m_xres, TO_DOUBLE(ay)/m_yres ); + + long tx = (m_doublePrecision) ? readU32() : readU16(); + long ty = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(tx,ty); + WPGPoint terminalPoint( TO_DOUBLE(tx)/m_xres, TO_DOUBLE(ty)/m_yres ); + + vertices.add(anchorPoint); + if(i > 0) + controlPoints.add(initialPoint); + controlPoints.add(terminalPoint); + } + + m_painter->setBrush( objCh.filled ? m_brush : WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : WPGPen() ); + m_painter->drawCurve(vertices, controlPoints); +} + +void WPG2Parser::handleRectangle() +{ + ObjectCharacterization objCh; + parseCharacterization(&objCh); + + long x1 = (m_doublePrecision) ? readU32() : readU16(); + long y1 = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(x1,y1); + + long x2 = (m_doublePrecision) ? readU32() : readU16(); + long y2 = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(x2,y2); + + long xs1 = (x1 <= x2) ? x1 : x2; + long xs2 = (x1 <= x2) ? x2 : x1; + long ys1 = (y1 <= y2) ? y1 : y2; + long ys2 = (y1 <= y2) ? y2 : y1; + + unsigned long rx = (m_doublePrecision) ? readU32() : readU16(); + unsigned long ry = (m_doublePrecision) ? readU32() : readU16(); + + 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; + double roundx = TO_DOUBLE(rx)/m_xres; + double roundy = TO_DOUBLE(ry)/m_yres; + + m_painter->setBrush( objCh.filled ? m_brush : WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : WPGPen() ); + m_painter->drawRectangle(rect, roundx, roundy); + + WPG_DEBUG_MSG(("Rectangle\n")); + WPG_DEBUG_MSG((" X1 : %d\n", x1)); + WPG_DEBUG_MSG((" Y1 : %d\n", y1)); + WPG_DEBUG_MSG((" X2 : %d\n", x2)); + WPG_DEBUG_MSG((" Y2 : %d\n", y2)); + WPG_DEBUG_MSG((" Round X : %d\n", rx)); + WPG_DEBUG_MSG((" Round Y : %d\n", ry)); +} + +void WPG2Parser::handleArc() +{ + ObjectCharacterization objCh; + parseCharacterization(&objCh); + + unsigned long cx = (m_doublePrecision) ? readU32() : readU16(); + unsigned long cy = (m_doublePrecision) ? readU32() : readU16(); + + unsigned long radx = (m_doublePrecision) ? readU32() : readU16(); + unsigned long rady = (m_doublePrecision) ? readU32() : readU16(); + + long ix = (m_doublePrecision) ? readU32() : readU16(); + long iy = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(ix,iy); + + long ex = (m_doublePrecision) ? readU32() : readU16(); + long ey = (m_doublePrecision) ? readU32() : readU16(); + TRANSFORM_XY(ex,ey); + + if((ix==ex) && (iy==ey)) + { + 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; + + m_painter->setBrush( objCh.filled ? m_brush : WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : WPGPen() ); + m_painter->drawEllipse(center, rx, ry); + } + + WPG_DEBUG_MSG(("Arc\n")); + WPG_DEBUG_MSG((" Center point x : %d\n", cx)); + WPG_DEBUG_MSG((" Center point y : %d\n", cy)); + WPG_DEBUG_MSG((" Radius x : %d\n", radx)); + WPG_DEBUG_MSG((" Radius y : %d\n", rady)); + WPG_DEBUG_MSG((" Initial point x : %d\n", ix)); + WPG_DEBUG_MSG((" Initial point y : %d\n", iy)); + WPG_DEBUG_MSG((" End point x : %d\n", ex)); + WPG_DEBUG_MSG((" End point y : %d\n", ey)); +} + --- libwpg_exception.h DELETED --- --- WPG2Record.h DELETED --- --- libwpg_utils.cpp DELETED --- Index: WPGXParser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGXParser.cpp 24 May 2006 22:25:57 -0000 1.5 +++ WPGXParser.cpp 17 Jun 2006 08:11:53 -0000 1.6 @@ -1,149 +1,224 @@ -/* libwpg - * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) - * Copyright (C) 2005 Fridrich Strba (fri...@bl...) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For further information visit http://libwpg.sourceforge.net - */ - -/* "This product is not manufactured, approved, or supported by - * Corel Corporation or Corel Corporation Limited." - */ - -#include "WPGXParser.h" - -static const uint8_t defaultPaletteRed[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, - 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x33, 0x47, 0x61, 0x73, 0x87, 0x9C, 0xB0, 0xC7, - 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, -}; - -static const uint8_t defaultPaletteGreen[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, - 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x56, 0x64, 0x72, 0x80, 0x8E, 0x9C, 0xAA, 0xB1, - 0xB8, 0xBF, 0xC6, 0xCD, 0xD4, 0xDB, 0xE2, 0xE9, - 0x2B, 0x32, 0x39, 0x40, 0x47, 0x4E, 0x55, 0x63, - 0x71, 0x7F, 0x8D, 0x9B, 0xA9, 0xB7, 0xC5, 0xD3, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x29, 0x38, 0x45, 0x4F, 0x5C, 0x63, 0x69, 0xD4, - 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, -}; - -static const uint8_t defaultPaletteBlue[] = { - 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, - 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, - 0x2C, 0x42, 0x58, 0x6E, 0x84, 0x9A, 0xB0, 0xC6, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE9, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xB0, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x7B, 0x91, 0xA7, 0xBD, 0xD3, 0xE4, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x3D, 0x48, 0x53, 0x5E, 0x69, 0x74, 0x7F, 0x8A, - 0x95, 0xA0, 0xAB, 0xB6, 0xC1, 0xCC, 0xD7, 0xE2, - 0x11, 0x17, 0x1C, 0x24, 0x29, 0x2B, 0x2B, 0x30, - 0x47, 0x57, 0x69, 0x78, 0x8C, 0x9C, 0xB0, 0xC7, -}; - -WPGXParser::WPGXParser(GsfInput *input, WPGListener* listener): - m_lineColorIndex(0x00), - m_fillColorIndex(0x00), - m_lineWidth(1/72), - m_lineStyle(1), - m_fillStyle(1) -{ - RGBColor tempColor; - for (int i=0; i<256; i++) - { - tempColor.red = defaultPaletteRed[i]; - tempColor.green = defaultPaletteGreen[i]; - tempColor.blue = defaultPaletteBlue[i]; - m_colorPalette.push_back(tempColor); - } -} - +/* libwpg + * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) + * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) + * Copyright (C) 2005 Fridrich Strba (fri...@bl...) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02111-1301 USA + * + * For further information visit http://libwpg.sourceforge.net + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include "WPGXParser.h" + +using namespace libwpg; + +// FIXME (ariya) this color palette does not seem to be corre... [truncated message content] |
From: Ariya H. <ar...@us...> - 2006-06-17 08:20:55
|
Update of /cvsroot/libwpg/libwpg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18391 Modified Files: configure.in Log Message: fixed configure Index: configure.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/configure.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- configure.in 28 Jan 2005 10:23:02 -0000 1.2 +++ configure.in 17 Jun 2006 08:20:53 -0000 1.3 @@ -1,4 +1,4 @@ -AC_INIT(src/lib/libwpg.cpp) +AC_INIT(src/lib/WPGraphics.cpp) AM_CONFIG_HEADER(config.h) |
From: Ariya H. <ar...@us...> - 2006-06-17 08:13:14
|
Update of /cvsroot/libwpg/libwpg/src/conv/svg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14544/src/conv/svg Modified Files: main.cpp Log Message: - important records for WPG2 (pen, brush, lines, curve) - the listener is now PaintInterface, using PostScript-like rendering model - simplified SVG generation (due to the above PaintInterface) - fixed coding style to follow libwpd (tab-indentation, camelcase function names, correct file names, ...) - fixed FSF address - added notices on implementation details (first commit for my Google Summer of Code project) Index: main.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/svg/main.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- main.cpp 29 Apr 2006 19:56:53 -0000 1.9 +++ main.cpp 17 Jun 2006 08:11:53 -0000 1.10 @@ -1,4 +1,5 @@ /* libwpg + * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * Copyright (C) 2005 Fridrich Strba (fri...@bl...) * * This library is free software; you can redistribute it and/or @@ -22,165 +23,201 @@ * Corel Corporation or Corel Corporation Limited." */ -#include <gsf/gsf-utils.h> -#include <gsf/gsf-input-stdio.h> #include <stdio.h> -#include <libwpg.h> -class SvgListener : public WPGListener { +#include "libwpg.h" + +using namespace libwpg; + +class SvgPainter : public libwpg::WPGPaintInterface { public: - SvgListener() : m_imageHeight(0.0f) {} + SvgPainter(); + void startDocument(double imageWidth, double imageHeight); + void setPen(const WPGPen& pen); + void setBrush(const WPGBrush& brush); + void drawPolyline(const WPGPointArray& vertices); + void drawCurve(const WPGPointArray& vertices, const WPGPointArray& controlPoints); + void drawRectangle(const WPGRect& rect, double rx, double ry); + void drawEllipse(const WPGPoint& center, double rx, double ry); + void startLayer(unsigned int id); + void endLayer(unsigned int id); + void endDocument(); - void StartDocument(const float imageWidth, const float imageHeight) { - m_imageHeight = imageHeight; - printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"); - printf("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">"); - printf("<svg width=\"%.4f\" height=\"%.4f\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">", 72*imageWidth, 72*imageHeight); - } +private: + WPGPen m_pen; + WPGBrush m_brush; + void writeStyle(); +}; - void Line(const float startX, const float startY, const float endX, const float endY, const float lineWidth, - const unsigned char lineStyle, const RGBColor lineColor) { - printf("<line stroke=\""); - if (lineStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", lineColor.red, lineColor.green, lineColor.blue); - printf("stroke-width=\"%.4f\" fill=\"none\" x1=\"%.4f\" y1=\"%.4f\" x2=\"%.4f\"y2=\"%.4f\"/>", - 72*lineWidth, 72*startX, 72*(m_imageHeight - startY), 72*endX, 72*(m_imageHeight - endY)); - } +SvgPainter::SvgPainter() +{ +} - void Polyline(const std::vector <WPGPoint> &points, const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor) { - printf("<polyline stroke=\""); - if (lineStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", lineColor.red, lineColor.green, lineColor.blue); - printf("stroke-width=\"%.4f\" fill=\"none\" points=\"", 72*lineWidth); - for (std::vector<WPGPoint>::const_iterator iter=points.begin(); iter != points.end(); iter++) { - if (iter != points.begin()) - printf(" "); - printf("%.4f,%4f", 72*(*iter).x, 72*(m_imageHeight - (*iter).y)); - } - printf("\"/>"); - } +void SvgPainter::startDocument(double width, double height) +{ + printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"); + printf("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\""); + printf(" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); - void Rectangle(const float startX, const float startY, const float width, const float height, const float lineWidth, - const unsigned char lineStyle, const RGBColor lineColor, const unsigned char fillStyle, const RGBColor fillColor) { - printf("<rect stroke=\""); - if (lineStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", lineColor.red, lineColor.green, lineColor.blue); - printf("fill=\""); - if (fillStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", fillColor.red, fillColor.green, fillColor.blue); - printf("stroke-width=\"%.4f\" x=\"%.4f\" y=\"%.4f\" width=\"%.4f\" height=\"%.4f/>", - 72*lineWidth, 72*startX, 72*(m_imageHeight - startY), 72*width, 72*( -height)); - } + printf("<!-- Created with wpg2svg/libwpg %s -->\n", LIBWPG_VERSION_STRING); - void Polygon(const std::vector <WPGPoint> &points, const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor, - const unsigned char fillStyle, const RGBColor fillColor) { - printf("<polygon stroke=\""); - if (lineStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", lineColor.red, lineColor.green, lineColor.blue); - printf("fill=\""); - if (fillStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", fillColor.red, fillColor.green, fillColor.blue); - printf("stroke-width=\"%.4f\" points=\"", 72*lineWidth); - for (std::vector<WPGPoint>::const_iterator iter=points.begin(); iter != points.end(); iter++) { - if (iter != points.begin()) - printf(" "); - printf("%.4f,%4f", 72*(*iter).x, 72*(m_imageHeight - (*iter).y)); - } - printf("\"/>"); - } + printf("<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" "); + printf("width=\"%g\" height=\"%f\" >\n", 72*width, 72*height); +} - void Ellipse(const float centerX, const float centerY, const float radiusX, const float radiusY, const unsigned int rotationAngle, - const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor, const unsigned char fillStyle, const RGBColor fillColor) { - printf("<ellipse stroke=\""); - if (lineStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", lineColor.red, lineColor.green, lineColor.blue); - printf("fill=\""); - if (fillStyle == 0x00) - printf("none\" "); - else - printf("#%.2x%.2x%.2x\" ", fillColor.red, fillColor.green, fillColor.blue); - printf("stroke-width=\"%.4f\" ", 72*lineWidth); - if (rotationAngle != 0) - printf("transform=\"rotate(%i)\" ", 360-rotationAngle); - printf("cx=\"%.4f\" cy=\"%.4f\" rx=\"%.4f\" ry=\"%.4f\"/>", - 72*centerX, 72*(m_imageHeight - centerY), 72*radiusX, 72*radiusY); - } +void SvgPainter::setPen(const WPGPen& pen) +{ + m_pen = pen; +} - void EndDocument() { - printf("</svg>"); - } -private: - float m_imageHeight; -}; +void SvgPainter::setBrush(const WPGBrush& brush) +{ + m_brush = brush; +} -int main(int argc, char *argv[]) +// create "style" attribute based on current pen and brush +void SvgPainter::writeStyle() { - if (argc < 2) + printf("style=\""); + + const WPGColor& color = m_pen.foreColor; + printf("stroke-width: %f; ", 72*m_pen.width); + if(m_pen.width > 0.0) { - printf("usage: wpg2svg <WordPerfect Graphic>\n"); - return -1; + printf("stroke: rgb(%d,%d,%d); ", color.red, color.green, color.blue); + if(color.alpha != 0) + // alpha = 0 means opacity = 1.0, alpha = 256 means opacity = 0 + printf("stroke-opacity: %f; ", 1.0-(color.alpha/256.0)); } - gsf_init(); - GError *err; - GsfInput * input = GSF_INPUT(gsf_input_stdio_new (argv[1], &err)); - if (input == NULL) + if(!m_pen.solid) + { + printf("stroke-dasharray: "); + for(int i = 0; i < m_pen.dashArray.count(); i++) { - g_return_val_if_fail (err != NULL, 1); - - g_warning ("'%s' error: %s", argv[1], err->message); - g_error_free (err); - return 1; + printf("%f", 72*m_pen.dashArray.at(i)*m_pen.width); + if(i < m_pen.dashArray.count()-1) + printf(", "); } + printf("; "); + } + + if(m_brush.style == WPGBrush::NoBrush) + printf("fill: none; "); - WPGraphics * wpg = new(WPGraphics); + if(m_brush.style == WPGBrush::Solid) + printf("fill: rgb(%d,%d,%d); ", m_brush.foreColor.red, + m_brush.foreColor.green, m_brush.foreColor.blue); - bool isSupportedFormat = wpg->libwpg_file_supported(input); - if (!isSupportedFormat) - { - printf("ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); - return 1; - } + printf("\""); // style +} - SvgListener listener; - try - { - wpg->libwpg_parse(input, &listener); - } - catch (WPGInvalidInputException) +void SvgPainter::drawPolyline(const WPGPointArray& vertices) +{ + if(vertices.count() < 2) + return; + + if(vertices.count() == 2) { - printf("ERROR: Invalid input given!\n"); - return 1; + const WPGPoint& p1 = vertices[0]; + const WPGPoint& p2 = vertices[1]; + printf("<line "); + printf("x1=\"%f\" y1=\"%f\" ", 72*p1.x, 72*p1.y); + printf("x2=\"%f\" y2=\"%f\"\n", 72*p2.x, 72*p2.y); + writeStyle(); + printf("/>\n"); } - catch (WPGEndOfFileException) + else { - printf("ERROR: Unexpected end of file!\n"); - return 1; + printf("<polyline "); + printf("points=\""); + for(unsigned i = 0; i < vertices.count(); i++) + { + printf("%f %f", 72*vertices[i].x, 72*vertices[i].y); + if(i < vertices.count()-1) printf(", "); + } + printf("\"\n"); + writeStyle(); + printf("/>\n"); } - catch (...) +} + +void SvgPainter::drawCurve(const WPGPointArray& vertices, const WPGPointArray& controlPoints) +{ + if(vertices.count() == 0) + return; + if(controlPoints.count() < vertices.count()*2-1) + return; + + printf("<path d=\""); + printf("M%f,%f \n", 72*vertices[0].x, 72*vertices[0].y ); + for(unsigned i = 1; i < vertices.count(); i++) { - printf("ERROR: Unknown Error!\n"); - return 1; + printf("C"); + printf("%f,%f ", 72*controlPoints[i*2-2].x, 72*controlPoints[i*2-2].y ); + printf("%f,%f ", 72*controlPoints[i*2-1].x, 72*controlPoints[i*2-1].y ); + printf("%f,%f", 72*vertices[i].x, 72*vertices[i].y ); + if(i < vertices.count()-1) + printf("\n"); } + printf("\" \n"); + writeStyle(); + printf("/>\n"); +} - gsf_shutdown(); +void SvgPainter::drawRectangle(const WPGRect& rect, double rx, double ry) +{ + printf("<rect "); + printf("x=\"%f\" y=\"%f\" ", 72*rect.x1, 72*rect.y1); + printf("width=\"%f\" height=\"%f\" ", 72*rect.width(), 72*rect.height()); + if((rx !=0) || (ry !=0)) + printf("rx=\"%f\" ry=\"%f\" ", 72*rx, 72*ry); + writeStyle(); + printf("/>\n"); +} - if (wpg) - delete wpg; +void SvgPainter::drawEllipse(const WPGPoint& center, double rx, double ry) +{ + printf("<ellipse "); + printf("cx=\"%f\" cy=\"%f\" ", 72*center.x, 72*center.y); + printf("rx=\"%f\" ry=\"%f\" ", 72*rx, 72*ry); + writeStyle(); + printf("/>\n"); +} + +void SvgPainter::startLayer(unsigned int id) +{ + printf("<g id=\"Layer%d\" >\n", id); +} +void SvgPainter::endLayer(unsigned int) +{ + printf("</g>\n"); +} + +void SvgPainter::endDocument() +{ + printf("</svg>\n"); +} + +int main(int argc, char *argv[]) +{ + if (argc < 2) + { + printf("usage: wpg2svg <WordPerfect Graphic>\n"); + return -1; + } + + const char* filename = argv[1]; + WPGFileStream* input = new WPGFileStream(filename); + if (!WPGraphics::isSupported(input)) + { + printf("ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); + return 1; + } + + SvgPainter painter; + WPGraphics::parse(input, &painter); + return 0; } |
From: Ariya H. <ar...@us...> - 2006-06-17 08:13:11
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14544/src/conv/raw Modified Files: main.cpp Log Message: - important records for WPG2 (pen, brush, lines, curve) - the listener is now PaintInterface, using PostScript-like rendering model - simplified SVG generation (due to the above PaintInterface) - fixed coding style to follow libwpd (tab-indentation, camelcase function names, correct file names, ...) - fixed FSF address - added notices on implementation details (first commit for my Google Summer of Code project) Index: main.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/main.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- main.cpp 1 Feb 2005 17:15:56 -0000 1.7 +++ main.cpp 17 Jun 2006 08:11:53 -0000 1.8 @@ -1,128 +1,130 @@ -/* libwpg - * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) - * Copyright (C) 2005 Fridrich Strba (fri...@bl...) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * For further information visit http://libwpg.sourceforge.net - */ - -/* "This product is not manufactured, approved, or supported by - * Corel Corporation or Corel Corporation Limited." - */ - -#include <gsf/gsf-utils.h> -#include <gsf/gsf-input-stdio.h> -#include <stdio.h> -#include <libwpg.h> - -class RawListener : public WPGListener { -public: - void StartDocument(const float width, const float height) { - printf("RawListener::StartDocument(width: %.4fin, height: %.4fin)\n", width, height); - } - - void Line(const float startX, const float startY, const float endX, const float endY, const float lineWidth, - const unsigned char lineStyle, const RGBColor lineColor) { - printf("RawListener::Line(startX: %.4fin, startY: %.4fin, endX: %.4fin, endY: %.4fin, lineWidth: %.4fin, lineStyle: %,2x, lineColor: #%.2x%.2x%.2x)\n", - startX, startY, endX, endY, lineWidth, lineStyle, lineColor.red, lineColor.green, lineColor.blue); - } - - void Polyline(const std::vector <WPGPoint> &points, const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor) { - printf("RawListener::Polyline(TODO: list of points, lineWidth: %.4fin, lineStyle: %.2x, lineColor: #%.2x%.2x%.2x)\n", - lineWidth, lineStyle, lineColor.red, lineColor.green, lineColor.blue); - } - - void Rectangle(const float startX, const float startY, const float width, const float height, const float lineWidth, - const unsigned char lineStyle, const RGBColor lineColor, const unsigned char fillStyle, const RGBColor fillColor) { - printf("RawListener::Rectangle(startX: %.4fin, startY: %.4fin, width: %.4fin, height: %.4fin, lineWidth: %.4fin, lineStyle: %.2x, lineColor: #%.2x%.2x%.2x, fillStyle: %.2x, fillColor: #%.2x%.2x%.2x)\n", - startX, startY, width, height, lineWidth, lineStyle, lineColor.red, lineColor.green, lineColor.blue, fillStyle, fillColor.red, fillColor.green, fillColor.blue); - } - - void Polygon(const std::vector <WPGPoint> &points, const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor, - const unsigned char fillStyle, const RGBColor fillColor) { - printf("RawListener::Polygon(TODO: list of points, lineWidth: %.4fin, lineStyle: %.2x, lineColor: #%.2x%.2x%.2x, fillStyle: %.2x, fillColor: #%.2x%.2x%.2x)\n", - lineWidth, lineStyle, lineColor.red, lineColor.green, lineColor.blue, fillStyle, fillColor.red, fillColor.green, fillColor.blue); - } - - void Ellipse(const float centerX, const float centerY, const float radiusX, const float radiusY, const unsigned int rotationAngle, - const float lineWidth, const unsigned char lineStyle, const RGBColor lineColor, const unsigned char fillStyle, const RGBColor fillColor) { - printf("RawListener::Ellipse(centerX: %.4fin, centerY: %.4fin, radiusX: %.4fin, radiusY: %.4fin, rotationAngle: %i, lineWidth: %.4fin, lineStyle: %.2x, lineColor: #%.2x%.2x%.2x, fillStyle: %.2x, fillColor: #%.2x%.2x%.2x)\n", - centerX, centerY, radiusX, radiusY, rotationAngle, lineWidth, lineStyle, lineColor.red, lineColor.green, lineColor.blue, fillStyle, fillColor.red, fillColor.green, fillColor.blue); - } - - void EndDocument() { - printf("RawListener::EndDocument()\n"); - } - -}; - -int main(int argc, char *argv[]) -{ - if (argc < 2) - { - printf("usage: wpg2raw <WordPerfect Graphic>\n"); - return -1; - } - gsf_init(); - - GError *err; - GsfInput * input = GSF_INPUT(gsf_input_stdio_new (argv[1], &err)); - if (input == NULL) - { - g_return_val_if_fail (err != NULL, 1); - - g_warning ("'%s' error: %s", argv[1], err->message); - g_error_free (err); - return 1; - } - - WPGraphics * wpg = new(WPGraphics); - - bool isSupportedFormat = wpg->libwpg_file_supported(input); - if (!isSupportedFormat) - { - printf("ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); - return 1; - } - - RawListener listener; - try - { - wpg->libwpg_parse(input, &listener); - } - catch (WPGInvalidInputException) - { - printf("ERROR: Invalid input given!\n"); - return 1; - } - catch (WPGEndOfFileException) - { - printf("ERROR: Unexpected end of file!\n"); - return 1; - } - catch (...) - { - printf("ERROR: Unknown Error!\n"); - return 1; - } - - gsf_shutdown(); - - if (wpg) - delete wpg; - - return 0; -} +/* libwpg + * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) + * Copyright (C) 2005 Fridrich Strba (fri...@bl...) + * Copyright (C) 2004 Marc Oude Kotte (ma...@so...) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02111-1301 USA + * + * For further information visit http://libwpg.sourceforge.net + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include <stdio.h> + +#include "libwpg.h" + +using namespace libwpg; + +class RawPainter : public libwpg::WPGPaintInterface { +public: + RawPainter(); + void startDocument(double imageWidth, double imageHeight); + void setPen(const WPGPen& pen); + void setBrush(const WPGBrush& brush); + void drawPolyline(const WPGPointArray& vertices); + void drawCurve(const WPGPointArray& vertices, const WPGPointArray& controlPoints); + void drawRectangle(const WPGRect& rect, double rx, double ry); + void drawEllipse(const WPGPoint& center, double rx, double ry); + void startLayer(unsigned int); + void endLayer(unsigned int); + void endDocument(); +}; + +RawPainter::RawPainter(): libwpg::WPGPaintInterface() +{ +} + +void RawPainter::startDocument(double width, double height) +{ + printf("RawPainter::startDocument(width: %.4fin, height: %.4fin)\n", width, height); +} + +void RawPainter::setPen(const WPGPen& pen) +{ + printf("RawPainter::setPen\n"); +} + +void RawPainter::setBrush(const WPGBrush& brush) +{ + printf("RawPainter::setBrush\n"); +} + +void RawPainter::drawPolyline(const WPGPointArray& 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); +} + +void RawPainter::drawCurve(const WPGPointArray& vertices, const WPGPointArray& controlPoints) +{ + printf("RawPainter::drawCurve %d vertices\n", vertices.count()); +} + +void RawPainter::drawRectangle(const WPGRect& rect, double rx, double ry) +{ + printf("RawPainter::drawRoundedRectangle "); + printf(" (%g %g)-(%g,%g)", rect.x1, rect.y1, rect.x2, rect.y2); + printf(" Roundndess: %g %g\n", rx, ry); +} + +void RawPainter::drawEllipse(const WPGPoint& center, double rx, double ry) +{ + printf("RawPainter::drawEllipse "); + printf(" Radius: %g %g\n", rx, ry); +} + +void RawPainter::startLayer(unsigned int id) +{ + printf("RawPainter::startLayer %d\n", id); +} + +void RawPainter::endLayer(unsigned int id) +{ + printf("RawPainter::endLayer %d\n", id); +} + +void RawPainter::endDocument() +{ + printf("RawPainter::endDocument\n"); +} + +int main(int argc, char *argv[]) +{ + if (argc < 2) + { + printf("usage: wpg2raw <WordPerfect Graphic>\n"); + return -1; + } + + const char* filename = argv[1]; + WPGFileStream* input = new WPGFileStream(filename); + if (!WPGraphics::isSupported(input)) + { + printf("ERROR: Unsupported file format (unsupported version) or file is encrypted!\n"); + return 1; + } + + RawPainter painter; + WPGraphics::parse(input, &painter); + + delete input; + return 0; +} + |
From: Ariya H. <ar...@us...> - 2006-06-17 08:12:50
|
Update of /cvsroot/libwpg/libwpg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14544 Added Files: NOTES Log Message: - important records for WPG2 (pen, brush, lines, curve) - the listener is now PaintInterface, using PostScript-like rendering model - simplified SVG generation (due to the above PaintInterface) - fixed coding style to follow libwpd (tab-indentation, camelcase function names, correct file names, ...) - fixed FSF address - added notices on implementation details (first commit for my Google Summer of Code project) --- NEW FILE: NOTES --- Notes of various issues Ariya Hidayat, June 2006 Parsing status for WPG1 ----------------------- Here is a list of WPG1 records and its parsing status: 0x01 Fill attributes implemented (partially) 0x02 Line attributes implemented (partially) 0x03 Marker attributes - 0x04 Polymarker - 0x05 Line implemented 0x06 Polyline implemented 0x07 Rectangle implemented 0x08 Polygon implemented 0x09 Ellipse implemented 0x0A Reserved ? 0x0B Bitmap (Type 1) - 0x0C Graphics text (Type 1) - 0x0D Graphics text attributes - 0x0E Color map - 0x0F Start of WPG data (Type 1) implemented 0x10 End of WPG data implemented 0x11 PostScript data follows (Type 1) ignored 0x12 Output attributes - 0x13 Curved polyline - 0x14 Bitmap (Type 2) - 0x15 Start figure ignored 0x16 Start chart ignored 0x17 PlanPerfect data ignored 0x18 Graphics text (Type 2) implemented 0x19 Start of WPG data (Type 2) - 0x1A Graphics text (Type 3) - 0x1B PostScript data follows (Type 2) - Legend: "-" : not implemented at all "implemented" : the record is fully parsed "ignored" : the record is recognized but not useful and thus ignored "?" : no documentation exists Parsing status for WPG2 ----------------------- Here is a list of WPG2 records and its parsing status: 0x01 Start WPG implemented 0x02 End WPG implemented 0x03 Form Settings ignored 0x04 Ruler Settings ignored 0x05 Grid Settings ignored 0x06 Layer implemented 0x07 Unknown/Reserved ? 0x08 Pen Style Definition implemented 0x09 Pattern Definition - 0x0a Comment ignored 0x0b Color Transfer implemented 0x0c Color Palette implemented 0x0d DP Color Palette - 0x0e Bitmap Data - 0x0f Text Data - 0x10 Chart Style ignored 0x11 Chart Data ignored 0x12 Object Image - 0x13 Unknown/Reserved ? 0x14 Unknown/Reserved ? 0x15 Polyline implemented 0x16 Polyspline - 0x17 Polycurve implemented 0x18 Rectangle implemented 0x19 Arc implemented 0x1a Compound Polygon - 0x1b Bitmap - 0x1c Text Line - 0x1d Text Block - 0x1e Text Path - 0x1f Chart ignored 0x20 Group - 0x21 Object Capsule - 0x22 Font Settings - 0x23 Unknown/Reserved ? 0x24 Unknown/Reserved ? 0x25 Pen Fore Color implemented 0x26 DP Pen Fore Color implemented 0x27 Pen Back Color implemented 0x28 DP Pen Back Color implemented 0x29 Pen Style implemented 0x2a Pen Pattern - 0x2b Pen Size implemented 0x2c DP Pen Size implemented 0x2d Line Cap - 0x2e Line Join - 0x2f Brush Gradient - 0x30 DP Brush Gradient - 0x31 Brush Fore Color implemented 0x32 DP Brush Fore Color implemented 0x33 Brush Back Color implemented 0x34 DP Brush Back Color implemented 0x35 Brush Pattern - 0x36 Horizontal Line ignored 0x37 Vertical Line ignored 0x38 Poster Settings ignored 0x39 Image State - 0x3a Envelope Definition ignored 0x3b Envelope ignored 0x3c Texture Definition - 0x3d Brush Texture - 0x3e Texture Alignment - 0x3f Pen Texture - Legend: "-" : not implemented at all "implemented" : the record is fully parsed "ignored" : the record is recognized but not useful and thus ignored "?" : no documentation exists WPG2 File Format Documentation Errata ------------------------------------- In "Pen Styles" section, style #8 is described as: 1: 164 (0xA4),55 (0x37),18 (0x12),55 (0x37) while it should be instead: 2: 164 (0xA4),55 (0x37),18 (0x12),55 (0x37) because this style consists of 2 (two) pair of segments, not only 1 (one). For "Order of Optional Characterization Data Fields", it is described as: {Edit lock flags}[Object ID] {Angle of rotation} {Sxcos() transformation element} {Sycos() transformation element} {Kxsin() transformation element} {Kysin() transformation element} {Tx transformation element (integer)} [Tx transformation element (fraction)] {Ty transformation element (integer)} [Ty transformation element (fraction)] {Px transformation element} {Py transformation element} However, the correct order (after reverse-engineering) seems to be: {Edit lock flags}[Object ID] {Angle of rotation} {Sxcos() transformation element} {Sycos() transformation element} {Kxsin() transformation element} {Kysin() transformation element} [Tx transformation element (fraction)] {Tx transformation element (integer)} [Ty transformation element (fraction)] {Ty transformation element (integer)} {Px transformation element} {Py transformation element} i.e. the fraction part (16-bit) of the transformation element comes before the integer part (32-bit). SVG (Scalable Vector Graphics) ------------------------------ The conversion tool wpg2svg can convert WPG file into SVG format. The SVG result may contain embedded comment such as: <!-- Created with wpg2svg/libwpg 0.2.0 --> This is intended so that when the file contains errors or bugs, the version of the converter can be traced back. |
From: Fridrich S. <str...@us...> - 2006-05-24 22:33:16
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26513/src/lib Modified Files: WPG1Parser.cpp Log Message: Small cleanup Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WPG1Parser.cpp 24 May 2006 22:25:57 -0000 1.7 +++ WPG1Parser.cpp 24 May 2006 22:33:06 -0000 1.8 @@ -60,17 +60,16 @@ WPG_DEBUG_MSG(("Fill attributes: type=%d, length=%d\n", record.GetType(), record.GetLength())); m_fillStyle = readU8(m_input); m_fillColorIndex = readU8(m_input); - WPG_DEBUG_MSG(("Fill attributes: fillStyle=0x%.2x, fillColorIndex=0x%.2x\n", m_fillStyle, m_fillColorIndex)); + WPG_DEBUG_MSG(("Fill attributes: fillStyle=0x%.2x, fillColorIndex=0x%.2x\n", m_fillStyle, m_fillColorIndex)); break; case 0x02: // Line attributes WPG_DEBUG_MSG(("Line attributes: type=%d, length=%d\n", record.GetType(), record.GetLength())); m_lineStyle = readU8(m_input); m_lineColorIndex = readU8(m_input); -// m_lineWidth = (float)((double)readU16(m_input)/(double)1200); -// m_lineWidth = (float)readU16(m_input)/72; - tmpLineWidth = readU16(m_input); - m_lineWidth = (float)((double)tmpLineWidth/(double)1200); - WPG_DEBUG_MSG(("Line attributes: lineStyle=0x%.2x, lineColorIndex=0x%.2x, lineWidth=%i\n", m_lineStyle, m_lineColorIndex, tmpLineWidth)); + tmpLineWidth = readU16(m_input); + m_lineWidth = (float)((double)tmpLineWidth/(double)1200); + WPG_DEBUG_MSG(("Line attributes: lineStyle=0x%.2x, lineColorIndex=0x%.2x, lineWidth=%i\n", + m_lineStyle, m_lineColorIndex, tmpLineWidth)); break; case 0x05: // Line WPG_DEBUG_MSG(("Line: type=%d, length=%d\n", record.GetType(), record.GetLength())); @@ -100,7 +99,7 @@ m_height = (float)((double)readU16(m_input)/(double)1200); WPG_DEBUG_MSG(("Line: x=%.4fin, y=%.4fin, width=%,4fin, height=%.4fin\n", m_startX, m_startY, m_width, m_height)); m_listener->Rectangle(m_startX, m_startY, m_width, m_height, m_lineWidth, m_lineStyle, m_colorPalette[m_lineColorIndex], - m_fillStyle, m_colorPalette[m_fillColorIndex]); + m_fillStyle, m_colorPalette[m_fillColorIndex]); break; case 0x08: // Polygon WPG_DEBUG_MSG(("Polygon: type=%d, length=%d\n", record.GetType(), record.GetLength())); @@ -111,7 +110,8 @@ tmpPts.push_back(tmpPoint); } m_points = tmpPts; - m_listener->Polygon(m_points, m_lineWidth, m_lineStyle, m_colorPalette[m_lineColorIndex], m_fillStyle, m_colorPalette[m_fillColorIndex]); + m_listener->Polygon(m_points, m_lineWidth, m_lineStyle, m_colorPalette[m_lineColorIndex], m_fillStyle, + m_colorPalette[m_fillColorIndex]); break; case 0x09: // Ellipse WPG_DEBUG_MSG(("Ellipse: type=%d, length=%d\n", record.GetType(), record.GetLength())); @@ -123,7 +123,7 @@ WPG_DEBUG_MSG(("Ellipse: cx=%.4fin, cy=%.4fin, rx=%.fin, ry=%.4fin, rotate(%d)\n", m_centerX, m_centerY, m_radiusX, m_radiusY, m_rotationAngle)); m_listener->Ellipse(m_centerX, m_centerY, m_radiusX, m_radiusY, m_rotationAngle, m_lineWidth, - m_lineStyle, m_colorPalette[m_lineColorIndex], m_fillStyle, m_colorPalette[m_fillColorIndex]); + m_lineStyle, m_colorPalette[m_lineColorIndex], m_fillStyle, m_colorPalette[m_fillColorIndex]); break; case 0x0E: // Color map WPG_DEBUG_MSG(("Color map: type=%d, length=%d\n", record.GetType(), record.GetLength())); |
From: Fridrich S. <str...@us...> - 2006-05-24 22:26:13
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24153/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPG1Record.cpp WPG1Record.h WPG2Record.cpp WPG2Record.h WPGXParser.cpp WPGXRecord.cpp WPGXRecord.h libwpg_utils.cpp libwpg_utils.h wpgheader.cpp wpgheader.h Log Message: For purposes of Google SoC, committing my work starting to remove gsf dependency Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPG1Parser.cpp 1 Feb 2005 17:15:58 -0000 1.6 +++ WPG1Parser.cpp 24 May 2006 22:25:57 -0000 1.7 @@ -58,35 +58,35 @@ switch (record.GetType()) { case 0x01: // Fill attributes WPG_DEBUG_MSG(("Fill attributes: type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_fillStyle = gsf_le_read_guint8(m_input); - m_fillColorIndex = gsf_le_read_guint8(m_input); + m_fillStyle = readU8(m_input); + m_fillColorIndex = readU8(m_input); WPG_DEBUG_MSG(("Fill attributes: fillStyle=0x%.2x, fillColorIndex=0x%.2x\n", m_fillStyle, m_fillColorIndex)); break; case 0x02: // Line attributes WPG_DEBUG_MSG(("Line attributes: type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_lineStyle = gsf_le_read_guint8(m_input); - m_lineColorIndex = gsf_le_read_guint8(m_input); -// m_lineWidth = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); -// m_lineWidth = (float)gsf_le_read_guint16(m_input)/72; - tmpLineWidth = gsf_le_read_guint16(m_input); + m_lineStyle = readU8(m_input); + m_lineColorIndex = readU8(m_input); +// m_lineWidth = (float)((double)readU16(m_input)/(double)1200); +// m_lineWidth = (float)readU16(m_input)/72; + tmpLineWidth = readU16(m_input); m_lineWidth = (float)((double)tmpLineWidth/(double)1200); WPG_DEBUG_MSG(("Line attributes: lineStyle=0x%.2x, lineColorIndex=0x%.2x, lineWidth=%i\n", m_lineStyle, m_lineColorIndex, tmpLineWidth)); break; case 0x05: // Line WPG_DEBUG_MSG(("Line: type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_startX = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_startY = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_endX = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_endY = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); + m_startX = (float)((double)readU16(m_input)/(double)1200); + m_startY = (float)((double)readU16(m_input)/(double)1200); + m_endX = (float)((double)readU16(m_input)/(double)1200); + m_endY = (float)((double)readU16(m_input)/(double)1200); WPG_DEBUG_MSG(("Line: x1=%,4fin, y1=%.4fin, x2=%,4fin, y2=%.4fin\n", m_startX, m_startY, m_endX, m_endY)); m_listener->Line(m_startX, m_startY, m_endX, m_endY, m_lineWidth, m_lineStyle, m_colorPalette[m_lineColorIndex]); break; case 0x06: // Polyline WPG_DEBUG_MSG(("Polyline: type=%d, length=%d\n", record.GetType(), record.GetLength())); - tmpNumPoints = gsf_le_read_guint16(m_input); + tmpNumPoints = readU16(m_input); for (int i=0; i<tmpNumPoints; i++) { - tmpPoint.x = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - tmpPoint.y = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); + tmpPoint.x = (float)((double)readU16(m_input)/(double)1200); + tmpPoint.y = (float)((double)readU16(m_input)/(double)1200); tmpPts.push_back(tmpPoint); } m_points = tmpPts; @@ -94,20 +94,20 @@ break; case 0x07: // Rectangle WPG_DEBUG_MSG(("Rectangle: type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_startX = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_startY = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_width = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_height = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); + m_startX = (float)((double)readU16(m_input)/(double)1200); + m_startY = (float)((double)readU16(m_input)/(double)1200); + m_width = (float)((double)readU16(m_input)/(double)1200); + m_height = (float)((double)readU16(m_input)/(double)1200); WPG_DEBUG_MSG(("Line: x=%.4fin, y=%.4fin, width=%,4fin, height=%.4fin\n", m_startX, m_startY, m_width, m_height)); m_listener->Rectangle(m_startX, m_startY, m_width, m_height, m_lineWidth, m_lineStyle, m_colorPalette[m_lineColorIndex], m_fillStyle, m_colorPalette[m_fillColorIndex]); break; case 0x08: // Polygon WPG_DEBUG_MSG(("Polygon: type=%d, length=%d\n", record.GetType(), record.GetLength())); - tmpNumPoints = gsf_le_read_guint16(m_input); + tmpNumPoints = readU16(m_input); for (int i=0; i<tmpNumPoints; i++) { - tmpPoint.x = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - tmpPoint.y = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); + tmpPoint.x = (float)((double)readU16(m_input)/(double)1200); + tmpPoint.y = (float)((double)readU16(m_input)/(double)1200); tmpPts.push_back(tmpPoint); } m_points = tmpPts; @@ -115,11 +115,11 @@ break; case 0x09: // Ellipse WPG_DEBUG_MSG(("Ellipse: type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_centerX = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_centerY = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_radiusX = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_radiusY = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_rotationAngle = gsf_le_read_guint16(m_input); + m_centerX = (float)((double)readU16(m_input)/(double)1200); + m_centerY = (float)((double)readU16(m_input)/(double)1200); + m_radiusX = (float)((double)readU16(m_input)/(double)1200); + m_radiusY = (float)((double)readU16(m_input)/(double)1200); + m_rotationAngle = readU16(m_input); WPG_DEBUG_MSG(("Ellipse: cx=%.4fin, cy=%.4fin, rx=%.fin, ry=%.4fin, rotate(%d)\n", m_centerX, m_centerY, m_radiusX, m_radiusY, m_rotationAngle)); m_listener->Ellipse(m_centerX, m_centerY, m_radiusX, m_radiusY, m_rotationAngle, m_lineWidth, @@ -127,21 +127,21 @@ break; case 0x0E: // Color map WPG_DEBUG_MSG(("Color map: type=%d, length=%d\n", record.GetType(), record.GetLength())); - tmpColorMapStartIndex = gsf_le_read_guint16(m_input); - tmpColorMapNumEntries = gsf_le_read_guint16(m_input); + tmpColorMapStartIndex = readU16(m_input); + tmpColorMapNumEntries = readU16(m_input); for (int i=tmpColorMapStartIndex; i<tmpColorMapStartIndex+tmpColorMapNumEntries; i++) { - m_colorPalette[i].red = gsf_le_read_guint8(m_input); - m_colorPalette[i].green = gsf_le_read_guint8(m_input); - m_colorPalette[i].blue = gsf_le_read_guint8(m_input); + m_colorPalette[i].red = readU8(m_input); + m_colorPalette[i].green = readU8(m_input); + m_colorPalette[i].blue = readU8(m_input); } break; case 0x0F: // Start of WPG data WPG_DEBUG_MSG(("Start of WPG data (Type 1): type=%d, length=%d\n", record.GetType(), record.GetLength())); - m_versionFlags = gsf_le_read_guint8(m_input); - m_bitFlags = gsf_le_read_guint8(m_input); - m_width = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); - m_height = (float)((double)gsf_le_read_guint16(m_input)/(double)1200); + m_versionFlags = readU8(m_input); + m_bitFlags = readU8(m_input); + m_width = (float)((double)readU16(m_input)/(double)1200); + m_height = (float)((double)readU16(m_input)/(double)1200); WPG_DEBUG_MSG(("Start of WPG data (Type 1): width=%.4fin, height=%.4fin\n", m_width, m_height)); m_listener->StartDocument(m_width, m_height); break; Index: libwpg_utils.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg_utils.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- libwpg_utils.cpp 26 Jan 2004 13:51:38 -0000 1.1.1.1 +++ libwpg_utils.cpp 24 May 2006 22:25:57 -0000 1.2 @@ -28,19 +28,19 @@ #include "libwpg_utils.h" #include <gsf/gsf-utils.h> -guint8 gsf_le_read_guint8(GsfInput *input) +uint8_t readU8(GsfInput *input) { - return GSF_LE_GET_GUINT8(gsf_input_read(input, sizeof(guint8), NULL)); + return GSF_LE_GET_GUINT8(gsf_input_read(input, sizeof(uint8_t), NULL)); } -guint16 gsf_le_read_guint16(GsfInput *input) +uint16_t readU16(GsfInput *input) { - guint16 val = *(guint16 const *)gsf_input_read(input, sizeof(guint16), NULL); + uint16_t val = *(uint16_t const *)gsf_input_read(input, sizeof(uint16_t), NULL); return GSF_LE_GET_GUINT16(&val); } -guint32 gsf_le_read_guint32(GsfInput *input) +uint32_t readU32(GsfInput *input) { - guint32 val = *(guint32 const *)gsf_input_read(input, sizeof(guint32), NULL); + uint32_t val = *(uint32_t const *)gsf_input_read(input, sizeof(uint32_t), NULL); return GSF_LE_GET_GUINT32(&val); } Index: WPGXParser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXParser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPGXParser.cpp 1 Feb 2005 17:15:58 -0000 1.4 +++ WPGXParser.cpp 24 May 2006 22:25:57 -0000 1.5 @@ -25,7 +25,7 @@ #include "WPGXParser.h" -static const guint8 defaultPaletteRed[] = { +static const uint8_t defaultPaletteRed[] = { 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, @@ -60,7 +60,7 @@ 0xCC, 0xD4, 0xDB, 0xE3, 0xE8, 0xF0, 0xF7, 0xFF, }; -static const guint8 defaultPaletteGreen[] = { +static const uint8_t defaultPaletteGreen[] = { 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x7F, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, @@ -95,7 +95,7 @@ 0x87, 0x8F, 0x9C, 0xA8, 0xB3, 0xC4, 0xCF, 0xE0, }; -static const guint8 defaultPaletteBlue[] = { +static const uint8_t defaultPaletteBlue[] = { 0x00, 0xFF, 0x7F, 0xBF, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, Index: wpgheader.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/wpgheader.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wpgheader.cpp 25 Jan 2005 11:46:37 -0000 1.2 +++ wpgheader.cpp 24 May 2006 22:25:57 -0000 1.3 @@ -39,27 +39,27 @@ gsf_input_seek(input, 0, G_SEEK_SET); // read contents from stream - WPG_CHECK_EOF(input); m_prefix._header_identifier[0] = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._header_identifier[1] = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._header_identifier[2] = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._header_identifier[3] = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._start_of_document = gsf_le_read_guint32(input); - WPG_CHECK_EOF(input); m_prefix._product_type = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._file_type = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._major_version = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._minor_version = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._encryption_key = gsf_le_read_guint16(input); + WPG_CHECK_EOF(input); m_prefix._header_identifier[0] = readU8(input); + WPG_CHECK_EOF(input); m_prefix._header_identifier[1] = readU8(input); + WPG_CHECK_EOF(input); m_prefix._header_identifier[2] = readU8(input); + WPG_CHECK_EOF(input); m_prefix._header_identifier[3] = readU8(input); + WPG_CHECK_EOF(input); m_prefix._start_of_document = readU32(input); + WPG_CHECK_EOF(input); m_prefix._product_type = readU8(input); + WPG_CHECK_EOF(input); m_prefix._file_type = readU8(input); + WPG_CHECK_EOF(input); m_prefix._major_version = readU8(input); + WPG_CHECK_EOF(input); m_prefix._minor_version = readU8(input); + WPG_CHECK_EOF(input); m_prefix._encryption_key = readU16(input); switch (m_prefix._major_version) { case 0x01: // What follows is not in the documentation of WPG1 break; case 0x02: - WPG_CHECK_EOF(input); m_prefix._start_of_packetdata = gsf_le_read_guint16(input); - WPG_CHECK_EOF(input); m_prefix._entry_count = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._resource_complete = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_prefix._encryption_block_offset = gsf_le_read_guint16(input); - WPG_CHECK_EOF(input); m_prefix._filesize = gsf_le_read_guint32(input); - WPG_CHECK_EOF(input); m_prefix._encrypt_version = gsf_le_read_guint16(input); + WPG_CHECK_EOF(input); m_prefix._start_of_packetdata = readU16(input); + WPG_CHECK_EOF(input); m_prefix._entry_count = readU8(input); + WPG_CHECK_EOF(input); m_prefix._resource_complete = readU8(input); + WPG_CHECK_EOF(input); m_prefix._encryption_block_offset = readU16(input); + WPG_CHECK_EOF(input); m_prefix._filesize = readU32(input); + WPG_CHECK_EOF(input); m_prefix._encrypt_version = readU16(input); break; default: break; Index: WPG1Record.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Record.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPG1Record.h 27 Jan 2005 13:55:19 -0000 1.1 +++ WPG1Record.h 24 May 2006 22:25:57 -0000 1.2 @@ -35,10 +35,10 @@ public: WPG1RecordHeader(GsfInput *input); - guint8 GetClass() { return 0; } - guint8 GetType() { return m_record._type; } - guint32 GetExtension() { return 0; } - guint32 GetLength() { return m_record._length; } + uint8_t GetClass() { return 0; } + uint8_t GetType() { return m_record._type; } + uint32_t GetExtension() { return 0; } + uint32_t GetLength() { return m_record._length; } private: wpg_record_t m_record; }; Index: WPG1Record.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Record.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPG1Record.cpp 27 Jan 2005 13:55:19 -0000 1.1 +++ WPG1Record.cpp 24 May 2006 22:25:57 -0000 1.2 @@ -37,7 +37,7 @@ } // read record header from stream - WPG_CHECK_EOF(input); m_record._type = gsf_le_read_guint8(input); + WPG_CHECK_EOF(input); m_record._type = readU8(input); WPG_CHECK_EOF(input); m_record._length = ReadVariableLengthInteger(input); } Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WPG1Parser.h 28 Jan 2005 14:22:56 -0000 1.4 +++ WPG1Parser.h 24 May 2006 22:25:57 -0000 1.5 @@ -43,8 +43,8 @@ WPGListener *m_listener; // Start of WPG data (Type 1) - guint8 m_versionFlags; - guint8 m_bitFlags; + uint8_t m_versionFlags; + uint8_t m_bitFlags; // Ellipse float m_centerX; Index: WPGXRecord.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXRecord.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGXRecord.cpp 27 Jan 2005 13:55:19 -0000 1.1 +++ WPGXRecord.cpp 24 May 2006 22:25:57 -0000 1.2 @@ -33,20 +33,20 @@ { // read a byte WPG_CHECK_EOF(input); - guint8 value8 = gsf_le_read_guint8(input); + uint8_t value8 = readU8(input); // if it's in the range 0-0xFE, then we have a 8-bit value if (value8<=0xFE) { return value8; } else { // now read a 16 bit value WPG_CHECK_EOF(input); - guint16 value16 = gsf_le_read_guint16(input); + uint16_t value16 = readU16(input); // if the MSB is 1, we have a 32 bit value if (value16>>15) { // read the next 16 bit value (LSB part, in value16 resides the MSB part) WPG_CHECK_EOF(input); - guint16 lvalue16 = gsf_le_read_guint16(input); - guint32 value32 = value16 & 0x7fff; // mask out the MSB + uint16_t lvalue16 = readU16(input); + uint32_t value32 = value16 & 0x7fff; // mask out the MSB return (value32<<16)+lvalue16; } else { // we have a 16 bit value, return it Index: libwpg_utils.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg_utils.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- libwpg_utils.h 26 Jan 2004 13:51:38 -0000 1.1.1.1 +++ libwpg_utils.h 24 May 2006 22:25:57 -0000 1.2 @@ -27,6 +27,18 @@ #include <gsf/gsf-input.h> +#ifdef _MSC_VER +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +#else /* _MSC_VER */ +#include <inttypes.h> +#endif /* _MSC_VER */ + + // some error checking macros #define WPG_CHECK_EOF(input) if (gsf_input_eof(input)) { WPG_DEBUG_MSG(("WPG_CHECK_EOF @ line %d\n", __LINE__)); throw WPGEndOfFileException(); } @@ -43,8 +55,8 @@ #endif // cross platform utility functions, so things should work on non Intel cpu's -guint8 gsf_le_read_guint8(GsfInput *input); -guint16 gsf_le_read_guint16(GsfInput *input); -guint32 gsf_le_read_guint32(GsfInput *input); +uint8_t readU8(GsfInput *input); +uint16_t readU16(GsfInput *input); +uint32_t readU32(GsfInput *input); #endif Index: WPG2Record.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Record.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPG2Record.cpp 27 Jan 2005 13:55:19 -0000 1.1 +++ WPG2Record.cpp 24 May 2006 22:25:57 -0000 1.2 @@ -37,8 +37,8 @@ } // read record header from stream - WPG_CHECK_EOF(input); m_record._class = gsf_le_read_guint8(input); - WPG_CHECK_EOF(input); m_record._type = gsf_le_read_guint8(input); + WPG_CHECK_EOF(input); m_record._class = readU8(input); + WPG_CHECK_EOF(input); m_record._type = readU8(input); WPG_CHECK_EOF(input); m_record._extension = ReadVariableLengthInteger(input); WPG_CHECK_EOF(input); m_record._length = ReadVariableLengthInteger(input); } Index: WPGXRecord.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGXRecord.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGXRecord.h 27 Jan 2005 13:55:20 -0000 1.1 +++ WPGXRecord.h 24 May 2006 22:25:57 -0000 1.2 @@ -28,20 +28,21 @@ #include <gsf/gsf-input.h> #include <stdio.h> +#include "libwpg_utils.h" typedef struct wpg_record_t { - guint8 _class; - guint8 _type; - guint32 _extension; - guint32 _length; + uint8_t _class; + uint8_t _type; + uint32_t _extension; + uint32_t _length; } wpg_record_t; class WPGXRecordHeader { public: - virtual guint8 GetClass() = 0; - virtual guint8 GetType() = 0; - virtual guint32 GetExtension() = 0; - virtual guint32 GetLength() = 0; + virtual uint8_t GetClass() = 0; + virtual uint8_t GetType() = 0; + virtual uint32_t GetExtension() = 0; + virtual uint32_t GetLength() = 0; protected: unsigned int ReadVariableLengthInteger(GsfInput *input); Index: wpgheader.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/wpgheader.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wpgheader.h 25 Jan 2005 11:46:37 -0000 1.2 +++ wpgheader.h 24 May 2006 22:25:57 -0000 1.3 @@ -27,21 +27,22 @@ #include <gsf/gsf-input.h> #include <stdio.h> +#include "libwpg_utils.h" typedef struct wpg_prefix_t { - guint8 _header_identifier[4]; // should always be 0xFF followed by "WPC" - guint32 _start_of_document; // index into file - guint8 _product_type; // should always be 1 for WPG files - guint8 _file_type; // should always be 22 for WPG files - guint8 _major_version; // 2 for WPG 8.0 files - guint8 _minor_version; // 0 for WPG 8.0 files - guint16 _encryption_key; // 0 when not encrypted - guint16 _start_of_packetdata; // unused, since according to the docs no packets are defined - guint8 _entry_count; // number of entries in extension - guint8 _resource_complete; // resource completeness indicator - guint16 _encryption_block_offset; // encryption block offset - guint32 _filesize; // size of the entire wpg file - guint16 _encrypt_version; // encryption version information + uint8_t _header_identifier[4]; // should always be 0xFF followed by "WPC" + uint32_t _start_of_document; // index into file + uint8_t _product_type; // should always be 1 for WPG files + uint8_t _file_type; // should always be 22 for WPG files + uint8_t _major_version; // 2 for WPG 8.0 files + uint8_t _minor_version; // 0 for WPG 8.0 files + uint16_t _encryption_key; // 0 when not encrypted + uint16_t _start_of_packetdata; // unused, since according to the docs no packets are defined + uint8_t _entry_count; // number of entries in extension + uint8_t _resource_complete; // resource completeness indicator + uint16_t _encryption_block_offset; // encryption block offset + uint32_t _filesize; // size of the entire wpg file + uint16_t _encrypt_version; // encryption version information } wpg_prefix_t; class WPGHeader { @@ -53,7 +54,7 @@ unsigned int GetStartOfDocument() { return m_prefix._start_of_document; } unsigned int GetMajorVersion() { return m_prefix._major_version; } private: - wpg_prefix_t m_prefix; + wpg_prefix_t m_prefix; }; #endif Index: WPG2Record.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Record.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPG2Record.h 27 Jan 2005 13:55:19 -0000 1.1 +++ WPG2Record.h 24 May 2006 22:25:57 -0000 1.2 @@ -35,10 +35,10 @@ public: WPG2RecordHeader(GsfInput *input); - guint8 GetClass() { return m_record._class; } - guint8 GetType() { return m_record._type; } - guint32 GetExtension() { return m_record._extension; } - guint32 GetLength() { return m_record._length; } + uint8_t GetClass() { return m_record._class; } + uint8_t GetType() { return m_record._type; } + uint32_t GetExtension() { return m_record._extension; } + uint32_t GetLength() { return m_record._length; } private: wpg_record_t m_record; }; |
From: Fridrich S. <str...@us...> - 2006-05-24 12:02:41
|
Update of /cvsroot/libwpg/CVSROOT In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27362 Modified Files: loginfo Log Message: We want to receive unified diffs :-) Index: loginfo =================================================================== RCS file: /cvsroot/libwpg/CVSROOT/loginfo,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** loginfo 13 May 2006 13:02:33 -0000 1.2 --- loginfo 24 May 2006 12:02:12 -0000 1.3 *************** *** 25,28 **** # or #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog ! DEFAULT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} lib...@li... ALL /usr/bin/perl $CVSROOT/CVSROOT/ciabot_cvs.pl %{,,,s} $USER --- 25,28 ---- # or #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog ! DEFAULT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail -u %{sVv} lib...@li... ALL /usr/bin/perl $CVSROOT/CVSROOT/ciabot_cvs.pl %{,,,s} $USER |
From: Fridrich S. <str...@us...> - 2006-05-13 13:04:47
|
Update of /cvsroot/libwpg/libwpg In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18878 Modified Files: AUTHORS Log Message: Add some more people to authors Index: AUTHORS =================================================================== RCS file: /cvsroot/libwpg/libwpg/AUTHORS,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AUTHORS 26 Jan 2004 13:51:32 -0000 1.1.1.1 --- AUTHORS 13 May 2006 13:04:36 -0000 1.2 *************** *** 1,7 **** CREDITS ! Current maintainer and author of libwpg --------------------------------------------- Marc Oude Kotte (ma...@so...) Contributors --- 1,9 ---- CREDITS ! Current maintainers and authors of libwpg --------------------------------------------- Marc Oude Kotte (ma...@so...) + Marc Maurer (uw...@uw...) + Fridrich Strba (fri...@bl...) Contributors *************** *** 11,13 **** Thanks ------ ! To William and Marc from libwpd, 'cause they allowed me to steal - with permission - some code snippets from their libwpd \ No newline at end of file --- 13,15 ---- Thanks ------ ! To William and Marc from libwpd, 'cause they allowed me to steal - with permission - some code snippets from their libwpd |