You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(31) |
Jul
(37) |
Aug
(20) |
Sep
(20) |
Oct
(16) |
Nov
(10) |
Dec
(16) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(11) |
May
(136) |
Jun
(61) |
Jul
(42) |
Aug
(21) |
Sep
(25) |
Oct
(43) |
Nov
(5) |
Dec
(24) |
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(11) |
May
|
Jun
|
Jul
(51) |
Aug
(6) |
Sep
|
Oct
|
Nov
(21) |
Dec
(35) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(10) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(35) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
From: Fridrich S. <str...@us...> - 2008-07-22 15:35:28
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8288/src/lib Modified Files: WPG2Parser.cpp Log Message: prevent some invalid reads Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -r1.74 -r1.75 --- WPG2Parser.cpp 22 Jul 2008 15:26:48 -0000 1.74 +++ WPG2Parser.cpp 22 Jul 2008 15:32:24 -0000 1.75 @@ -1186,8 +1186,8 @@ void WPG2Parser::handlePolyspline() { - // fprintf(stderr, "This is actually not an error, just a crash so that we know \ - // that there is an actual document containing the Polyspline record\n"); + // fprintf(stderr, "This is actually not an error, just a crash so that we know "); + // fprintf(stderr, "that there is an actual document containing the Polyspline record\n"); // crash here !!! // *((int *)NULL) = 0; if (!m_graphicsStarted) @@ -1498,7 +1498,7 @@ { unsigned count = 1 + readU8(); for( ; count ; --count ) - for(unsigned j = 0; j < data_size; j++) + for(unsigned j = 0; j < data_size && !m_input->atEOS(); j++) *ptr++ = 0; } @@ -1509,7 +1509,7 @@ unsigned count = 1 + readU8(); for( ; count ; --count ) - for(unsigned j = 0; j < data_size; j++) + for(unsigned j = 0; j < data_size && !m_input->atEOS(); j++) *ptr++ = 255; } @@ -1518,7 +1518,7 @@ { unsigned count = 1 + readU8(); for( ; count; --count) - for(unsigned j = 0; j < data_size; j++) + for(unsigned j = 0; j < data_size && !m_input->atEOS(); j++) *ptr++ = data[j]; } @@ -1547,7 +1547,7 @@ else if(opcode >= 0x80) { unsigned count = 1 + (opcode & 0x7f); - for(unsigned i = 0; i < data_size; i++) + for(unsigned i = 0; i < data_size && !m_input->atEOS(); i++) data[i] = readU8(); for( ; count; --count) for(unsigned j = 0; j < data_size; j++) @@ -1559,7 +1559,7 @@ { unsigned count = opcode + 1; for( ; count; --count) - for(unsigned j = 0; j < data_size; j++) + for(unsigned j = 0; j < data_size && !m_input->atEOS(); j++) *ptr++ = readU8(); } |
From: Fridrich S. <str...@us...> - 2008-07-22 15:26:52
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6014/src/lib Modified Files: WPG2Parser.cpp Log Message: remove the crash as not to inflict sum1 unnecessary sufferings and supoerfluous injuries Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -r1.73 -r1.74 --- WPG2Parser.cpp 22 Jul 2008 12:51:03 -0000 1.73 +++ WPG2Parser.cpp 22 Jul 2008 15:26:48 -0000 1.74 @@ -1186,10 +1186,10 @@ void WPG2Parser::handlePolyspline() { - fprintf(stderr, "This is actually not an error, just a crash so that we know \ - that there is an actual document containing the Polyspline record\n"); + // fprintf(stderr, "This is actually not an error, just a crash so that we know \ + // that there is an actual document containing the Polyspline record\n"); // crash here !!! - *((int *)NULL) = 0; + // *((int *)NULL) = 0; if (!m_graphicsStarted) return; // We have never seen a polyspline in a WPG file and we are not even able to generate |
From: Fridrich S. <str...@us...> - 2008-07-22 12:51:11
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12536/src/lib Modified Files: WPG2Parser.cpp Log Message: build in a crash so that we get a document that contains polyspline Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- WPG2Parser.cpp 22 Jul 2008 06:39:27 -0000 1.72 +++ WPG2Parser.cpp 22 Jul 2008 12:51:03 -0000 1.73 @@ -1186,6 +1186,10 @@ void WPG2Parser::handlePolyspline() { + fprintf(stderr, "This is actually not an error, just a crash so that we know \ + that there is an actual document containing the Polyspline record\n"); + // crash here !!! + *((int *)NULL) = 0; if (!m_graphicsStarted) return; // We have never seen a polyspline in a WPG file and we are not even able to generate |
From: Fridrich S. <str...@us...> - 2008-07-22 06:39:48
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3131/src/lib Modified Files: Tag: STABLE-0-1-0 WPG2Parser.cpp WPG2Parser.h Log Message: we never saw a polyspline, we don't manage to generate it. So, we simply draw a polyline instead and wait for bug reports to give us some more information Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.58.2.10 retrieving revision 1.58.2.11 diff -u -d -r1.58.2.10 -r1.58.2.11 --- WPG2Parser.cpp 18 Jul 2008 13:12:17 -0000 1.58.2.10 +++ WPG2Parser.cpp 22 Jul 2008 06:39:43 -0000 1.58.2.11 @@ -266,7 +266,7 @@ { 0x11, "Chart Data", 0 }, // ignored { 0x12, "Object Image", &WPG2Parser::handleObjectImage }, { 0x15, "Polyline", &WPG2Parser::handlePolyline }, - { 0x16, "Polyspline", 0 }, + { 0x16, "Polyspline", &WPG2Parser::handlePolyspline }, { 0x17, "Polycurve", &WPG2Parser::handlePolycurve }, { 0x18, "Rectangle", &WPG2Parser::handleRectangle }, { 0x19, "Arc", &WPG2Parser::handleArc }, @@ -1196,6 +1196,15 @@ WPG_DEBUG_MSG((" Point #%d : %g,%g\n", j+1, points[j].x, points[j].y)); } +void WPG2Parser::handlePolyspline() +{ + if (!m_graphicsStarted) + return; + // We have never seen a polyspline in a WPG file and we are not even able to generate + // one, so, we draw a polyline instead and wait for bug reports :) + handlePolyline(); +} + void WPG2Parser::handlePolycurve() { if (!m_graphicsStarted) Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.21.2.2 retrieving revision 1.21.2.3 diff -u -d -r1.21.2.2 -r1.21.2.3 --- WPG2Parser.h 9 Jul 2008 13:46:32 -0000 1.21.2.2 +++ WPG2Parser.h 22 Jul 2008 06:39:43 -0000 1.21.2.3 @@ -175,6 +175,7 @@ void handleBrushPattern(); void handlePolyline(); + void handlePolyspline(); void handlePolycurve(); void handleRectangle(); void handleArc(); |
From: Fridrich S. <str...@us...> - 2008-07-22 06:39:32
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3114/src/lib Modified Files: WPG2Parser.cpp WPG2Parser.h Log Message: we never saw a polyspline, we don't manage to generate it. So, we simply draw a polyline instead and wait for bug reports to give us some more information Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- WPG2Parser.cpp 18 Jul 2008 13:11:57 -0000 1.71 +++ WPG2Parser.cpp 22 Jul 2008 06:39:27 -0000 1.72 @@ -280,7 +280,7 @@ { 0x11, "Chart Data", 0 }, // ignored { 0x12, "Object Image", &WPG2Parser::handleObjectImage }, { 0x15, "Polyline", &WPG2Parser::handlePolyline }, - { 0x16, "Polyspline", 0 }, + { 0x16, "Polyspline", &WPG2Parser::handlePolyspline }, { 0x17, "Polycurve", &WPG2Parser::handlePolycurve }, { 0x18, "Rectangle", &WPG2Parser::handleRectangle }, { 0x19, "Arc", &WPG2Parser::handleArc }, @@ -1184,6 +1184,15 @@ WPG_DEBUG_MSG((" Point #%d : %g,%g\n", j+1, points[j].x, points[j].y)); } +void WPG2Parser::handlePolyspline() +{ + if (!m_graphicsStarted) + return; + // We have never seen a polyspline in a WPG file and we are not even able to generate + // one, so, we draw a polyline instead and wait for bug reports :) + handlePolyline(); +} + void WPG2Parser::handlePolycurve() { if (!m_graphicsStarted) Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- WPG2Parser.h 16 Jul 2008 09:57:28 -0000 1.24 +++ WPG2Parser.h 22 Jul 2008 06:39:27 -0000 1.25 @@ -175,6 +175,7 @@ void handleBrushPattern(); void handlePolyline(); + void handlePolyspline(); void handlePolycurve(); void handleRectangle(); void handleArc(); |
From: Fridrich S. <str...@us...> - 2008-07-18 13:12:23
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19149/src/lib Modified Files: Tag: STABLE-0-1-0 WPG2Parser.cpp WPGBitmap.cpp Log Message: when dumping bitmaps and binary objects, don't crash when the filesystem of the current directory is read-only for the given user Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.58.2.9 retrieving revision 1.58.2.10 diff -u -d -r1.58.2.9 -r1.58.2.10 --- WPG2Parser.cpp 9 Jul 2008 14:45:58 -0000 1.58.2.9 +++ WPG2Parser.cpp 18 Jul 2008 13:12:17 -0000 1.58.2.10 @@ -1871,12 +1871,15 @@ #if DUMP_BINARY_DATA std::ostringstream filename; filename << "binarydump" << m_binaryId++ << ".bin"; - FILE *f = fopen(filename.str().c_str(), "w"); - const char *tmpBinaryBuffer = binaryData.getDataBuffer(); - const size_t tmpBufferSize = binaryData.size(); - for (size_t k = 0; k < tmpBufferSize; k++) - fprintf(f, "%c",tmpBinaryBuffer[k]); - fclose(f); + FILE *f = fopen(filename.str().c_str(), "wb"); + if (f) + { + const char *tmpBinaryBuffer = binaryData.getDataBuffer(); + const size_t tmpBufferSize = binaryData.size(); + for (size_t k = 0; k < tmpBufferSize; k++) + fprintf(f, "%c",tmpBinaryBuffer[k]); + fclose(f); + } #endif Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.11.2.5 retrieving revision 1.11.2.6 diff -u -d -r1.11.2.5 -r1.11.2.6 --- WPGBitmap.cpp 9 Jul 2008 14:45:58 -0000 1.11.2.5 +++ WPGBitmap.cpp 18 Jul 2008 13:12:17 -0000 1.11.2.6 @@ -212,10 +212,13 @@ #if DUMP_BITMAP std::ostringstream filename; filename << "binarydump" << bitmapId++ << ".bmp"; - FILE *f = fopen("binarydump.bmp", "w"); - for (int k = 0; k < tmpDIBFileSize; k++) - fprintf(f, "%c",tmpDIBBuffer[k]); - fclose(f); + FILE *f = fopen("binarydump.bmp", "wb"); + if (f) + { + for (unsigned k = 0; k < tmpDIBFileSize; k++) + fprintf(f, "%c",tmpDIBBuffer[k]); + fclose(f); + } #endif // Cleanup things before returning |
From: Fridrich S. <str...@us...> - 2008-07-18 13:12:01
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18778/src/lib Modified Files: WPG2Parser.cpp WPGBitmap.cpp Log Message: when dumping bitmaps and binary objects, don't crash when the filesystem of the current directory is read-only for the given user Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- WPG2Parser.cpp 16 Jul 2008 14:10:59 -0000 1.70 +++ WPG2Parser.cpp 18 Jul 2008 13:11:57 -0000 1.71 @@ -1857,12 +1857,15 @@ #if DUMP_BINARY_DATA std::ostringstream filename; filename << "binarydump" << m_binaryId++ << ".bin"; - FILE *f = fopen(filename.str().c_str(), "w"); - const char *tmpBinaryBuffer = binaryData.getDataBuffer(); - const size_t tmpBufferSize = binaryData.size(); - for (size_t k = 0; k < tmpBufferSize; k++) - fprintf(f, "%c",tmpBinaryBuffer[k]); - fclose(f); + FILE *f = fopen(filename.str().c_str(), "wb"); + if (f) + { + const char *tmpBinaryBuffer = binaryData.getDataBuffer(); + const size_t tmpBufferSize = binaryData.size(); + for (size_t k = 0; k < tmpBufferSize; k++) + fprintf(f, "%c",tmpBinaryBuffer[k]); + fclose(f); + } #endif Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WPGBitmap.cpp 16 Jul 2008 09:57:28 -0000 1.19 +++ WPGBitmap.cpp 18 Jul 2008 13:11:57 -0000 1.20 @@ -211,10 +211,13 @@ #if DUMP_BITMAP std::ostringstream filename; filename << "binarydump" << bitmapId++ << ".bmp"; - FILE *f = fopen("binarydump.bmp", "w"); - for (unsigned k = 0; k < tmpDIBFileSize; k++) - fprintf(f, "%c",tmpDIBBuffer[k]); - fclose(f); + FILE *f = fopen("binarydump.bmp", "wb"); + if (f) + { + for (unsigned k = 0; k < tmpDIBFileSize; k++) + fprintf(f, "%c",tmpDIBBuffer[k]); + fclose(f); + } #endif // Cleanup things before returning |
From: Fridrich S. <str...@us...> - 2008-07-17 20:08:00
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22633/src/lib Modified Files: Tag: STABLE-0-1-0 WPGSVGGenerator.cpp Log Message: revert to polyline in svg Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -u -d -r1.11.2.2 -r1.11.2.3 --- WPGSVGGenerator.cpp 3 Apr 2008 09:25:39 -0000 1.11.2.2 +++ WPGSVGGenerator.cpp 17 Jul 2008 20:07:56 -0000 1.11.2.3 @@ -178,7 +178,7 @@ } else { - m_outputSink << "<polygon "; + m_outputSink << "<polyline "; m_outputSink << "points=\""; for(unsigned i = 0; i < vertices.count(); i++) { |
From: Fridrich S. <str...@us...> - 2008-07-17 15:38:58
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17394/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp Log Message: handle bitmaps with colour depth 2 and 4 in wpg1 Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.7 retrieving revision 1.33.2.8 diff -u -d -r1.33.2.7 -r1.33.2.8 --- WPG1Parser.cpp 17 Jul 2008 14:41:39 -0000 1.33.2.7 +++ WPG1Parser.cpp 17 Jul 2008 15:38:53 -0000 1.33.2.8 @@ -557,8 +557,8 @@ if (!raster_source || raster_source < buffer) return 0; for( ; count; --count) - for(unsigned r = 0; r < scanline_width && ptr < buffer + buffer_size; r++) - *ptr++ = raster_source[r]; + for(unsigned r = 0; r < scanline_width && ptr < buffer + buffer_size;) + *ptr++ = raster_source[r++]; } } } @@ -592,9 +592,36 @@ bitmap.setPixel(x, y, black); } } - - // 8-bit image: indexed color - if(depth == 8) + // 2-bit image: 4-color bitmap (indexed) + else if(depth == 2) + { + int i = 0; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++, i++) + { + if ((x==0) && (i % 4 != 0)) + i = (i/4 + 1) * 4; + unsigned index = ((buffer[i/4] & (0x03 << 2*(3 - (i % 4)))) >> 2*(3 - (i % 4))); + const libwpg::WPGColor& color = m_colorPalette[index]; + bitmap.setPixel(x, y, color); + } + } + // 4 -bit image: 16-colour bitmap (indexed) + else if(depth == 4) + { + int i = 0; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++, i++) + { + if ((x==0) && (i % 2 != 0)) + i = (i/2 + 1) * 2; + unsigned index = ((buffer[i/2] & (0x0f << 4*(1 - (i % 2)))) >> 4*(1 - (i % 2))); + const libwpg::WPGColor& color = m_colorPalette[index]; + bitmap.setPixel(x, y, color); + } + } + // 8-bit image: 256-colour image (indexed) + else if(depth == 8) { for(int y = 0; y < height; y++) { @@ -760,7 +787,7 @@ if (!m_graphicsStarted) return; #ifdef DEBUG - size_t lengthOfData = readU32(); + unsigned lengthOfData = readU32(); int rotation = readS16(); #else readU32(); |
From: Fridrich S. <str...@us...> - 2008-07-17 15:38:23
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17370/src/lib Modified Files: WPG1Parser.cpp Log Message: handle bitmaps with colour depth 2 and 4 in wpg1 Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- WPG1Parser.cpp 17 Jul 2008 14:41:57 -0000 1.41 +++ WPG1Parser.cpp 17 Jul 2008 15:38:19 -0000 1.42 @@ -558,8 +558,8 @@ if (!raster_source || raster_source < buffer) return 0; for( ; count; --count) - for(unsigned r = 0; r < scanline_width && ptr < buffer + buffer_size; r++) - *ptr++ = raster_source[r]; + for(unsigned r = 0; r < scanline_width && ptr < buffer + buffer_size;) + *ptr++ = raster_source[r++]; } } } @@ -593,9 +593,36 @@ bitmap.setPixel(x, y, black); } } - - // 8-bit image: indexed color - if(depth == 8) + // 2-bit image: 4-color bitmap (indexed) + else if(depth == 2) + { + int i = 0; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++, i++) + { + if ((x==0) && (i % 4 != 0)) + i = (i/4 + 1) * 4; + unsigned index = ((buffer[i/4] & (0x03 << 2*(3 - (i % 4)))) >> 2*(3 - (i % 4))); + const libwpg::WPGColor& color = m_colorPalette[index]; + bitmap.setPixel(x, y, color); + } + } + // 4 -bit image: 16-colour bitmap (indexed) + else if(depth == 4) + { + int i = 0; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++, i++) + { + if ((x==0) && (i % 2 != 0)) + i = (i/2 + 1) * 2; + unsigned index = ((buffer[i/2] & (0x0f << 4*(1 - (i % 2)))) >> 4*(1 - (i % 2))); + const libwpg::WPGColor& color = m_colorPalette[index]; + bitmap.setPixel(x, y, color); + } + } + // 8-bit image: 256-colour image (indexed) + else if(depth == 8) { for(int y = 0; y < height; y++) { @@ -761,7 +788,7 @@ if (!m_graphicsStarted) return; #ifdef DEBUG - size_t lengthOfData = readU32(); + unsigned lengthOfData = readU32(); int rotation = readS16(); #else readU32(); |
From: Fridrich S. <str...@us...> - 2008-07-17 14:42:00
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27880/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h Log Message: attempt to handle embedded postscript in WPG1 files (if I could at least have some documents to test with) Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPG1Parser.h 16 Jul 2008 09:57:28 -0000 1.16 +++ WPG1Parser.h 17 Jul 2008 14:41:57 -0000 1.17 @@ -58,6 +58,8 @@ void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth); void handleBitmapTypeOne(); void handleBitmapTypeTwo(); + void handlePostscriptTypeOne(); + void handlePostscriptTypeTwo(); void resetPalette(); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- WPG1Parser.cpp 16 Jul 2008 14:10:59 -0000 1.40 +++ WPG1Parser.cpp 17 Jul 2008 14:41:57 -0000 1.41 @@ -157,33 +157,33 @@ static const struct RecordHandler handlers[] = { - { 0x01, "Fill Attributes", &WPG1Parser::handleFillAttributes }, - { 0x02, "Line Attributes", &WPG1Parser::handleLineAttributes }, - { 0x03, "Marker Atttibutes", 0 }, - { 0x04, "Polymarker", 0 }, - { 0x05, "Line", &WPG1Parser::handleLine }, - { 0x06, "Polyline", &WPG1Parser::handlePolyline }, - { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, - { 0x08, "Polygon", &WPG1Parser::handlePolygon }, - { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, - { 0x0a, "Reserved", 0 }, - { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, - { 0x0c, "Graphics Text (Type 1)", 0 }, - { 0x0d, "Grephics Text Attributes", 0 }, - { 0x0e, "Colormap", &WPG1Parser::handleColormap }, - { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, - { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, - { 0x11, "Postscript Data Follows", 0 }, - { 0x12, "Output Attributes", 0 }, - { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, - { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, - { 0x15, "Start Figure", 0 }, - { 0x16, "Start Chart", 0 }, - { 0x17, "Planperfect Data", 0 }, - { 0x18, "Graphics Text (Type 2)", 0 }, - { 0x19, "Start WPG (Type 2)", 0 }, - { 0x1a, "Graphics Text (Type 3)", 0 }, - { 0x1b, "Ellipse", 0 }, + { 0x01, "Fill Attributes", &WPG1Parser::handleFillAttributes }, + { 0x02, "Line Attributes", &WPG1Parser::handleLineAttributes }, + { 0x03, "Marker Atttibutes", 0 }, + { 0x04, "Polymarker", 0 }, + { 0x05, "Line", &WPG1Parser::handleLine }, + { 0x06, "Polyline", &WPG1Parser::handlePolyline }, + { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, + { 0x08, "Polygon", &WPG1Parser::handlePolygon }, + { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, + { 0x0a, "Reserved", 0 }, + { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, + { 0x0c, "Graphics Text (Type 1)", 0 }, + { 0x0d, "Grephics Text Attributes", 0 }, + { 0x0e, "Colormap", &WPG1Parser::handleColormap }, + { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, + { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, + { 0x11, "Postscript Data (Type 1)", &WPG1Parser::handlePostscriptTypeOne }, + { 0x12, "Output Attributes", 0 }, + { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, + { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, + { 0x15, "Start Figure", 0 }, + { 0x16, "Start Chart", 0 }, + { 0x17, "Planperfect Data", 0 }, + { 0x18, "Graphics Text (Type 2)", 0 }, + { 0x19, "Start WPG (Type 2)", 0 }, + { 0x1a, "Graphics Text (Type 3)", 0 }, + { 0x1b, "Postscript Data (Type 2)", &WPG1Parser::handlePostscriptTypeTwo }, { 0x00, 0, 0 } // end marker }; @@ -734,6 +734,76 @@ } } +void WPG1Parser::handlePostscriptTypeOne() +{ + if (!m_graphicsStarted) + return; + long x1 = readS16(); + long y1 = readS16(); + long x2 = readS16(); + long y2 = readS16(); + libwpg::WPGBinaryData data; + data.rect.x1 = (double)x1/72.0; + data.rect.y1 = (double)m_height/1200.0 - (double)y1/72.0; + data.rect.x2 = (double)x2/72.0; + data.rect.y2 = (double)m_height/1200.0 - (double)y2/72.0; + + data.clear(); + while (m_input->tell() <= m_recordEnd) + data.append((char)readU8()); + data.mimeType = "application/x-postscript"; + if (data.size()) + m_painter->drawImageObject(data); +} + +void WPG1Parser::handlePostscriptTypeTwo() +{ + if (!m_graphicsStarted) + return; +#ifdef DEBUG + size_t lengthOfData = readU32(); + int rotation = readS16(); +#else + readU32(); + readS16(); +#endif + int x1 = readS16(); + int y1 = readS16(); + int x2 = readS16(); + int y2 = readS16(); + + WPG_DEBUG_MSG(("Postscript (Type 2)\n")); + WPG_DEBUG_MSG((" Length of Data: %d\n", lengthOfData)); + WPG_DEBUG_MSG((" Rotation Angle: %d\n", rotation)); + WPG_DEBUG_MSG((" Bottom left corner: %d,%d\n", x1, y1)); + WPG_DEBUG_MSG((" Top right corner: %d,%d\n", x2, y2)); + + y1 = m_height - y1; + y2 = m_height - 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; + WPG_DEBUG_MSG(("%li %li %li %li\n", xs1, ys1, xs2, ys2)); + + libwpg::WPGBinaryData data; + data.rect.x1 = (double)xs1/1200.0; + data.rect.y1 = (double)(ys1)/1200.0; + data.rect.x2 = (double)xs2/1200.0; + data.rect.y2 = (double)(ys2)/1200.0; + + data.mimeType = "image/x-eps"; + + m_input->seek(48, WPX_SEEK_CUR); + + data.clear(); + while (m_input->tell() <= m_recordEnd) + data.append((char)readU8()); + if (data.size()) + m_painter->drawImageObject(data); +} + void WPG1Parser::resetPalette() { m_colorPalette.clear(); |
From: Fridrich S. <str...@us...> - 2008-07-17 14:41:46
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27838/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp WPG1Parser.h Log Message: attempt to handle embedded postscript in WPG1 files (if I could at least have some documents to test with) Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -u -d -r1.15.2.1 -r1.15.2.2 --- WPG1Parser.h 16 Jul 2008 09:25:06 -0000 1.15.2.1 +++ WPG1Parser.h 17 Jul 2008 14:41:39 -0000 1.15.2.2 @@ -58,6 +58,8 @@ void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth); void handleBitmapTypeOne(); void handleBitmapTypeTwo(); + void handlePostscriptTypeOne(); + void handlePostscriptTypeTwo(); void resetPalette(); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.6 retrieving revision 1.33.2.7 diff -u -d -r1.33.2.6 -r1.33.2.7 --- WPG1Parser.cpp 16 Jul 2008 10:47:38 -0000 1.33.2.6 +++ WPG1Parser.cpp 17 Jul 2008 14:41:39 -0000 1.33.2.7 @@ -157,33 +157,33 @@ static const struct RecordHandler handlers[] = { - { 0x01, "Fill Attributes", &WPG1Parser::handleFillAttributes }, - { 0x02, "Line Attributes", &WPG1Parser::handleLineAttributes }, - { 0x03, "Marker Atttibutes", 0 }, - { 0x04, "Polymarker", 0 }, - { 0x05, "Line", &WPG1Parser::handleLine }, - { 0x06, "Polyline", &WPG1Parser::handlePolyline }, - { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, - { 0x08, "Polygon", &WPG1Parser::handlePolygon }, - { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, - { 0x0a, "Reserved", 0 }, - { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, - { 0x0c, "Graphics Text (Type 1)", 0 }, - { 0x0d, "Grephics Text Attributes", 0 }, - { 0x0e, "Colormap", &WPG1Parser::handleColormap }, - { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, - { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, - { 0x11, "Postscript Data Follows", 0 }, - { 0x12, "Output Attributes", 0 }, - { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, - { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, - { 0x15, "Start Figure", 0 }, - { 0x16, "Start Chart", 0 }, - { 0x17, "Planperfect Data", 0 }, - { 0x18, "Graphics Text (Type 2)", 0 }, - { 0x19, "Start WPG (Type 2)", 0 }, - { 0x1a, "Graphics Text (Type 3)", 0 }, - { 0x1b, "Ellipse", 0 }, + { 0x01, "Fill Attributes", &WPG1Parser::handleFillAttributes }, + { 0x02, "Line Attributes", &WPG1Parser::handleLineAttributes }, + { 0x03, "Marker Atttibutes", 0 }, + { 0x04, "Polymarker", 0 }, + { 0x05, "Line", &WPG1Parser::handleLine }, + { 0x06, "Polyline", &WPG1Parser::handlePolyline }, + { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, + { 0x08, "Polygon", &WPG1Parser::handlePolygon }, + { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, + { 0x0a, "Reserved", 0 }, + { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, + { 0x0c, "Graphics Text (Type 1)", 0 }, + { 0x0d, "Grephics Text Attributes", 0 }, + { 0x0e, "Colormap", &WPG1Parser::handleColormap }, + { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, + { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, + { 0x11, "Postscript Data (Type 1)", &WPG1Parser::handlePostscriptTypeOne }, + { 0x12, "Output Attributes", 0 }, + { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, + { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, + { 0x15, "Start Figure", 0 }, + { 0x16, "Start Chart", 0 }, + { 0x17, "Planperfect Data", 0 }, + { 0x18, "Graphics Text (Type 2)", 0 }, + { 0x19, "Start WPG (Type 2)", 0 }, + { 0x1a, "Graphics Text (Type 3)", 0 }, + { 0x1b, "Postscript Data (Type 2)", &WPG1Parser::handlePostscriptTypeTwo }, { 0x00, 0, 0 } // end marker }; @@ -733,6 +733,76 @@ } } +void WPG1Parser::handlePostscriptTypeOne() +{ + if (!m_graphicsStarted) + return; + long x1 = readS16(); + long y1 = readS16(); + long x2 = readS16(); + long y2 = readS16(); + libwpg::WPGBinaryData data; + data.rect.x1 = (double)x1/72.0; + data.rect.y1 = (double)m_height/1200.0 - (double)y1/72.0; + data.rect.x2 = (double)x2/72.0; + data.rect.y2 = (double)m_height/1200.0 - (double)y2/72.0; + + data.clear(); + while (m_input->tell() <= m_recordEnd) + data.append((char)readU8()); + data.mimeType = "application/x-postscript"; + if (data.size()) + m_painter->drawImageObject(data); +} + +void WPG1Parser::handlePostscriptTypeTwo() +{ + if (!m_graphicsStarted) + return; +#ifdef DEBUG + size_t lengthOfData = readU32(); + int rotation = readS16(); +#else + readU32(); + readS16(); +#endif + int x1 = readS16(); + int y1 = readS16(); + int x2 = readS16(); + int y2 = readS16(); + + WPG_DEBUG_MSG(("Postscript (Type 2)\n")); + WPG_DEBUG_MSG((" Length of Data: %d\n", lengthOfData)); + WPG_DEBUG_MSG((" Rotation Angle: %d\n", rotation)); + WPG_DEBUG_MSG((" Bottom left corner: %d,%d\n", x1, y1)); + WPG_DEBUG_MSG((" Top right corner: %d,%d\n", x2, y2)); + + y1 = m_height - y1; + y2 = m_height - 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; + WPG_DEBUG_MSG(("%li %li %li %li\n", xs1, ys1, xs2, ys2)); + + libwpg::WPGBinaryData data; + data.rect.x1 = (double)xs1/1200.0; + data.rect.y1 = (double)(ys1)/1200.0; + data.rect.x2 = (double)xs2/1200.0; + data.rect.y2 = (double)(ys2)/1200.0; + + data.mimeType = "image/x-eps"; + + m_input->seek(48, WPX_SEEK_CUR); + + data.clear(); + while (m_input->tell() <= m_recordEnd) + data.append((char)readU8()); + if (data.size()) + m_painter->drawImageObject(data); +} + void WPG1Parser::resetPalette() { m_colorPalette.clear(); |
From: Fridrich S. <str...@us...> - 2008-07-16 14:14:25
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18604/src/lib Modified Files: WPGSVGGenerator.cpp Log Message: small variation of condition Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- WPGSVGGenerator.cpp 16 Jul 2008 14:10:59 -0000 1.15 +++ WPGSVGGenerator.cpp 16 Jul 2008 14:14:22 -0000 1.16 @@ -159,7 +159,7 @@ m_outputSink << "cx=\"" << doubleToString(72*center.x) << "\" cy=\"" << doubleToString(72*center.y) << "\" "; m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; writeStyle(); - if (rotation > 0.0) + if (rotation != 0.0) m_outputSink << " transform=\" translate(" << doubleToString(72*center.x) << ", " << doubleToString(72*center.y) << ") rotate(" << doubleToString(-rotation) << ") translate(" << doubleToString(-72*center.x) << ", " << doubleToString(-72*center.y) << ")\" "; |
From: Fridrich S. <str...@us...> - 2008-07-16 14:11:04
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16996/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: rotate ellipses + make the generated svg look cute Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGPaintInterface.h 11 Jul 2008 22:19:09 -0000 1.9 +++ WPGPaintInterface.h 16 Jul 2008 14:10:59 -0000 1.10 @@ -62,7 +62,7 @@ virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; - virtual void drawEllipse(const WPGPoint& center, double rx, double ry) = 0; + virtual void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to) = 0; virtual void drawPolygon(const WPGPointArray& vertices) = 0; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- WPG2Parser.cpp 16 Jul 2008 09:57:28 -0000 1.69 +++ WPG2Parser.cpp 16 Jul 2008 14:10:59 -0000 1.70 @@ -1316,18 +1316,16 @@ long ey = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ex,ey); - if((ix==ex) && (iy==ey)) - { - libwpg::WPGPoint center; - center.x = TO_DOUBLE(cx) / m_xres; - center.y = TO_DOUBLE(cy) / m_xres; - double rx = TO_DOUBLE(radx) / m_xres; - double ry = TO_DOUBLE(rady) / m_xres; + libwpg::WPGPoint center; + center.x = TO_DOUBLE(cx) / m_xres; + center.y = TO_DOUBLE(cy) / m_xres; + double rx = TO_DOUBLE(radx) / m_xres; + double ry = TO_DOUBLE(rady) / m_xres; - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); - m_painter->drawEllipse(center, rx, ry); - } + m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); + m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->drawEllipse(center, rx, ry, objCh.rotate ? objCh.rotationAngle : 0.0, + libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres)); WPG_DEBUG_MSG((" Center point x : %li\n", cx)); WPG_DEBUG_MSG((" Center point y : %li\n", cy)); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- WPG1Parser.cpp 16 Jul 2008 10:48:19 -0000 1.39 +++ WPG1Parser.cpp 16 Jul 2008 14:10:59 -0000 1.40 @@ -447,13 +447,12 @@ int cy = readS16(); int rx = readS16(); int ry = readS16(); + double rotation = (double)readS16(); #if 0 - int rotation = readS16(); int beginAngle = readS16(); int endAngle = readS16(); unsigned flags = readU16(); #endif - libwpg::WPGPoint center; center.x = (double)cx/1200.0; center.y = (double)(m_height-cy)/1200.0; @@ -463,7 +462,7 @@ m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawEllipse(center, radx, rady); + m_painter->drawEllipse(center, radx, rady, (double)rotation, libwpg::WPGPoint(), libwpg::WPGPoint()); WPG_DEBUG_MSG(("Ellipse\n")); WPG_DEBUG_MSG((" Center point: %d,%d\n", cx, cy)); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGSVGGenerator.h 11 Jul 2008 22:19:09 -0000 1.9 +++ WPGSVGGenerator.h 16 Jul 2008 14:10:59 -0000 1.10 @@ -51,7 +51,7 @@ void setFillRule(FillRule rule); void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); + void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to); void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- WPGSVGGenerator.cpp 16 Jul 2008 09:57:28 -0000 1.14 +++ WPGSVGGenerator.cpp 16 Jul 2008 14:10:59 -0000 1.15 @@ -153,12 +153,16 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawEllipse(const libwpg::WPGPoint& center, double rx, double ry) +void libwpg::WPGSVGGenerator::drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& /* from */, const WPGPoint& /* to */) { m_outputSink << "<ellipse "; m_outputSink << "cx=\"" << doubleToString(72*center.x) << "\" cy=\"" << doubleToString(72*center.y) << "\" "; m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; writeStyle(); + if (rotation > 0.0) + m_outputSink << " transform=\" translate(" << doubleToString(72*center.x) << ", " << doubleToString(72*center.y) + << ") rotate(" << doubleToString(-rotation) << ") translate(" << doubleToString(-72*center.x) << ", " << doubleToString(-72*center.y) + << ")\" "; m_outputSink << "/>\n"; } |
From: Fridrich S. <str...@us...> - 2008-07-16 14:11:03
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16996/src/conv/raw Modified Files: wpg2raw.cpp Log Message: rotate ellipses + make the generated svg look cute Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- wpg2raw.cpp 11 Jul 2008 22:19:08 -0000 1.9 +++ wpg2raw.cpp 16 Jul 2008 14:10:59 -0000 1.10 @@ -46,7 +46,7 @@ void setFillRule(FillRule rule); void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); + void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry, double rotation, const libwpg::WPGPoint& from, const libwpg::WPGPoint& to); void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); @@ -122,7 +122,7 @@ printf(" Roundndess: %g %g\n", rx, ry); } -void RawPainter::drawEllipse(const libwpg::WPGPoint& /*center*/s, double rx, double ry) +void RawPainter::drawEllipse(const libwpg::WPGPoint& /* center */, double rx, double ry, double /* rotation */, const libwpg::WPGPoint& /* from */, const libwpg::WPGPoint& /* to */) { printf("RawPainter::drawEllipse "); printf(" Radius: %g %g\n", rx, ry); |
From: Fridrich S. <str...@us...> - 2008-07-16 10:48:22
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5167/src/lib Modified Files: WPG1Parser.cpp Log Message: fix path coordinates + fill attributes Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- WPG1Parser.cpp 16 Jul 2008 09:57:28 -0000 1.38 +++ WPG1Parser.cpp 16 Jul 2008 10:48:19 -0000 1.39 @@ -447,6 +447,12 @@ int cy = readS16(); int rx = readS16(); int ry = readS16(); +#if 0 + int rotation = readS16(); + int beginAngle = readS16(); + int endAngle = readS16(); + unsigned flags = readU16(); +#endif libwpg::WPGPoint center; center.x = (double)cx/1200.0; @@ -477,7 +483,7 @@ path.closed = false; long xInitial = readS16(); long yInitial = readS16(); - path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)yInitial/1200.0)); + path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)(m_height-yInitial)/1200.0)); for (unsigned i = 1; i < (count-1)/3; i++) { long xControl1 = readS16(); @@ -486,12 +492,12 @@ long yControl2 = readS16(); long xCoordinate = readS16(); long yCoordinate = readS16(); - path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)yControl1/1200.0), - libwpg::WPGPoint((double)xControl2/1200.0, (double)yControl2/1200.0), - libwpg::WPGPoint((double)xCoordinate/1200.0, (double)yCoordinate/1200.0)); + path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)(m_height-yControl1)/1200.0), + libwpg::WPGPoint((double)xControl2/1200.0, (double)(m_height-yControl2)/1200.0), + libwpg::WPGPoint((double)xCoordinate/1200.0, (double)(m_height-yCoordinate)/1200.0)); } - m_painter->setBrush(m_brush); + m_painter->setBrush(path.closed ? m_brush : libwpg::WPGBrush()); m_painter->setPen(m_pen); m_painter->drawPath(path); |
From: Fridrich S. <str...@us...> - 2008-07-16 10:47:42
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4774/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp Log Message: fix path coordinates + fill attributes Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.5 retrieving revision 1.33.2.6 diff -u -d -r1.33.2.5 -r1.33.2.6 --- WPG1Parser.cpp 16 Jul 2008 09:51:07 -0000 1.33.2.5 +++ WPG1Parser.cpp 16 Jul 2008 10:47:38 -0000 1.33.2.6 @@ -447,6 +447,10 @@ int cy = readS16(); int rx = readS16(); int ry = readS16(); + int rotation = readS16(); + int beginAngle = readS16(); + int endAngle = readS16(); + unsigned flags = readU16(); libwpg::WPGPoint center; center.x = (double)cx/1200.0; @@ -477,7 +481,7 @@ path.closed = false; long xInitial = readS16(); long yInitial = readS16(); - path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)yInitial/1200.0)); + path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)(m_height-yInitial)/1200.0)); for (unsigned i = 1; i < (count-1)/3; i++) { long xControl1 = readS16(); @@ -486,12 +490,12 @@ long yControl2 = readS16(); long xCoordinate = readS16(); long yCoordinate = readS16(); - path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)yControl1/1200.0), - libwpg::WPGPoint((double)xControl2/1200.0, (double)yControl2/1200.0), - libwpg::WPGPoint((double)xCoordinate/1200.0, (double)yCoordinate/1200.0)); + path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)(m_height-yControl1)/1200.0), + libwpg::WPGPoint((double)xControl2/1200.0, (double)(m_height-yControl2)/1200.0), + libwpg::WPGPoint((double)xCoordinate/1200.0, (double)(m_height-yCoordinate)/1200.0)); } - m_painter->setBrush(m_brush); + m_painter->setBrush(path.closed ? m_brush : libwpg::WPGBrush()); m_painter->setPen(m_pen); m_painter->drawPath(path); |
From: Fridrich S. <str...@us...> - 2008-07-16 09:57:33
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18349/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGBitmap.cpp WPGSVGGenerator.cpp Log Message: miscellanous fixes form stable branch Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- WPG2Parser.h 9 Jul 2008 13:45:30 -0000 1.23 +++ WPG2Parser.h 16 Jul 2008 09:57:28 -0000 1.24 @@ -146,7 +146,7 @@ class WPG2Parser : public WPGXParser { public: - WPG2Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter); + WPG2Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter, bool isEmbedded = false); bool parse(); private: @@ -222,6 +222,8 @@ class ObjectCharacterization; void parseCharacterization(ObjectCharacterization*); unsigned m_binaryId; + + bool m_embedded; }; #endif // __WPG2PARSER_H__ Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- WPGBitmap.cpp 9 Jul 2008 14:46:23 -0000 1.18 +++ WPGBitmap.cpp 16 Jul 2008 09:57:28 -0000 1.19 @@ -27,12 +27,11 @@ #include "WPGBitmap.h" #include "libwpg_utils.h" -#include <sstream> - #define DUMP_BITMAP 0 #if DUMP_BITMAP static unsigned bitmapId = 0; +#include <sstream> #endif class libwpg::WPGBitmap::Private Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- WPG1Parser.h 16 Jul 2007 12:03:33 -0000 1.15 +++ WPG1Parser.h 16 Jul 2008 09:57:28 -0000 1.16 @@ -51,6 +51,8 @@ void handleRectangle(); void handlePolygon(); void handleEllipse(); + + void handleCurvedPolyline(); unsigned char* decodeRLE(int width, int height, int depth); void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPGSVGGenerator.cpp 11 Jul 2008 22:19:09 -0000 1.13 +++ WPGSVGGenerator.cpp 16 Jul 2008 09:57:28 -0000 1.14 @@ -274,10 +274,7 @@ m_outputSink << "style=\""; const libwpg::WPGColor& color = m_pen.foreColor; - if(m_pen.width > 0.0) - m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; - else if(m_pen.solid) - m_outputSink << "stroke-width: 0.72; "; + m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; if(m_pen.width > 0.0 || m_pen.solid) { Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- WPG2Parser.cpp 11 Jul 2008 22:19:09 -0000 1.68 +++ WPG2Parser.cpp 16 Jul 2008 09:57:28 -0000 1.69 @@ -31,7 +31,6 @@ #include <math.h> #include <vector> -#include <sstream> // MSVC++ 6.0 does not have the macro defined, so we define it #ifndef M_PI @@ -40,6 +39,10 @@ #define DUMP_BINARY_DATA 0 +#if DUMP_BINARY_DATA +#include <sstream> +#endif + static const unsigned char defaultWPG2PaletteRed[] = { 0x00, 0xFF, 0x7F, 0xBF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, @@ -205,11 +208,11 @@ {} }; -WPG2Parser::WPG2Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter): +WPG2Parser::WPG2Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter, bool isEmbedded): WPGXParser(input, painter), m_recordLength(0), m_recordEnd(0), - m_success(true), m_exit(false), m_graphicsStarted(false), + m_success(true), m_exit(false), m_graphicsStarted(isEmbedded), m_xres(1200), m_yres(1200), m_xofs(0), m_yofs(0), m_width(0), m_height(0), @@ -225,14 +228,25 @@ m_compoundMatrix(), m_compoundWindingRule(false), m_compoundFilled(false), - m_compoundFramed(false), + m_compoundFramed(true), m_compoundClosed(false), m_bitmap(), m_binaryData(), m_hFlipped(false), m_vFlipped(false), - m_binaryId(0) + m_binaryId(0), + m_embedded(isEmbedded) { + // default style + m_pen.foreColor = libwpg::WPGColor(0,0,0); + m_pen.backColor = libwpg::WPGColor(0xff,0xff,0xff); + m_pen.width = 0.0; + m_pen.height = 0.0; + m_pen.solid = true; + m_pen.dashArray = libwpg::WPGDashArray(); + m_brush.foreColor = libwpg::WPGColor(0,0,0); + m_brush.backColor = libwpg::WPGColor(0xff, 0xff, 0xff); + resetPalette(); } bool WPG2Parser::parse() @@ -309,34 +323,6 @@ { 0x00, 0, 0 } // end marker }; - // initialization - m_recordLength = 0; - m_recordEnd = 0; - m_success = true; - m_exit = false; - m_graphicsStarted = false; - m_xres = m_yres = 1200; - m_doublePrecision = false; - m_layerOpened = false; - m_matrix = WPG2TransformMatrix(); - m_groupStack = std::stack<WPGGroupContext>(); - m_compoundMatrix = WPG2TransformMatrix(); - m_compoundWindingRule = false; - m_compoundFilled = false; - m_compoundFramed = true; - m_compoundClosed = false; - - // default style - m_pen.foreColor = libwpg::WPGColor(0,0,0); - m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.01; - m_pen.height = 0.01; - m_pen.solid = true; - m_pen.dashArray = libwpg::WPGDashArray(); - m_brush.foreColor = libwpg::WPGColor(0,0,0); - m_brush.backColor = libwpg::WPGColor(0,0,0); - resetPalette(); - while(!m_input->atEOS()) { #ifdef DEBUG @@ -488,8 +474,7 @@ } // danger if we do not recognize the precision code - if(precision != 0) - if(precision != 1) + if(precision != 0 && precision != 1) { m_success = false; m_exit = true; Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- WPG1Parser.cpp 11 Jul 2008 22:19:08 -0000 1.37 +++ WPG1Parser.cpp 16 Jul 2008 09:57:28 -0000 1.38 @@ -166,11 +166,24 @@ { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, { 0x08, "Polygon", &WPG1Parser::handlePolygon }, { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, + { 0x0a, "Reserved", 0 }, { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, + { 0x0c, "Graphics Text (Type 1)", 0 }, + { 0x0d, "Grephics Text Attributes", 0 }, { 0x0e, "Colormap", &WPG1Parser::handleColormap }, { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, + { 0x11, "Postscript Data Follows", 0 }, + { 0x12, "Output Attributes", 0 }, + { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, + { 0x15, "Start Figure", 0 }, + { 0x16, "Start Chart", 0 }, + { 0x17, "Planperfect Data", 0 }, + { 0x18, "Graphics Text (Type 2)", 0 }, + { 0x19, "Start WPG (Type 2)", 0 }, + { 0x1a, "Graphics Text (Type 3)", 0 }, + { 0x1b, "Ellipse", 0 }, { 0x00, 0, 0 } // end marker }; @@ -184,8 +197,8 @@ // default style m_pen.foreColor = libwpg::WPGColor(0,0,0); m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.01; - m_pen.height = 0.01; + m_pen.width = 0.001; + m_pen.height = 0.001; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); m_brush.foreColor = libwpg::WPGColor(0,0,0); @@ -325,7 +338,10 @@ m_pen.solid = style != 0; m_pen.foreColor = m_colorPalette[color]; - m_pen.width = (double)width / 1200.0; + if (!width && m_pen.solid) + m_pen.width = 0.001; + else + m_pen.width = (double)width / 1200.0; WPG_DEBUG_MSG(("Line Attributes\n")); WPG_DEBUG_MSG((" Line style: %d\n", style)); @@ -449,6 +465,39 @@ WPG_DEBUG_MSG((" Radius y: %d\n", ry)); } +void WPG1Parser::handleCurvedPolyline() +{ + if (!m_graphicsStarted) + return; + readU32(); + unsigned int count = readU16(); + if (!count) + return; + libwpg::WPGPath path; + path.closed = false; + long xInitial = readS16(); + long yInitial = readS16(); + path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)yInitial/1200.0)); + for (unsigned i = 1; i < (count-1)/3; i++) + { + long xControl1 = readS16(); + long yControl1 = readS16(); + long xControl2 = readS16(); + long yControl2 = readS16(); + long xCoordinate = readS16(); + long yCoordinate = readS16(); + path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)yControl1/1200.0), + libwpg::WPGPoint((double)xControl2/1200.0, (double)yControl2/1200.0), + libwpg::WPGPoint((double)xCoordinate/1200.0, (double)yCoordinate/1200.0)); + } + + m_painter->setBrush(m_brush); + m_painter->setPen(m_pen); + m_painter->drawPath(path); + + WPG_DEBUG_MSG(("Curved Polyline\n")); +} + // allocate a buffer (of specified bitmap size), then start decoding RLE data // from the input stream to fill the buffer // NOTE: delete the buffer by yourself! |
From: Fridrich S. <str...@us...> - 2008-07-16 09:51:11
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16102/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp Log Message: fiddle with pen styles in wpg1 Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.4 retrieving revision 1.33.2.5 diff -u -d -r1.33.2.4 -r1.33.2.5 --- WPG1Parser.cpp 16 Jul 2008 09:25:06 -0000 1.33.2.4 +++ WPG1Parser.cpp 16 Jul 2008 09:51:07 -0000 1.33.2.5 @@ -338,7 +338,10 @@ m_pen.solid = style != 0; m_pen.foreColor = m_colorPalette[color]; - m_pen.width = (double)width / 1200.0; + if (!width && m_pen.solid) + m_pen.width = 0.001; + else + m_pen.width = (double)width / 1200.0; WPG_DEBUG_MSG(("Line Attributes\n")); WPG_DEBUG_MSG((" Line style: %d\n", style)); |
From: Fridrich S. <str...@us...> - 2008-07-16 09:25:10
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6270/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp WPG1Parser.h Log Message: handle bezier curve in WPG1 too Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- WPG1Parser.h 16 Jul 2007 12:03:33 -0000 1.15 +++ WPG1Parser.h 16 Jul 2008 09:25:06 -0000 1.15.2.1 @@ -51,6 +51,8 @@ void handleRectangle(); void handlePolygon(); void handleEllipse(); + + void handleCurvedPolyline(); unsigned char* decodeRLE(int width, int height, int depth); void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.3 retrieving revision 1.33.2.4 diff -u -d -r1.33.2.3 -r1.33.2.4 --- WPG1Parser.cpp 11 Jul 2008 14:44:48 -0000 1.33.2.3 +++ WPG1Parser.cpp 16 Jul 2008 09:25:06 -0000 1.33.2.4 @@ -166,11 +166,24 @@ { 0x07, "Rectangle", &WPG1Parser::handleRectangle }, { 0x08, "Polygon", &WPG1Parser::handlePolygon }, { 0x09, "Ellipse", &WPG1Parser::handleEllipse }, + { 0x0a, "Reserved", 0 }, { 0x0b, "Bitmap (Type 1)", &WPG1Parser::handleBitmapTypeOne }, + { 0x0c, "Graphics Text (Type 1)", 0 }, + { 0x0d, "Grephics Text Attributes", 0 }, { 0x0e, "Colormap", &WPG1Parser::handleColormap }, { 0x0f, "Start WPG", &WPG1Parser::handleStartWPG }, { 0x10, "End WPG", &WPG1Parser::handleEndWPG }, + { 0x11, "Postscript Data Follows", 0 }, + { 0x12, "Output Attributes", 0 }, + { 0x13, "Curved Polyline", &WPG1Parser::handleCurvedPolyline }, { 0x14, "Bitmap (Type 2)", &WPG1Parser::handleBitmapTypeTwo }, + { 0x15, "Start Figure", 0 }, + { 0x16, "Start Chart", 0 }, + { 0x17, "Planperfect Data", 0 }, + { 0x18, "Graphics Text (Type 2)", 0 }, + { 0x19, "Start WPG (Type 2)", 0 }, + { 0x1a, "Graphics Text (Type 3)", 0 }, + { 0x1b, "Ellipse", 0 }, { 0x00, 0, 0 } // end marker }; @@ -449,6 +462,39 @@ WPG_DEBUG_MSG((" Radius y: %d\n", ry)); } +void WPG1Parser::handleCurvedPolyline() +{ + if (!m_graphicsStarted) + return; + readU32(); + unsigned int count = readU16(); + if (!count) + return; + libwpg::WPGPath path; + path.closed = false; + long xInitial = readS16(); + long yInitial = readS16(); + path.moveTo(libwpg::WPGPoint((double)xInitial/1200.0, (double)yInitial/1200.0)); + for (unsigned i = 1; i < (count-1)/3; i++) + { + long xControl1 = readS16(); + long yControl1 = readS16(); + long xControl2 = readS16(); + long yControl2 = readS16(); + long xCoordinate = readS16(); + long yCoordinate = readS16(); + path.curveTo(libwpg::WPGPoint((double)xControl1/1200.0, (double)yControl1/1200.0), + libwpg::WPGPoint((double)xControl2/1200.0, (double)yControl2/1200.0), + libwpg::WPGPoint((double)xCoordinate/1200.0, (double)yCoordinate/1200.0)); + } + + m_painter->setBrush(m_brush); + m_painter->setPen(m_pen); + m_painter->drawPath(path); + + WPG_DEBUG_MSG(("Curved Polyline\n")); +} + // allocate a buffer (of specified bitmap size), then start decoding RLE data // from the input stream to fill the buffer // NOTE: delete the buffer by yourself! |
From: Fridrich S. <str...@us...> - 2008-07-12 00:07:08
|
Update of /cvsroot/libwpg/perfectspot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14690/src Modified Files: aboutbox.cpp renderer.cpp Log Message: make the casts from double to int correctly + make some features that are not present in all Qt4 versions conditional Index: aboutbox.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/aboutbox.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- aboutbox.cpp 11 Oct 2007 10:03:43 -0000 1.7 +++ aboutbox.cpp 12 Jul 2008 00:07:05 -0000 1.8 @@ -206,9 +206,14 @@ QString info = "<b>"; info += tr("Perfectspot version %1").arg( MAKE_STRING(PERFECTSPOT_VERSION) ); info += "</b><br>"; +#if QT_VERSION >= 0x040200 info += QString("<a href=\"%1\">%2</a>").arg(website).arg(website); infoLabel->setText( info ); infoLabel->setOpenExternalLinks(true); +#else + info += QString("<u>%1</u>").arg(website); + infoLabel->setText( info ); +#endif QLabel* iconLabel = new QLabel( this ); iconLabel->setPixmap( QPixmap( ":/perfectspot.png" ) ); Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- renderer.cpp 11 Jul 2008 22:42:47 -0000 1.13 +++ renderer.cpp 12 Jul 2008 00:07:05 -0000 1.14 @@ -168,12 +168,12 @@ { double roundx = rx * 200 / rect.width(); double roundy = ry * 200 / rect.height(); - m_target->drawRoundRect((int)m_zoomX*rect.x1, (int)m_zoomY*rect.y1, (int)m_zoomX*rect.width(), (int)m_zoomY*rect.height(), (int)roundx, (int)roundy); + m_target->drawRoundRect((int)(m_zoomX*rect.x1), (int)(m_zoomY*rect.y1), (int)(m_zoomX*rect.width()), (int)(m_zoomY*rect.height()), (int)roundx, (int)roundy); } void Painter::drawEllipse(const WPGPoint& center, double rx, double ry) { - m_target->drawEllipse((int)m_zoomX*(center.x - rx), (int)m_zoomY*(center.y - ry), (int)2*m_zoomX*rx, (int)2*m_zoomY*ry); + m_target->drawEllipse((int)(m_zoomX*(center.x - rx)), (int)(m_zoomY*(center.y - ry)), (int)(2*m_zoomX*rx), (int)(2*m_zoomY*ry)); } void Painter::drawPolygon(const WPGPointArray& vertices) |
From: Fridrich S. <str...@us...> - 2008-07-11 22:42:52
|
Update of /cvsroot/libwpg/perfectspot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15316/src Modified Files: canvas.cpp renderer.cpp Log Message: fix rendering of rectangles in perfectspot + add rendering of ellipses + Ariya, don't assume that the default values of a function parameters are there in each version of Qt4 :) Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- renderer.cpp 5 Oct 2007 11:04:31 -0000 1.12 +++ renderer.cpp 11 Jul 2008 22:42:47 -0000 1.13 @@ -166,13 +166,14 @@ void Painter::drawRectangle(const WPGRect& rect, double rx, double ry) { - double roundx = rx * 100 / (rect.x2-rect.x1); - double roundy = ry * 100 / (rect.y2-rect.y1); - m_target->drawRoundRect((int)rect.x1, (int)rect.y1, (int)rect.x2, (int)rect.y2, (int)roundx, (int)roundy); + double roundx = rx * 200 / rect.width(); + double roundy = ry * 200 / rect.height(); + m_target->drawRoundRect((int)m_zoomX*rect.x1, (int)m_zoomY*rect.y1, (int)m_zoomX*rect.width(), (int)m_zoomY*rect.height(), (int)roundx, (int)roundy); } void Painter::drawEllipse(const WPGPoint& center, double rx, double ry) { + m_target->drawEllipse((int)m_zoomX*(center.x - rx), (int)m_zoomY*(center.y - ry), (int)2*m_zoomX*rx, (int)2*m_zoomY*ry); } void Painter::drawPolygon(const WPGPointArray& vertices) Index: canvas.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/canvas.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- canvas.cpp 9 Oct 2007 13:34:33 -0000 1.23 +++ canvas.cpp 11 Jul 2008 22:42:47 -0000 1.24 @@ -336,7 +336,7 @@ // assume raster format, e.g. PNG, JPEG, .. else - return buffer.save(file); + return buffer.save(file, 0, -1); } #include "canvas.moc" |
From: Fridrich S. <str...@us...> - 2008-07-11 22:19:13
|
Update of /cvsroot/libwpg/libwpg/src/conv/raw In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6669/src/conv/raw Modified Files: wpg2raw.cpp Log Message: some cosmetic changes + change of default constructor of WPGBrush + distinguish between polyline and polygon and add a callback for the polyline Index: wpg2raw.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/conv/raw/wpg2raw.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- wpg2raw.cpp 10 Jul 2008 19:39:05 -0000 1.8 +++ wpg2raw.cpp 11 Jul 2008 22:19:08 -0000 1.9 @@ -47,6 +47,7 @@ void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); + void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); void drawBitmap(const libwpg::WPGBitmap& bitmap); @@ -127,13 +128,20 @@ printf(" Radius: %g %g\n", rx, ry); } -void RawPainter::drawPolygon(const libwpg::WPGPointArray& vertices) +void RawPainter::drawPolyline(const libwpg::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::drawPolygon(const libwpg::WPGPointArray& vertices) +{ + printf("RawPainter::drawPolygon %d points\n", vertices.count()); + for(unsigned i = 0; i < vertices.count(); i++) + printf(" (%g %g)\n", vertices[i].x, vertices[i].y); +} + void RawPainter::drawPath(const libwpg::WPGPath& path) { printf("RawPainter::drawPath %d elements\n", path.count()); |
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6669/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGBrush.cpp WPGBrush.h WPGPaintInterface.h WPGPen.cpp WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: some cosmetic changes + change of default constructor of WPGBrush + distinguish between polyline and polygon and add a callback for the polyline Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WPGBrush.h 14 Dec 2006 14:39:57 -0000 1.5 +++ WPGBrush.h 11 Jul 2008 22:19:09 -0000 1.6 @@ -51,6 +51,8 @@ WPGGradient gradient; WPGBrush(); + + WPGBrush(WPGBrushStyle brushStyle); explicit WPGBrush(const WPGColor& fore); Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- WPGBrush.cpp 15 Dec 2006 18:06:00 -0000 1.2 +++ WPGBrush.cpp 11 Jul 2008 22:19:09 -0000 1.3 @@ -26,7 +26,14 @@ #include "WPGBrush.h" libwpg::WPGBrush::WPGBrush(): - style(Solid), + style(NoBrush), + foreColor(0,0,0), + backColor(0xFF,0xFF,0xFF), + gradient() +{} + +libwpg::WPGBrush::WPGBrush(libwpg::WPGBrush::WPGBrushStyle brushStyle): + style(brushStyle), foreColor(0,0,0), backColor(0xFF,0xFF,0xFF), gradient() Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGSVGGenerator.h 10 Jul 2008 19:39:06 -0000 1.8 +++ WPGSVGGenerator.h 11 Jul 2008 22:19:09 -0000 1.9 @@ -52,6 +52,7 @@ void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry); + void drawPolyline(const libwpg::WPGPointArray& vertices); void drawPolygon(const libwpg::WPGPointArray& vertices); void drawPath(const libwpg::WPGPath& path); void drawBitmap(const libwpg::WPGBitmap& bitmap); @@ -63,6 +64,7 @@ FillRule m_fillRule; int m_gradientIndex; void writeStyle(); + void drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed); std::ostream & m_outputSink; }; Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGSVGGenerator.cpp 3 Apr 2008 09:28:35 -0000 1.12 +++ WPGSVGGenerator.cpp 11 Jul 2008 22:19:09 -0000 1.13 @@ -162,8 +162,18 @@ m_outputSink << "/>\n"; } +void libwpg::WPGSVGGenerator::drawPolyline(const libwpg::WPGPointArray& vertices) +{ + drawPolySomething(vertices, false); +} + void libwpg::WPGSVGGenerator::drawPolygon(const libwpg::WPGPointArray& vertices) { + drawPolySomething(vertices, true); +} + +void libwpg::WPGSVGGenerator::drawPolySomething(const libwpg::WPGPointArray& vertices, bool isClosed) +{ if(vertices.count() < 2) return; @@ -179,7 +189,11 @@ } else { - m_outputSink << "<polygon "; + if (isClosed) + m_outputSink << "<polygon "; + else + m_outputSink << "<polyline "; + m_outputSink << "points=\""; for(unsigned i = 0; i < vertices.count(); i++) { @@ -260,8 +274,12 @@ m_outputSink << "style=\""; const libwpg::WPGColor& color = m_pen.foreColor; - m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; if(m_pen.width > 0.0) + m_outputSink << "stroke-width: " << doubleToString(72*m_pen.width) << "; "; + else if(m_pen.solid) + m_outputSink << "stroke-width: 0.72; "; + + if(m_pen.width > 0.0 || m_pen.solid) { m_outputSink << "stroke: rgb(" << color.red << "," << color.green << "," << color.blue << "); "; if(color.alpha != 0) @@ -284,10 +302,13 @@ if(m_brush.style == libwpg::WPGBrush::NoBrush) m_outputSink << "fill: none; "; - if(m_fillRule == WPGSVGGenerator::WindingFill) - m_outputSink << "fill-rule: nonzero; "; - else if(m_fillRule == WPGSVGGenerator::AlternatingFill) - m_outputSink << "fill-rule: evenodd; "; + if(m_brush.style == libwpg::WPGBrush::Pattern) + { + if(m_fillRule == WPGSVGGenerator::WindingFill) + m_outputSink << "fill-rule: nonzero; "; + else if(m_fillRule == WPGSVGGenerator::AlternatingFill) + m_outputSink << "fill-rule: evenodd; "; + } if(m_brush.style == libwpg::WPGBrush::Gradient) m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- WPGPaintInterface.h 10 Jul 2008 19:39:06 -0000 1.8 +++ WPGPaintInterface.h 11 Jul 2008 22:19:09 -0000 1.9 @@ -66,6 +66,8 @@ virtual void drawPolygon(const WPGPointArray& vertices) = 0; + virtual void drawPolyline(const WPGPointArray& vertices) = 0; + virtual void drawPath(const WPGPath& path) = 0; virtual void drawBitmap(const WPGBitmap& bitmap) = 0; Index: WPGPen.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPen.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGPen.cpp 9 May 2007 22:34:09 -0000 1.6 +++ WPGPen.cpp 11 Jul 2008 22:19:09 -0000 1.7 @@ -79,7 +79,7 @@ width(0), height(0), solid(true) , - dashArray(WPGDashArray()) + dashArray() { } @@ -89,7 +89,7 @@ width(0), height(0), solid(true), - dashArray(WPGDashArray()) + dashArray() { } @@ -99,7 +99,7 @@ width(0), height(0), solid(true) , - dashArray(WPGDashArray()) + dashArray() { } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- WPG2Parser.cpp 9 Jul 2008 14:46:22 -0000 1.67 +++ WPG2Parser.cpp 11 Jul 2008 22:19:09 -0000 1.68 @@ -215,7 +215,7 @@ m_width(0), m_height(0), m_doublePrecision(false), m_pen(), - m_brush(), + m_brush(libwpg::WPGBrush::Solid), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -329,8 +329,8 @@ // default style m_pen.foreColor = libwpg::WPGColor(0,0,0); m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.001; - m_pen.height = 0.001; + m_pen.width = 0.01; + m_pen.height = 0.01; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); m_brush.foreColor = libwpg::WPGColor(0,0,0); @@ -1188,7 +1188,10 @@ m_painter->setFillRule(libwpg::WPGPaintInterface::WindingFill); else m_painter->setFillRule(libwpg::WPGPaintInterface::AlternatingFill); - m_painter->drawPolygon(points); + if (objCh.filled || objCh.closed) + m_painter->drawPolygon(points); + else + m_painter->drawPolyline(points); } WPG_DEBUG_MSG((" Vertices count : %li\n", count)); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- WPG1Parser.cpp 11 Jul 2008 14:45:13 -0000 1.36 +++ WPG1Parser.cpp 11 Jul 2008 22:19:08 -0000 1.37 @@ -140,7 +140,7 @@ m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), m_width(0), m_height(0), - m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()) + m_pen(), m_brush(libwpg::WPGBrush(libwpg::WPGBrush::Solid)) { } @@ -184,8 +184,8 @@ // default style m_pen.foreColor = libwpg::WPGColor(0,0,0); m_pen.backColor = libwpg::WPGColor(0,0,0); - m_pen.width = 0.001; - m_pen.height = 0.001; + m_pen.width = 0.01; + m_pen.height = 0.01; m_pen.solid = true; m_pen.dashArray = libwpg::WPGDashArray(); m_brush.foreColor = libwpg::WPGColor(0,0,0); @@ -348,7 +348,7 @@ m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawPolygon(points); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Line\n")); WPG_DEBUG_MSG((" Starting point: %d,%d\n", sx, sy)); @@ -371,7 +371,7 @@ m_painter->setBrush(libwpg::WPGBrush()); // not filled m_painter->setPen(m_pen); - m_painter->drawPolygon(points); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Polyline\n")); } |
From: Fridrich S. <str...@us...> - 2008-07-11 14:54:31
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25548/src/lib Modified Files: Tag: STABLE-0-1-0 WPG1Parser.cpp Log Message: fix rect positioning in wpg1 Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.33.2.2 retrieving revision 1.33.2.3 diff -u -d -r1.33.2.2 -r1.33.2.3 --- WPG1Parser.cpp 10 Dec 2007 09:57:53 -0000 1.33.2.2 +++ WPG1Parser.cpp 11 Jul 2008 14:44:48 -0000 1.33.2.3 @@ -387,7 +387,8 @@ libwpg::WPGRect rect; rect.x1 = (double)x/1200.0; - rect.y1 = (double)(m_height-y)/1200.0; + // in WPG, we have the coordinate of lower left point, in SVG-ish coordinates we have to get upper left + rect.y1 = (double)(m_height - h - y)/1200.0; rect.x2 = rect.x1 + (double)w/1200.0; rect.y2 = rect.y1 + (double)h/1200.0; |