In Hurricane, make image snaphot great again.

This commit is contained in:
Jean-Paul Chaput 2017-11-18 12:14:56 +01:00
parent a8322252ce
commit 3b093bf129
4 changed files with 36 additions and 26 deletions

View File

@ -126,22 +126,33 @@ namespace Hurricane {
_flags = flags; _flags = flags;
int scale = 80 * Cfg::getParamEnumerate("viewer.printer.mode")->asInt(); //int scale = 80 * Cfg::getParamEnumerate("viewer.printer.mode")->asInt();
_drawingWidth = _cellWidget->width ()*scale; int scale = (Graphics::isHighDpi()) ? 1 : 2;
_drawingHeight = _cellWidget->height()*scale; _drawingWidth = _cellWidget->width () * scale;
_drawingHeight = _cellWidget->height() * scale;
_image = new QImage( _drawingWidth _image = new QImage( _drawingWidth
, _drawingHeight + ((_flags&ShowScale) ? 60 : 0) , _drawingHeight + ((_flags&ShowScale) ? 60 : 0)
, QImage::Format_RGB32 ); , QImage::Format_RGB32 );
// Compute the delta size between CellImage and CellWidget. // Compute the delta size between CellPrinter and CellWidget.
cerr << "CellImage:" << geometry().width() << "x" << geometry().height() << endl; cerr << "Image/Screen settings:" << endl;
cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; //cerr << " Screen Resolution (DPI): " << resolution() << endl;
cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl; cerr << " CellImage: " << geometry().width() << "x" << geometry().height() << endl;
cerr << "AbutmentBox:" << _cellWidget->getCell()->getAbutmentBox() << endl; cerr << " CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl;
cerr << "visibleArea:" << _cellWidget->getVisibleArea() << endl; cerr << " ScreenCellWidget: " << _screenCellWidget->geometry().width() << "x" << _screenCellWidget->geometry().height() << endl;
cerr << " resize: " << _drawingWidth << "x" << _drawingHeight << endl;
cerr << " AbutmentBox: " << _cellWidget->getCell()->getAbutmentBox() << endl;
cerr << " visibleArea: " << _cellWidget->getVisibleArea() << endl;
resize ( _drawingWidth, _drawingHeight ); // Compute the delta size between CellImage and CellWidget.
// cerr << "CellImage:" << geometry().width() << "x" << geometry().height() << endl;
// cerr << "CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl;
// cerr << "resize: " << _drawingWidth << "x" << _drawingHeight << endl;
// cerr << "AbutmentBox:" << _cellWidget->getCell()->getAbutmentBox() << endl;
// cerr << "visibleArea:" << _cellWidget->getVisibleArea() << endl;
resize( _drawingWidth, _drawingHeight );
Box visibleArea = _screenCellWidget->getVisibleArea(); Box visibleArea = _screenCellWidget->getVisibleArea();
if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) { if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) {
@ -151,9 +162,9 @@ namespace Hurricane {
_cellWidget->reframe( _screenCellWidget->getVisibleArea() ); _cellWidget->reframe( _screenCellWidget->getVisibleArea() );
} }
cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl; cerr << " After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl;
cerr << "visibleArea(image):" << _cellWidget->getVisibleArea() << endl; cerr << " VisibleArea(printer): " << _cellWidget->getVisibleArea() << endl;
cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl; cerr << " VisibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl;
//cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << endl; //cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << endl;
//cerr << "(w,h) = (" << w << "," << h << ")" << endl; //cerr << "(w,h) = (" << w << "," << h << ")" << endl;

View File

@ -8,7 +8,7 @@
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./CellPrinter.cpp" | // | C++ Module : "./CellPrinter.cpp" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
@ -330,7 +330,7 @@ namespace Hurricane {
// swap( _xpaper , _ypaper ); // swap( _xpaper , _ypaper );
// } // }
resize ( _drawingWidth, _drawingHeight ); resize( _drawingWidth, _drawingHeight );
Box visibleArea = _screenCellWidget->getVisibleArea(); Box visibleArea = _screenCellWidget->getVisibleArea();
if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) { if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) {

View File

@ -2,28 +2,27 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved // Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./hurricane/viewer/CellImage.h" | // | C++ Header : "./hurricane/viewer/CellImage.h" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#ifndef __HURRICANE_CELL_IMAGE__ #ifndef HURRICANE_CELL_IMAGE_H
#define __HURRICANE_CELL_IMAGE__ #define HURRICANE_CELL_IMAGE_H
#include <list> #include <list>
using namespace std; using namespace std;
#include <QMainWindow> #include <QMainWindow>
class QEvent; class QEvent;
class QKeyEvent; class QKeyEvent;

View File

@ -2,21 +2,21 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved // Copyright (c) UPMC/LIP6 2012-2016, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./hurricane/viewer/CellPrinter.h" | // | C++ Header : "./hurricane/viewer/CellPrinter.h" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#ifndef __HURRICANE_CELL_PRINTER__ #ifndef HURRICANE_CELL_PRINTER_H
#define __HURRICANE_CELL_PRINTER__ #define HURRICANE_CELL_PRINTER_H
#include <list> #include <list>