Changeset - 3809c04020b4
[Not reviewed]
default
0 1 0
Roeland Merks - 15 years ago 2010-11-29 17:21:54
roeland.merks@cwi.nl
Note: I only fixed the PDF problem. Not the other issues.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/mainbase.cpp
Show inline comments
 
@@ -321,24 +321,25 @@ void MainBase::XMLReadSettings(xmlNode *
 

	
 
int MainBase::Save(const char *fname, const char *format, int sizex, int sizey)
 
{
 

	
 
  Vector ll,ur;
 
  mesh.BoundingBox(ll, ur);
 

	
 
  if (QString(fname).isEmpty()) {
 
    MyWarning::warning("No output filename given. Saving nothing.\n");
 
    return 1;
 
  }
 

	
 
  
 
  ll*=Cell::Magnification(); ur*=Cell::Magnification();
 

	
 
  // give the leaf some space
 
  Vector border = ((ur-ll)/5.);
 
  
 
  if (!QString(format).contains("PDF", Qt::CaseInsensitive)) {
 

	
 
    QImage *image = new QImage(QSize(sizex, sizey), QImage::Format_RGB32);
 
    image->fill(QColor(Qt::white).rgb());
 
    QPainter *painter=new QPainter(image);
 
    canvas.render(painter);
 
#ifdef QDEBUG
 
@@ -348,25 +349,25 @@ int MainBase::Save(const char *fname, co
 
      MyWarning::warning("Image '%s' not saved successfully. Is the disk full or the extension not recognized?",fname);
 
      delete painter;
 
      delete image;
 
      return 1;
 
    } 
 
    delete painter;
 
    delete image;
 
  } else {
 
    QPrinter pdf(QPrinter::HighResolution);
 
    pdf.setOutputFileName(fname);
 
    pdf.setOutputFormat(QPrinter::PdfFormat);
 
    QPainter painter(&pdf);
 
    canvas.render(&painter, QRectF(), QRectF(-5000,-5000, 10000, 10000));
 
    canvas.render(&painter, QRectF(), QRectF(-500,-500, 1000, 1000)); // NB Fiddle with these arguments if relative size of PDF images is important.
 
    
 
    cerr << "Rendering to printer\n";
 
  }
 
  return 0;
 
}
 

	
 
void MainBase::CutSAM()
 
{
 
  mesh.CutAwaySAM();
 
}
 

	
 
/* finis */
0 comments (0 inline, 0 general)