Changeset - 5ec450ff7c49
[Not reviewed]
default
0 5 0
Michael Guravage - 15 years ago 2010-10-19 12:56:46
michael.guravage@cwi.nl
Render PNGs instead of JPGs. See ChangeLogs for details.

--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/TutorialCode/Tutorial3/ChangeLog
changed src/TutorialCode/Tutorial3/tutorial3_init.xml
changed src/VirtualLeaf.cpp
changed src/mainbase.cpp
5 files changed with 25 insertions and 29 deletions:
0 comments (0 inline, 0 general)
src/ChangeLog
Show inline comments
 
2010-10-19    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): Use format specified in function prototype.
 

	
 
	* VirtualLeaf.cpp (Plot): Render PNG instead of JPEG. Write image
 
	and XML files dependent only on getTime().
 

	
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* mainbase.cpp (Save): QDir::toNativeSeparators(fname). Invoke
src/TutorialCode/Tutorial3/ChangeLog
Show inline comments
 
2010-10-19    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* tutorial3_init.xml (public): Render PNG instead of JPEG.
 

	
 
2010-10-18    <guravage@caterpie.sen.cwi.nl>
 

	
 
	* Makefile (Makefile.tutorial3): Removed -makefile qmake option.
src/TutorialCode/Tutorial3/tutorial3_init.xml
Show inline comments
 
@@ -339,17 +339,17 @@ void MainBase::Plot(int resize_stride) {
 
				frame++;
 
			}
 
			
 
			// Write high-res JPG snapshot every plot step
 
			// Write high-res PDF snapshot every plot step
 
			Save(fname.str().c_str(), "PDF");
 
			*/
 
			
 
			fname &lt;&lt; frame &lt;&lt; ".jpg";
 
			fname &lt;&lt; frame &lt;&lt; ".png";
 
			if (par.storage_stride &lt;= par.xml_storage_stride) {
 
				frame++;
 
			}
 
			
 
			// Write high-res JPG snapshot every plot step
 
			Save(fname.str().c_str(), "JPEG",1024,768);
 
			// Write high-res PNG snapshot every plot step
 
			Save(fname.str().c_str(), "PNG",1024,768);
 
			
 
		}
 
	
src/VirtualLeaf.cpp
Show inline comments
 
@@ -146,7 +146,8 @@ void MainBase::Plot(int resize_stride)
 

	
 
  clear();
 

	
 
  static int count=0;
 
  int count=(int)mesh.getTime();
 

	
 
  if (resize_stride) {
 
    if ( !((count)%resize_stride) ) {
 
      FitLeafToCanvas();
 
@@ -179,24 +180,14 @@ void MainBase::Plot(int resize_stride)
 
    mesh.DrawBoundary(&canvas);
 

	
 
  if ( ( batch || MovieFramesP() )) {
 

	
 
     static int frame = 0;
 
    // frame numbers are sequential for the most frequently written file type.
 
    // for the less frequently written file type they match the other type
 
    if (!(count%par.storage_stride) )  {
 

	
 
    if (!(count%par.storage_stride) ) {
 
      stringstream fname;
 
      fname << par.datadir << "/leaf.";
 
      fname.fill('0');
 
      fname.width(6);
 

	
 
      fname << frame << ".jpg";
 
      if (par.storage_stride <= par.xml_storage_stride) {
 
	frame = (int)mesh.getTime();
 
      }
 

	
 
      // Write high-res JPG snapshot every plot step
 
      Save(fname.str().c_str(), "JPEG",1024,768);
 
      fname << count << ".png";
 
      // Write high-res PNG snapshot every plot step
 
      Save(fname.str().c_str(), "PNG", 1024, 768);
 
    }
 

	
 
    if (!(count%par.xml_storage_stride)) {
 
@@ -204,20 +195,14 @@ void MainBase::Plot(int resize_stride)
 
      fname << par.datadir << "/leaf.";
 
      fname.fill('0');
 
      fname.width(6);
 
      fname << frame << ".xml";
 

	
 
      if (par.xml_storage_stride < par.storage_stride) {
 
	frame = (int)mesh.getTime();
 
      }
 
      fname << count << ".xml";
 
      // Write XML file every ten plot steps
 
      mesh.XMLSave(fname.str().c_str(), XMLSettingsTree());
 
    }
 
  }
 
 count++;
 
}
 

	
 

	
 

	
 
INIT {
 

	
 
  //mesh.SetSimPlugin(plugin);
src/mainbase.cpp
Show inline comments
 
@@ -344,9 +344,9 @@ void MainBase::Save(const char *fname, c
 
#ifdef QDEBUG
 
    qDebug() << "Native Image Filename: " << QDir::toNativeSeparators(QString(fname)) << endl;
 
#endif
 
    if (!image->save(QDir::toNativeSeparators(QString(fname)), 0, -1)) {
 
    if (!image->save(QDir::toNativeSeparators(QString(fname)), format)) {
 
      MyWarning::warning("Image not saved successfully. Is the disk full or the extension not recognized?");
 
    };
 
    }
 
    delete painter;
 
    delete image;
 
  } else {
 
@@ -355,7 +355,7 @@ void MainBase::Save(const char *fname, c
 
    pdf.setOutputFormat(QPrinter::PdfFormat);
 
    QPainter painter(&pdf);
 
    canvas.render(&painter, QRectF(), QRectF(-5000,-5000, 10000, 10000));
 

	
 
    
 
    cerr << "Rendering to printer\n";
 
  }
 
}
0 comments (0 inline, 0 general)