diff -u killustrator/filter/ImageExport.cc ki/filter/ImageExport.cc --- killustrator/filter/ImageExport.cc Tue May 22 06:24:30 2001 +++ ki/filter/ImageExport.cc Mon Jul 16 21:52:59 2001 @@ -22,6 +22,8 @@ */ +#include "ImageExport.h" + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -32,29 +34,33 @@ #include #include -#include "ImageExport.h" #include "GDocument.h" #include "GPage.h" #define RESOLUTION 72.0 -ImageExport::ImageExport () { +ImageExport::ImageExport () +{ // #ifdef HAVE_QIMGIO // qInitImageIO (); // #endif } -ImageExport::~ImageExport () { +ImageExport::~ImageExport () +{ } -bool ImageExport::setup (GDocument *, const char* fmt) { +bool ImageExport::setup (GDocument *, const char* fmt) +{ bool formatSupported = false; QStrList formats = QImageIO::outputFormats (); char* str = formats.first (); format = QString (); - while (str) { - if (strcasecmp (str, fmt) == 0) { + while (str) + { + if (strcasecmp (str, fmt) == 0) + { format = fmt; format = format.upper (); formatSupported = true; @@ -65,7 +71,8 @@ return formatSupported; } -bool ImageExport::exportToFile (GDocument* doc) { +bool ImageExport::exportToFile (GDocument* doc) +{ if (format.isNull ()) return false; @@ -78,10 +85,10 @@ if (buffer == 0L) return false; - buffer->fill (Qt::white); + buffer->fill (doc->activePage()->bgColor()); QPainter p; p.begin (buffer); - p.setBackgroundColor (Qt::white); + p.setBackgroundColor (doc->activePage()->bgColor()); p.eraseRect (0, 0, w, h); p.scale (RESOLUTION / 72.0, RESOLUTION / 72.0); @@ -90,27 +97,10 @@ p.end (); - // compute the bounding box - Rect box = doc->activePage()->boundingBoxForAllObjects (); - // and copy the affected area to the new pixmap - //the +1 fixes bug #20361, Alex - QPixmap *pixmap = new QPixmap (qRound (box.width ())+1, - qRound (box.height ())+1); - //kdDebug()<<"export: box.w=="<0) sx--; - if (sy>0) sy--; - bitBlt (pixmap, 0, 0, buffer, sx, sy, - qRound (box.width ())+1, qRound (box.height ())+1); - delete buffer; - // now create an image - QImage img = pixmap->convertToImage (); + QImage img = buffer->convertToImage (); img.setAlphaBuffer (true); - delete pixmap; + delete buffer; // and save the image in requested format return img.save(outputFileName (), format.latin1()); diff -u killustrator/filter/ImageExport.h ki/filter/ImageExport.h --- killustrator/filter/ImageExport.h Thu Jul 9 20:33:31 1998 +++ ki/filter/ImageExport.h Mon Jul 16 21:52:04 2001 @@ -30,7 +30,8 @@ /** * An export filter for image formats. */ -class ImageExport : public ExportFilter { +class ImageExport : public ExportFilter +{ public: ImageExport (); ~ImageExport ();