Exemplo n.º 1
0
void Export::slotAccept()
{
    switch ( group -> selectedId() )
    {
        case 0:
	{
            QString fn = QFileDialog::getSaveFileName( "projects/output/", "PNG sequence ( *.png )", this );
            if ( !fn.isEmpty() )
	    {
        	if ( k_toon -> scenes() -> exportAnimation( fn, "PNG" ) > 0 )
        	    k_toon -> statusBar() -> message( tr( "Animation Exported Successfully" ), 2000 );
        	else
        	    k_toon -> statusBar() -> message( tr( "Could not Export Animation" ), 2000 );
	    }
	    break;
	}
        case 1:
	{
            QString fn = QFileDialog::getSaveFileName( "projects/output/", "Single PNG ( *.png )", this );
            if ( !fn.isEmpty() )
	    {
		QPixmap exp;
		fn = fn + ".png";
		exp.convertFromImage( k_toon -> renderCameraPreview() -> grabFrameBuffer() );
		if ( !exp.save( fn, "PNG" ) )
		     k_toon -> statusBar() -> message( tr( "Could not save the file: %1" ).arg( fn ), 2000 );
	    }
	    break;
	}
        case 2:
	{
            QString fn = QFileDialog::getSaveFileName( "projects/output/", "Macromedia Flash ( *.swf )", this );
            if ( !fn.isEmpty() )
	    {
	        int number_of_images = k_toon -> scenes() -> exportAnimation( fn, "JPEG" );
        	if ( number_of_images > 0 )
		{
		    int frame_rate = k_toon -> currentStatus() -> currentFrameRate();

		    SWFMovie *movie = doMovie( 360, 280 );
  		    movie -> setRate( ( float )frame_rate );
  		    QStringList images;

		    for ( int i = 1; i < number_of_images; i++ )
  		    {
     			QString iterator = QString::number( i );
     			iterator = iterator.rightJustify( 3, '0' );
     			images << QString( fn + iterator + ".jpg" );
  		    }

  		    SWFDisplayItem *frame = doAnimation( movie, images );
		    frame -> addColor( 255, 0, 0 );

  		    if ( movie -> save( ( char * )( fn + ".swf" ).latin1() ) < 0 )
        	        k_toon -> statusBar() -> message( tr( "Could not Export Animation" ), 2000 );
		    else
		        k_toon -> statusBar() -> message( tr( "Animation Exported Successfully" ), 2000 );

		    for ( int i = 1; i < number_of_images; i++ )
  		    {
     			QString iterator = QString::number( i );
     			iterator = iterator.rightJustify( 3, '0' );
     			QFile::remove( fn + iterator + ".jpg" );
  		    }
		}
        	else
        	    k_toon -> statusBar() -> message( tr( "Could not Export Animation" ), 2000 );
	    }
	    break;
	}
	case 3:
	{
            QString fn = QFileDialog::getSaveFileName( "projects/output/", "Scalable Vector Graphics ( *.svg )", this );
            if ( !fn.isEmpty() )
	    {
		QPixmap exp;
		fn = fn + ".svg";
		exp.convertFromImage( k_toon -> renderCameraPreview() -> grabFrameBuffer() );

		QPainter painter;
		QPicture picture;

		painter.begin( &picture );
		painter.drawPixmap( 0, 0, exp );
		painter.end();

		if ( picture.save( fn, "svg" ) )
		    k_toon -> statusBar() -> message( tr( "SVG Exported Successfully" ), 2000 );
		else
		    k_toon -> statusBar() -> message( tr( "Could not Export SVG" ), 2000 );
	    }
	    break;
	}
	default: break;
    }

    close( true );
}
Exemplo n.º 2
0
int main ( int argc, char **argv )
/*----------------------------------------------------------------------- */
/*   Obit task to make ionospheric movie from an SN table                 */
/*----------------------------------------------------------------------- */
{
  oint         ierr = 0;
  olong        ntime = 0;
  ObitSystem   *mySystem= NULL;
  ObitUV       *inData = NULL;
  ObitImage    *outImage = NULL;
  ObitErr      *err= NULL;

   /* Startup - parse command line */
  err = newObitErr();
  myInput = IonMovieIn (argc, argv, err);
  if (err->error) {ierr = 1;  ObitErrLog(err);  goto exit;}

  /* Initialize logging */
  ObitErrInit (err, (gpointer)myInput);

  ObitErrLog(err); /* show any error messages on err */
  if (ierr!=0) return 1;

  /* Initialize Obit */
  mySystem = ObitSystemStartup (pgmName, pgmNumber, AIPSuser, nAIPS, AIPSdirs, 
				nFITS, FITSdirs, (oint)TRUE, (oint)FALSE, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* Digest input */
  digestInputs(myInput, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* Get input uvdata */
  inData = getInputData (myInput, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* Count times in SN table */
  ntime = doMovie (myInput, inData, NULL, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* Create output image */
  outImage = setOutput (myInput, ntime, inData, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* Process */
  doMovie (myInput, inData, outImage, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* History */
  IonMovieHistory (myInput, inData, outImage, err);
  if (err->error) ierr = 1; ObitErrLog(err); if (ierr!=0) goto exit;

  /* cleanup */
  myInput   = ObitInfoListUnref(myInput);    /* delete input list */
  inData    = ObitUnref(inData);
  outImage  = ObitUnref(outImage);
  
  /* Shutdown Obit */
 exit: 
  ObitReturnDumpRetCode (ierr, outfile, myOutput, err);  /* Final output */
  myOutput = ObitInfoListUnref(myOutput);   /* delete output list */
  mySystem = ObitSystemShutdown (mySystem);
  
  return ierr;
} /* end of main */