From: Fridrich S. <str...@us...> - 2008-11-27 16:33:05
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16195/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGBitmap.cpp WPGBitmap.h WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in makefile.mk Removed Files: WPGRect.cpp WPGRect.h Log Message: WPGRect gone + simplify WPGBitmap so that it doesn't duplicat functionalities in other classes Index: makefile.mk =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/makefile.mk,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- makefile.mk 24 Nov 2008 10:16:19 -0000 1.9 +++ makefile.mk 27 Nov 2008 16:33:00 -0000 1.10 @@ -31,11 +31,8 @@ $(SLO)$/WPGGradient.obj \ $(SLO)$/WPGHeader.obj \ $(SLO)$/WPGInternalStream.obj \ - $(SLO)$/WPGPath.obj \ $(SLO)$/WPGPen.obj \ - $(SLO)$/WPGPoint.obj \ $(SLO)$/WPGraphics.obj \ - $(SLO)$/WPGRect.obj \ $(SLO)$/WPGSVGGenerator.obj \ $(SLO)$/WPGXParser.obj Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- WPG1Parser.cpp 27 Nov 2008 14:15:17 -0000 1.50 +++ WPG1Parser.cpp 27 Nov 2008 16:33:00 -0000 1.51 @@ -416,16 +416,16 @@ int w = readS16(); int h = readS16(); - libwpg::WPGRect rect; - rect.x1 = (double)x/1200.0; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)((double)x/1200.0)); // in WPG, we have the coordinate of lower left point, in SVG-ish coordinates we have to get upper left - rect.y1 = (double)(m_height - h - y)/1200.0; - rect.x2 = rect.x1 + (double)w/1200.0; - rect.y2 = rect.y1 + (double)h/1200.0; + propList.insert("svg:y", (float)((double)(m_height - h - y)/1200.0)); + propList.insert("svg:width", (float)((double)w/1200.0)); + propList.insert("svg:height",(float)((double)h/1200.0)); m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawRectangle(rect, 0, 0); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG(("Line\n")); WPG_DEBUG_MSG((" Corner point: %d,%d\n", x, y)); @@ -714,17 +714,18 @@ // Bitmap Type 1 does not specify position // Assume on the corner (0,0) libwpg::WPGBitmap bitmap(width, height); - bitmap.rect.x1 = 0; - bitmap.rect.y1 = 0; - bitmap.rect.x2 = (double)width/(double)hres; - bitmap.rect.y2 = (double)height/(double)vres; + ::WPXPropertyList propList; + propList.insert("svg:x", 0.0f); + propList.insert("svg:y", 0.0f); + propList.insert("svg:width", (float)((double)width/(double)hres)); + propList.insert("svg:height", (float)((double)height/(double)vres)); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } } @@ -781,17 +782,18 @@ WPG_DEBUG_MSG(("%li %li %li %li\n", xs1, ys1, xs2, ys2)); libwpg::WPGBitmap bitmap(width, height); - bitmap.rect.x1 = (double)xs1/1200.0; - bitmap.rect.y1 = (double)(ys1)/1200.0; - bitmap.rect.x2 = (double)xs2/1200.0; - bitmap.rect.y2 = (double)(ys2)/1200.0; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)((double)xs1/1200.0)); + propList.insert("svg:y", (float)((double)(ys1)/1200.0)); + propList.insert("svg:width", (float)((double)(xs2-xs1)/1200.0)); + propList.insert("svg:height", (float)((double)(ys2-ys1)/1200.0)); std::vector<unsigned char> buffer; decodeRLE(buffer, width, height, depth); if (buffer.size() && buffer.size() == (size_t)((width*depth + 7)/8)*height) { fillPixels(bitmap, &buffer[0], width, height, depth); - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } } Index: WPGBitmap.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGBitmap.h 24 Nov 2008 10:16:19 -0000 1.9 +++ WPGBitmap.h 27 Nov 2008 16:33:00 -0000 1.10 @@ -27,9 +27,8 @@ #ifndef __WPGBITMAP_H__ #define __WPGBITMAP_H__ -#include "WPGRect.h" #include "WPGColor.h" -#include <libwpd/WPXString.h> +#include <libwpd/libwpd.h> namespace libwpg { @@ -37,8 +36,6 @@ class WPGBitmap { public: - WPGRect rect; - WPGBitmap(int width, int height); WPGBitmap(int width, int height, bool verticalFlip, bool horizontalFlip); @@ -61,16 +58,11 @@ void setPixel(int x, int y, const WPGColor& color); - void generateBase64DIB(::WPXString& bmp) const; - - static void base64Encode(::WPXString& base64, const char *data, const int len); + const ::WPXBinaryData& getDIB() const; private: class Private; Private* const d; - static void writeU16(char *buffer, unsigned &position, const int value); - static void writeU32(char *buffer, unsigned &position, const int value); - static void writeU8(char *buffer, unsigned &position, const int value); }; } // namespace libwpg Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPGSVGGenerator.h 27 Nov 2008 14:15:17 -0000 1.13 +++ WPGSVGGenerator.h 27 Nov 2008 16:33:00 -0000 1.14 @@ -51,12 +51,12 @@ void setBrush(const libwpg::WPGBrush& brush); void setFillRule(FillRule rule); - void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); + void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); - void drawBitmap(const libwpg::WPGBitmap& bitmap); + void drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap); void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData); private: Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- WPG2Parser.h 27 Nov 2008 14:15:17 -0000 1.28 +++ WPG2Parser.h 27 Nov 2008 16:33:00 -0000 1.29 @@ -67,14 +67,24 @@ return propList; } - libwpg::WPGRect transform(const libwpg::WPGRect& r) const + ::WPXPropertyList transformRect(const ::WPXPropertyList& r) const { - libwpg::WPGRect rect; - rect.x1 = element[0][0]*r.x1 + element[1][0]*r.y1 + element[2][0]; - rect.y1 = element[0][1]*r.x1 + element[1][1]*r.y1 + element[2][1]; - rect.x2 = element[0][0]*r.x2 + element[1][0]*r.y2 + element[2][0]; - rect.y2 = element[0][1]*r.x2 + element[1][1]*r.y2 + element[2][1]; - return rect; + ::WPXPropertyList propList; + double oldx1 = r["svg:x"]->getFloat(); + double oldy1 = r["svg:y"]->getFloat(); + double oldx2 = r["svg:x"]->getFloat() + r["svg:width"]->getFloat(); + double oldy2 = r["svg:y"]->getFloat() + r["svg:height"]->getFloat(); + + double newx1 = element[0][0]*oldx1 + element[1][0]*oldy1 + element[2][0]; + double newy1 = element[0][1]*oldx1 + element[1][1]*oldy1 + element[2][1]; + double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0]; + double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1]; + + propList.insert("svg:x", (float)newx1); + propList.insert("svg:y", (float)newy1); + propList.insert("svg:width", (float)(newx2-newx1)); + propList.insert("svg:height", (float)(newy2-newy1)); + return propList; } WPG2TransformMatrix& transformBy(const WPG2TransformMatrix& m) --- WPGRect.cpp DELETED --- --- WPGRect.h DELETED --- Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WPGSVGGenerator.cpp 27 Nov 2008 14:15:17 -0000 1.19 +++ WPGSVGGenerator.cpp 27 Nov 2008 16:33:00 -0000 1.20 @@ -146,13 +146,13 @@ m_outputSink << "</g>\n"; } -void libwpg::WPGSVGGenerator::drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) +void libwpg::WPGSVGGenerator::drawRectangle(const ::WPXPropertyList& propList) { m_outputSink << "<rect "; - m_outputSink << "x=\"" << doubleToString(72*rect.x1) << "\" y=\"" << doubleToString(72*rect.y1) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*rect.width()) << "\" height=\"" << doubleToString(72*rect.height()) << "\" "; - if((rx !=0) || (ry !=0)) - m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" "; + if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"]->getInt() !=0)) + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; writeStyle(); m_outputSink << "/>\n"; } @@ -248,13 +248,12 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawBitmap(const libwpg::WPGBitmap& bitmap) +void libwpg::WPGSVGGenerator::drawBitmap(const ::WPXPropertyList &propList, const libwpg::WPGBitmap& bitmap) { - WPXString base64Bitmap; - bitmap.generateBase64DIB(base64Bitmap); + WPXString base64Bitmap = bitmap.getDIB().getBase64Data(); m_outputSink << "<image "; - m_outputSink << "x=\"" << doubleToString(72*bitmap.rect.x1) << "\" y=\"" << doubleToString(72*bitmap.rect.y1) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*bitmap.rect.width()) << "\" height=\"" << doubleToString(72*bitmap.rect.height()) << "\" "; + m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->getFloat()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getFloat()) << "\" "; + m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getFloat()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getFloat()) << "\" "; m_outputSink << "xlink:href=\"data:image/bmp;base64,"; m_outputSink << base64Bitmap.cstr(); m_outputSink << "\" />\n"; Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPGPaintInterface.h 27 Nov 2008 14:15:17 -0000 1.13 +++ WPGPaintInterface.h 27 Nov 2008 16:33:00 -0000 1.14 @@ -31,7 +31,6 @@ #include <libwpd/libwpd.h> #include "WPGBrush.h" #include "WPGPen.h" -#include "WPGRect.h" namespace libwpg { @@ -58,7 +57,7 @@ virtual void endEmbeddedGraphics() = 0; - virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; + virtual void drawRectangle(const ::WPXPropertyList& propList) = 0; virtual void drawEllipse(const ::WPXPropertyList& propList) = 0; @@ -68,7 +67,7 @@ virtual void drawPath(const ::WPXPropertyListVector& path) = 0; - virtual void drawBitmap(const WPGBitmap& bitmap) = 0; + virtual void drawBitmap(const ::WPXPropertyList &propList, const WPGBitmap& bitmap) = 0; virtual void drawImageObject(const ::WPXPropertyList &propList, const ::WPXBinaryData& binaryData) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- Makefile.am 27 Nov 2008 14:15:17 -0000 1.30 +++ Makefile.am 27 Nov 2008 16:33:00 -0000 1.31 @@ -27,7 +27,6 @@ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ - WPGRect.h \ WPGBitmap.h \ WPGPaintInterface.h @@ -42,7 +41,6 @@ WPGPen.cpp \ WPGColor.cpp \ WPGGradient.cpp \ - WPGRect.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ WPGXParser.cpp \ Index: WPGBitmap.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBitmap.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- WPGBitmap.cpp 24 Nov 2008 10:16:19 -0000 1.22 +++ WPGBitmap.cpp 27 Nov 2008 16:33:00 -0000 1.23 @@ -34,6 +34,29 @@ #include <sstream> #endif +namespace +{ +void writeU16(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); + buffer[position++] = (unsigned char)((value >> 8) & 0xFF); +} + +void writeU32(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); + buffer[position++] = (unsigned char)((value >> 8) & 0xFF); + buffer[position++] = (unsigned char)((value >> 16) & 0xFF); + buffer[position++] = (unsigned char)((value >> 24) & 0xFF); +} + +void writeU8(unsigned char *buffer, unsigned &position, const int value) +{ + buffer[position++] = (unsigned char)(value & 0xFF); +} + +} + class libwpg::WPGBitmap::Private { public: @@ -42,17 +65,17 @@ bool vFlip; bool hFlip; WPGColor* pixels; + ::WPXBinaryData dib; - Private(int w, int h): width(w), height(h), vFlip(false), hFlip(false), pixels(0) {} + Private(int w, int h): width(w), height(h), vFlip(false), hFlip(false), pixels(0), dib() {} }; -libwpg::WPGBitmap::WPGBitmap(int w, int h): rect(), d(new Private(w, h)) +libwpg::WPGBitmap::WPGBitmap(int w, int h): d(new Private(w, h)) { d->pixels = new WPGColor[w*h]; } libwpg::WPGBitmap::WPGBitmap(int w, int h, bool verticalFlip, bool horizontalFlip) : - rect(), d(new Private(w, h)) { d->vFlip = verticalFlip; @@ -70,7 +93,7 @@ } } -libwpg::WPGBitmap::WPGBitmap(const WPGBitmap& bitmap): rect(), d(new Private(0,0)) +libwpg::WPGBitmap::WPGBitmap(const WPGBitmap& bitmap): d(new Private(0,0)) { copyFrom(bitmap); } @@ -83,7 +106,6 @@ void libwpg::WPGBitmap::copyFrom(const WPGBitmap& bitmap) { - rect = bitmap.rect; d->width = bitmap.d->width; d->height = bitmap.d->height; delete [] d->pixels; @@ -118,26 +140,26 @@ d->pixels[y*d->width + x] = color; } -void libwpg::WPGBitmap::generateBase64DIB(::WPXString& bmp) const +const ::WPXBinaryData & libwpg::WPGBitmap::getDIB() const { - if (d->height <= 0 || d->width <= 0) - return; + if (d->dib.size() || d->height <= 0 || d->width <= 0) + return d->dib; unsigned tmpPixelSize = (unsigned)(d->height * d->width); if (tmpPixelSize < (unsigned)d->height) // overflow - return; + return d->dib; unsigned tmpBufferPosition = 0; unsigned tmpDIBImageSize = tmpPixelSize * 4; if (tmpPixelSize > tmpDIBImageSize) // overflow !!! - return; + return d->dib; unsigned tmpDIBOffsetBits = 14 + 40; unsigned tmpDIBFileSize = tmpDIBOffsetBits + tmpDIBImageSize; if (tmpDIBImageSize > tmpDIBFileSize) // overflow !!! - return; + return d->dib; - char *tmpDIBBuffer = new char[tmpDIBFileSize]; + unsigned char *tmpDIBBuffer = new unsigned char[tmpDIBFileSize]; // Create DIB file header writeU16(tmpDIBBuffer, tmpBufferPosition, 0x4D42); // Type @@ -209,7 +231,7 @@ WPG_DEBUG_MSG(("WPGBitmap: DIB file size = %i\n", tmpBufferPosition - 1)); - base64Encode(bmp, tmpDIBBuffer, tmpDIBFileSize); + d->dib.append(tmpDIBBuffer, tmpDIBFileSize); // temporary for debug - dump the binary bmp (need to have write access in the current directory #if DUMP_BITMAP @@ -226,73 +248,6 @@ // Cleanup things before returning delete [] tmpDIBBuffer; -} - -void libwpg::WPGBitmap::writeU16(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); - buffer[position++] = (char)((value >> 8) & 0xFF); -} - -void libwpg::WPGBitmap::writeU32(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); - buffer[position++] = (char)((value >> 8) & 0xFF); - buffer[position++] = (char)((value >> 16) & 0xFF); - buffer[position++] = (char)((value >> 24) & 0xFF); -} - -void libwpg::WPGBitmap::writeU8(char *buffer, unsigned &position, const int value) -{ - buffer[position++] = (char)(value & 0xFF); -} - -void libwpg::WPGBitmap::base64Encode(::WPXString& base64, const char *data, const int len) -{ - static const char* base64Chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - char tempCharsToEncode[3]; - int i = 0; int j = 0; int modifiedLen; - if (len % 3) - modifiedLen = 3 * ((int)(len / 3) + 1); - else - modifiedLen = len; - bool shouldIexit = false; - for (; i < modifiedLen; i++) - { - if (i < len) - tempCharsToEncode[j++] = data[i]; - else - { - tempCharsToEncode[j++] = '\0'; - shouldIexit = true; - } - if (shouldIexit) - { - if (j == 3) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append(base64Chars[((tempCharsToEncode[1] & 0x0f) << 2) | ((tempCharsToEncode[2] & 0xc0) >> 6)]); - base64.append('='); - break; - } - if (j == 2) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append('='); base64.append('='); - break; - } - } - else if (j == 3) - { - base64.append(base64Chars[(tempCharsToEncode[0] & 0xfc) >> 2]); - base64.append(base64Chars[((tempCharsToEncode[0] & 0x03) << 4) | ((tempCharsToEncode[1] & 0xf0) >> 4)]); - base64.append(base64Chars[((tempCharsToEncode[1] & 0x0f) << 2) | ((tempCharsToEncode[2] & 0xc0) >> 6)]); - base64.append(base64Chars[tempCharsToEncode[2] & 0x3f]); - j = 0; - } - } + return d->dib; } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.85 retrieving revision 1.86 diff -u -d -r1.85 -r1.86 --- WPG2Parser.cpp 27 Nov 2008 14:15:17 -0000 1.85 +++ WPG2Parser.cpp 27 Nov 2008 16:33:00 -0000 1.86 @@ -1315,18 +1315,18 @@ long rx = (m_doublePrecision) ? readS32() : readS16(); long ry = (m_doublePrecision) ? readS32() : readS16(); - libwpg::WPGRect rect; - rect.x1 = TO_DOUBLE(xs1) / m_xres; - rect.x2 = TO_DOUBLE(xs2) / m_xres; - rect.y1 = TO_DOUBLE(ys1) / m_yres; - rect.y2 = TO_DOUBLE(ys2) / m_yres; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)(TO_DOUBLE(xs1) / m_xres)); + propList.insert("svg:width", (float)(TO_DOUBLE(xs2-xs1) / m_xres)); + propList.insert("svg:y", (float)(TO_DOUBLE(ys1) / m_yres)); + propList.insert("svg:height", (float)(TO_DOUBLE(ys2-ys1) / m_yres)); - double roundx = TO_DOUBLE(rx)/m_xres; - double roundy = TO_DOUBLE(ry)/m_yres; + propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); + propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); - m_painter->drawRectangle(rect, roundx, roundy); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG((" X1 : %li\n", x1)); WPG_DEBUG_MSG((" Y1 : %li\n", y1)); @@ -1626,10 +1626,11 @@ // prepare the bitmap structure for the listener libwpg::WPGBitmap bitmap(width, height, m_vFlipped, m_hFlipped); - bitmap.rect.x1 = m_bitmap.x1; - bitmap.rect.y1 = m_bitmap.y1; - bitmap.rect.x2 = m_bitmap.x2; - bitmap.rect.y2 = m_bitmap.y2; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)m_bitmap.x1); + propList.insert("svg:y", (float)m_bitmap.y1); + propList.insert("svg:width", (float)(m_bitmap.x2 - m_bitmap.x1)); + propList.insert("svg:height", (float)(m_bitmap.y2 - m_bitmap.y1)); // format 1: each byte represents 8 pixels, the color fetched from the palette if(color_format == 1) @@ -1644,7 +1645,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 2: each byte represents 4 pixels, the color fetched from the palette else if(color_format == 2) @@ -1659,7 +1660,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 3: each byte represents 2 pixels, the color fetched from the palette else if(color_format == 3) @@ -1674,7 +1675,7 @@ const libwpg::WPGColor& color = m_colorPalette[index]; bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 4: each byte represents a pixel, the color fetched from the palette else if(color_format == 4) @@ -1687,7 +1688,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 5: greyscale of 16 bits else if (color_format == 5) @@ -1701,7 +1702,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 6: RGB, with 5 bits per colour else if (color_format == 6) @@ -1715,7 +1716,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } // format 7: else if (color_format == 7) @@ -1729,7 +1730,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 8) { @@ -1741,7 +1742,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 9) { @@ -1753,7 +1754,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } else if (color_format == 12) { @@ -1766,7 +1767,7 @@ bitmap.setPixel(x, y, color); } - m_painter->drawBitmap(bitmap); + m_painter->drawBitmap(propList, bitmap); } Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- libwpg.h.in 27 Nov 2008 14:15:17 -0000 1.9 +++ libwpg.h.in 27 Nov 2008 16:33:00 -0000 1.10 @@ -39,7 +39,6 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGRect.h" #include "WPGBitmap.h" #endif |