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;
int scale = 80 * Cfg::getParamEnumerate("viewer.printer.mode")->asInt();
_drawingWidth = _cellWidget->width ()*scale;
_drawingHeight = _cellWidget->height()*scale;
//int scale = 80 * Cfg::getParamEnumerate("viewer.printer.mode")->asInt();
int scale = (Graphics::isHighDpi()) ? 1 : 2;
_drawingWidth = _cellWidget->width () * scale;
_drawingHeight = _cellWidget->height() * scale;
_image = new QImage( _drawingWidth
, _drawingHeight + ((_flags&ShowScale) ? 60 : 0)
, QImage::Format_RGB32 );
// 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;
// Compute the delta size between CellPrinter and CellWidget.
cerr << "Image/Screen settings:" << endl;
//cerr << " Screen Resolution (DPI): " << resolution() << endl;
cerr << " CellImage: " << geometry().width() << "x" << geometry().height() << endl;
cerr << " CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << 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();
if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) {
@ -151,9 +162,9 @@ namespace Hurricane {
_cellWidget->reframe( _screenCellWidget->getVisibleArea() );
}
cerr << "After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl;
cerr << "visibleArea(image):" << _cellWidget->getVisibleArea() << endl;
cerr << "visibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl;
cerr << " After resize CellWidget: " << _cellWidget->geometry().width() << "x" << _cellWidget->geometry().height() << endl;
cerr << " VisibleArea(printer): " << _cellWidget->getVisibleArea() << endl;
cerr << " VisibleArea(screen): " << _screenCellWidget->getVisibleArea() << endl;
//cerr << "(xpaper,ypaper) = (" << xpaper << "," << ypaper << ")" << 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 |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./CellPrinter.cpp" |
// +-----------------------------------------------------------------+
@ -330,7 +330,7 @@ namespace Hurricane {
// swap( _xpaper , _ypaper );
// }
resize ( _drawingWidth, _drawingHeight );
resize( _drawingWidth, _drawingHeight );
Box visibleArea = _screenCellWidget->getVisibleArea();
if ( visibleArea.contains(_screenCellWidget->getCell()->getAbutmentBox()) ) {

View File

@ -2,28 +2,27 @@
// -*- C++ -*-
//
// 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 |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | 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" |
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_CELL_IMAGE__
#define __HURRICANE_CELL_IMAGE__
#ifndef HURRICANE_CELL_IMAGE_H
#define HURRICANE_CELL_IMAGE_H
#include <list>
#include <list>
using namespace std;
#include <QMainWindow>
#include <QMainWindow>
class QEvent;
class QKeyEvent;

View File

@ -2,21 +2,21 @@
// -*- C++ -*-
//
// 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 |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | 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" |
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_CELL_PRINTER__
#define __HURRICANE_CELL_PRINTER__
#ifndef HURRICANE_CELL_PRINTER_H
#define HURRICANE_CELL_PRINTER_H
#include <list>