]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0023463: [EDF] dumpView() in OCC viewer produces incorrect image
authorvsr <vsr@opencascade.com>
Fri, 7 Jul 2017 12:16:04 +0000 (15:16 +0300)
committervsr <vsr@opencascade.com>
Fri, 7 Jul 2017 12:16:04 +0000 (15:16 +0300)
- Second attempt, with direct transfer of each pixel

src/OCCViewer/OCCViewer_ViewWindow.cxx

index c6bfdc7fd877658267c24f5c63a1efa65b4c467e..de787bc3a2a0973190a30f62dc495579d796fe28 100644 (file)
@@ -2281,8 +2281,18 @@ QImage OCCViewer_ViewWindow::dumpView()
 
   Image_PixMap aPix;
   view->ToPixMap(aPix, aWidth, aHeight, Graphic3d_BT_RGB);
-  QImage anImage( aPix.Data(), aWidth, aHeight, QImage::Format_RGB888 );
-  anImage = anImage.mirrored();
+  
+  QImage anImage( aWidth, aHeight, QImage::Format_ARGB32 );
+  for ( int i = 0; i < aWidth; i++ ) {
+    for ( int j = 0; j < aHeight; j++ ) {
+      Quantity_Color pixel = aPix.PixelColor( i, j );
+      QColor color = QColor::fromRgbF( pixel.Red(), pixel.Green(), pixel.Blue() );
+      anImage.setPixelColor( i, j, color );
+    }
+  }
+    
+  if ( aPix.IsTopDown() )
+    anImage = anImage.mirrored();
   return anImage;
 
 #endif // USE_OLD_IMPLEMENTATION