Ignore:
Timestamp:
Sep 26, 2007, 12:17:26 PM (17 years ago)
Author:
garnier
Message:

r610@mac-90108: laurentgarnier | 2007-09-25 16:54:15 +0200
boite de dialogue presque ok, reste plus qu a connecter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r583 r585  
    116116//////////////////////////////////////////////////////////////////////////////
    117117void G4OpenGLQtViewer::CreateMainWindow (
    118                                          QGLWidget* glWidget
    119                                          )
     118 QGLWidget* glWidget
     119)
    120120//////////////////////////////////////////////////////////////////////////////
    121121//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
     
    676676  nomFich += "."+selectedFilter->toLower();
    677677  printf("G4OpenGLQtViewer::name %s\n",nomFich.toStdString().c_str());
    678   if(nomFich.endsWith(".eps")) {
    679     G4cerr << "This version of G4UI Could not generate EPS." << G4endl;
    680   } else if(nomFich.endsWith(".jpg") || nomFich.endsWith(".jpeg")) {
    681     G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
    682     int res = exportDialog->exec();
    683     printf("G4OpenGLQtViewer::actionCreateEPS() --%d-- quality:\n",res);
    684     fWindow->grabFrameBuffer().save(nomFich);
    685   } else {
    686     fWindow->grabFrameBuffer().save(nomFich);
    687     // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included.
     678  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
     679  if(  exportDialog->exec()) {
     680   
     681    printf("rescaling before\n");
     682    QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ;//fWindow->grabFrameBuffer();
     683    printf("rescaling after\n");
     684     
     685    if ((exportDialog->getWidth() !=fWindow->width()) ||
     686         (exportDialog->getWidth() !=fWindow->width())) {
     687
     688      //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
     689      printf("rescaling\n");
     690    }
     691   
     692    // jpeg format
     693    if (nomFich.endsWith(".jpg") ||
     694        nomFich.endsWith(".jpeg")) {
     695      // grabFrameBuffer() :: Returns an image of the frame buffer. If withAlpha is true the alpha channel is included.
     696      pixmap->save(nomFich,0,exportDialog->getSliderValue());
     697      printf("saving jpeg quality : %d\n",exportDialog->getSliderValue());
     698    } else if (nomFich.endsWith(".eps")) {
     699      printf("saving EPS\n");
     700    } else if (nomFich.endsWith(".tif") ||
     701               nomFich.endsWith(".tiff") ||
     702               nomFich.endsWith(".jpg") ||
     703               nomFich.endsWith(".png") ||
     704               nomFich.endsWith(".bmp") ||
     705               nomFich.endsWith(".xpm")) {
     706      pixmap->save(nomFich,0,exportDialog->getSliderValue());
     707      printf("saving ELSE\n");
     708    } else {
     709      G4cerr << "This version of G4UI Could not generate the selected format" << G4endl;
     710    }
     711   
     712  } else { // cancel selected
     713    return;
    688714  }
    689715 
     
    910936}
    911937
    912 
     938void G4OpenGLQtViewer::rescaleImage(
     939 int aWidth
     940,int aHeight
     941){
     942  printf("");
     943}
    913944#endif
Note: See TracChangeset for help on using the changeset viewer.