int aHeight = myViewPort->height();
Image_PixMap aPix;
- view->ToPixMap( aPix,aWidth, aHeight,Graphic3d_BT_RGBA );
+#if OCC_VERSION_LARGE >= 0x07020000
+ view->ToPixMap( aPix,aWidth, aHeight,Graphic3d_BT_RGBA );
QImage anImage( aPix.Data(), aWidth, aHeight, QImage::Format_ARGB32 );
anImage = anImage.mirrored();
anImage = anImage.rgbSwapped();
-
+#else
+ view->ToPixMap(aPix, aWidth, aHeight, Graphic3d_BT_RGB);
+ 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 ).GetRGB();
+ QColor color = QColor::fromRgbF( pixel.Red(), pixel.Green(), pixel.Blue() );
+ anImage.setPixelColor( i, j, color );
+ }
+ }
+ if ( aPix.IsTopDown() )
+ anImage = anImage.mirrored();
+#endif
if( myBand && myBand->isVisible() )
{
QPixmap aPixmap = QPixmap::fromImage( anImage );
myBand->render( &aPixmap, p );
anImage = aPixmap.toImage();
}
-
return anImage;
}
QImage aMain = TestViewer::viewWindow()->getView(OCCViewer_ViewFrame::MAIN_VIEW)->dumpView();
QImage anOverview = myOverview->dump();
- aMain = aMain.rgbSwapped(); //PATCH for image came from OCCT dump
+ if (SWAP_RGB)
+ aMain = aMain.rgbSwapped(); //PATCH for image came from OCCT dump
//anOverview = anOverview.rgbSwapped(); //overview dump already normalizes the image, the line is not necessary!!!
int w1 = aMain.width();
QPainter painter( &pix );
painter.setPen( PSOLID );
- painter.drawRect( WIDTH, WIDTH, w2, h2 );
- painter.drawRect( w2+WIDTH, WIDTH, w1, h1 );
-
//static int q = 0;
//q++;
//anOverview.save( QString( "/tmp/hydro/overview_" ) + QString::number( q ) + ".png" );
painter.drawImage( WIDTH, WIDTH, anOverview );
painter.drawImage( w2+WIDTH, WIDTH, aMain );
+ painter.drawRect( WIDTH, WIDTH, w2, h2 );
+ painter.drawRect( w2+WIDTH, WIDTH, w1, h1 );
+
QImage res = pix.toImage();
//res.save( QString( "/tmp/hydro/result_" ) + QString::number( q ) + ".png" );