]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
It merges changes from BR_QT4_Dev for dumpView() functionality.
authornds <nds@opencascade.com>
Thu, 31 Jul 2008 12:31:23 +0000 (12:31 +0000)
committernds <nds@opencascade.com>
Thu, 31 Jul 2008 12:31:23 +0000 (12:31 +0000)
src/SVTK/SVTK_MainWindow.cxx

index 9e981c9289596777cdfbc1b76bbc869b1e648ba2..106edad4a3173555ffc62ddb54945798e5e27e07 100644 (file)
@@ -57,6 +57,7 @@
 
 #include <vtkGenericRenderWindowInteractor.h>
 #include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
 
 /*!
   Constructor
@@ -930,8 +931,19 @@ QImage
 SVTK_MainWindow
 ::dumpView()
 {
-  QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
-  return px.toImage();
+  vtkRenderWindow* aWindow = GetInteractor()->getRenderWindow();
+  int* aSize = aWindow->GetSize();
+  int aWidth = aSize[0];
+  int aHeight = aSize[1];
+  
+  unsigned char *aData = 
+    aWindow->GetRGBACharPixelData( 0, 0, aWidth-1, aHeight-1, 0 );
+  
+  QImage anImage( aData, aWidth, aHeight, QImage::Format_ARGB32 );
+
+  anImage = anImage.rgbSwapped();
+  anImage = anImage.mirrored();
+  return anImage;
 }
 
 /*!