Changeset 649


Ignore:
Timestamp:
Dec 10, 2007, 7:06:14 PM (17 years ago)
Author:
garnier
Message:

modif pour la sauvegarde en EPS

File:
1 edited

Legend:

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

    r639 r649  
    288288  printf("G4OpenGLQtViewer::~G4OpenGLQtViewer \n");
    289289#endif
    290   delete fContextMenu;
    291290}
    292291
     
    13081307  FILE* fp;
    13091308
    1310   if ((!aImage.isGrayscale ()) &&(aInColor ==1 )) {
    1311 #if QT_VERSION < 0x040000
    1312     aImage = aImage.convertDepth(1,Qt::MonoOnly);
    1313 #else
    1314     aImage = aImage.convertToFormat ( aImage.format(), Qt::MonoOnly);
    1315 #endif
    1316   }
    1317   const uchar * pixels = aImage.bits ();
    1318    
    1319   if (pixels == NULL)
     1309  if (aImage.bits () == NULL)
    13201310    return false;
    13211311 
     
    13721362  int size = width*height;
    13731363 
     1364
    13741365  if (depth == 1)
    13751366    size = (width+7)/8*height;
     
    13781369 
    13791370  int i = 0;
    1380   if (depth == 1) {
    1381     //  To be implemented
    1382     //    QImage::Endian bitOrder = aImage.bitOrder();
    1383     /*    for(int y=0; y < height; y++) {
    1384       const uchar * s = aImage.scanLine(y);
    1385       for(int x=0; x < width; x++) {
    1386         // need to copy bit for bit...
    1387         bool b = (bitOrder == QImage::LittleEndian) ?
    1388           (*(s + (x >> 3)) >> (x & 7)) & 1 :
    1389           (*(s + (x >> 3)) << (x & 7)) & 0x80 ;
    1390         if (b)
    1391           pixel[i >> 3] ^= (0x80 >> (i & 7));
    1392         i++;
    1393       }
    1394       // we need to align to 8 bit here
    1395       i = (i+7) & 0xffffff8;
    1396     }
    1397     */
    1398   } else if (depth == 8) {
     1371  //  if ( aInColor ==1 ) {
     1372  // FIXME : L. Garnier. For the moment 10 dec 2007, I could not find a way
     1373  // to save correctly grayscale Image. I mean that color or grayscale image
     1374  // have the same file save size !
     1375 
     1376  /* } else*/ if (depth == 8) {
    13991377    for(int y=height-1; y >=0 ; y--) {
    14001378      const uchar * s = aImage.scanLine(y);
     
    14161394  } else {
    14171395#if QT_VERSION < 0x040000
    1418   G4cerr << "GenerateEPS:: No alpha channel image with Qt3. This is only supported with Qt4\n" << G4endl;
     1396    bool alpha = aImage.hasAlphaBuffer();
    14191397#else
    14201398    bool alpha = aImage.hasAlphaChannel();
    1421 #ifdef GEANT4_QT_DEBUG
    1422     printf("has else %d alpha %d\n",depth,alpha);
    1423 #endif
    14241399    for(int y=height-1; y >=0 ; y--) {
    14251400      QRgb * s = (QRgb*)(aImage.scanLine(y));
Note: See TracChangeset for help on using the changeset viewer.