[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_2_BRANCH: kdelibs/kimgio
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-07-16 11:26:42
Message-ID: 20040716112642.31F4F16AFD () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

Fix saving of EPS files. (BR85217)


  M +7 -14     eps.cpp   1.24.2.1


--- kdelibs/kimgio/eps.cpp  #1.24:1.24.2.1
@@ -248,5 +248,5 @@ void kimgio_eps_read (QImageIO *image)
 void kimgio_eps_write( QImageIO *imageio )
 {
-  QPrinter psOut;
+  QPrinter psOut(QPrinter::PrinterResolution);
   QPainter p;
 
@@ -255,5 +255,6 @@ void kimgio_eps_write( QImageIO *imageio
   psOut.setOutputToFile( true );
 
-  KTempFile tmpFile;
+  // Extension must be .eps so that Qt generates EPS file
+  KTempFile tmpFile(QString::null, ".eps");
   tmpFile.setAutoDelete(true);
   if ( tmpFile.status() != 0)
@@ -262,21 +263,15 @@ void kimgio_eps_write( QImageIO *imageio
 
   psOut.setOutputFileName(tmpFile.name());
+  psOut.setFullPage(true);
 
   // painting the pixmap to the "printer" which is a file
   p.begin( &psOut );
-
-  p.translate( -36, 820 - imageio->image().height() );
-
+  // Qt uses the clip rect for the bounding box
+  p.setClipRect( 0, 0, imageio->image().width(), imageio->image().height(), QPainter::CoordPainter);
   p.drawImage( QPoint( 0, 0 ), imageio->image() );
   p.end();
 
-  // write BoundingBox to File
+  // Copy file to imageio struct
   QFile inFile(tmpFile.name());
-  QString szBoxInfo;
-
-  szBoxInfo.sprintf("%%%%BoundingBox: 0 0 %d %d\n", 
-                    imageio->image().width(),
-                    imageio->image().height());
-
   inFile.open( IO_ReadOnly );
 
@@ -288,5 +283,4 @@ void kimgio_eps_write( QImageIO *imageio
   QString szInLine = in.readLine();
   out << szInLine << '\n';
-  out << szBoxInfo;
 
   while( !in.atEnd() ){


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic