Commit 31aed5c4 authored by Marlin Frickenschmidt's avatar Marlin Frickenschmidt

Extended the snapshot dialog to allow setting the level of multisampling

Fixed small bug in menu bar (orthogonal/perspective projection option)
Renaming to diversify between examiner and viewer snapshot functions; this is also reflected in the menu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9963 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c02efc38
......@@ -336,10 +336,17 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
//====================================================================================================
QAction* snapshot = _menu->addAction(tr("Snapshot"));
snapshot->setToolTip(tr("Make a snapshot"));
snapshot->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
connect(snapshot, SIGNAL(triggered()), this, SLOT( slotSnapshot() ) );
QAction* snapshot_examiner = _menu->addAction(tr("Examiner Snapshot"));
snapshot_examiner->setToolTip(tr("Take a snapshot of the current examiner"));
snapshot_examiner->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
connect(snapshot_examiner, SIGNAL(triggered()), this, SLOT( slotExaminerSnapshot() ) );
//====================================================================================================
QAction* snapshot_viewer = _menu->addAction(tr("Viewer Snapshot"));
snapshot_viewer->setToolTip(tr("Take a snapshot of the whole viewer"));
snapshot_viewer->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"snapshot.png") );
connect(snapshot_viewer, SIGNAL(triggered()), this, SLOT( viewerSnapshotDialog() ) );
}
......
......@@ -693,7 +693,7 @@ public:
void slotUpdateViewerDrawMenu();
/// Create a snapshot of the last active examiner
void slotSnapshot();
void slotExaminerSnapshot();
/// Show / hide wheels
void slotSwitchWheels(bool _state);
......
......@@ -249,6 +249,15 @@ void CoreWidget::setupMenuBar()
connect( orthogonalProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalOrthographicProjection() ) );
renderingOptionsMenu->addAction( orthogonalProjectionAction_);
perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
perspectiveProjectionAction_->setCheckable( false );
perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
"Switch to <b>perspective</b> projection mode."));
connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
renderingOptionsMenu->addAction( perspectiveProjectionAction_);
// =====================
globalAnimationAction_ = renderingOptionsMenu->addAction(tr("Animation"));
......@@ -347,15 +356,6 @@ void CoreWidget::setupMenuBar()
connect( appSnapShotAction,SIGNAL( triggered() ), this, SLOT( applicationSnapshotDialog() ) );
viewMenu_->addAction( appSnapShotAction);
perspectiveProjectionAction_ = new QAction( tr("Switch Viewers to Perspective Projection"), viewMenu_ );;
perspectiveProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
perspectiveProjectionAction_->setCheckable( false );
perspectiveProjectionAction_->setStatusTip( tr("Switch to perspective projection mode."));
perspectiveProjectionAction_->setWhatsThis( tr("Switch projection mode<br><br>"
"Switch to <b>perspective</b> projection mode."));
connect( perspectiveProjectionAction_,SIGNAL( triggered() ), this, SLOT( slotGlobalPerspectiveProjection() ) );
viewMenu_->addAction( perspectiveProjectionAction_);
viewMenu_->addSeparator();
QAction* wheelSwitchAction = new QAction( tr("Show / hide wheels"), viewMenu_ );
......@@ -606,13 +606,13 @@ void CoreWidget::slotViewMenuAboutToShow() {
else
orthogonalCount++;
}
if ( perspectiveCount == 4 )
if ( perspectiveCount == PluginFunctions::viewers() )
perspectiveProjectionAction_->setVisible(false);
else
perspectiveProjectionAction_->setVisible(true);
if ( orthogonalCount == 4 )
if ( orthogonalCount == PluginFunctions::viewers() )
orthogonalProjectionAction_->setVisible(false);
else
orthogonalProjectionAction_->setVisible(true);
......
......@@ -233,7 +233,7 @@ void CoreWidget::slotLocalChangeMipmapping(bool _mipmapping) {
}
/// Take a snapshot of the current Viewer
void CoreWidget::slotSnapshot() {
void CoreWidget::slotExaminerSnapshot() {
QFileInfo fi(PluginFunctions::viewerProperties().snapshotName());
int counter = PluginFunctions::viewerProperties().snapshotCounter();
......@@ -419,7 +419,8 @@ void CoreWidget::viewerSnapshotDialog() {
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage,
dialog.snapWidth->value(), dialog.snapHeight->value(),
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked());
dialog.transparent->isChecked(), dialog.hideCoordsys->isChecked(),
dialog.multisampling->isChecked() ? dialog.num_samples->value() : 1);
finalImage.save(newName);
......
/*===========================================================================*\
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen *
......@@ -2032,7 +2032,7 @@ void glViewer::slotPropertiesUpdated() {
updateGL();
}
void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bool _hideCoordsys) {
void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bool _hideCoordsys, int samples) {
int w = 0, h = 0, bak_w = 0, bak_h = 0, left = 0, bottom = 0;
......@@ -2067,7 +2067,7 @@ void glViewer::snapshot(QImage& _image, int _width, int _height, bool _alpha, bo
format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
// 16 samples per pixel as we want a nice snapshot. If this is not supported
// it will fall back to the maximal supported number of samples
format.setSamples(16);
format.setSamples(samples);
QGLFramebufferObject fb( w, h, format);
if ( fb.isValid() ){
......
......@@ -768,7 +768,7 @@ private:
virtual void snapshot(int _width = 0, int _height = 0, bool _alpha = false);
/// Take a snapshot and store it in the given image
virtual void snapshot(QImage& _image, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false);
virtual void snapshot(QImage& _image, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int samples = 1);
/** @} */
......
......@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>272</width>
<height>308</height>
<width>353</width>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
......@@ -22,7 +22,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Output filename:</string>
<string>Save to: </string>
</property>
</widget>
</item>
......@@ -47,102 +47,172 @@
<property name="title">
<string> Resolution </string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Width:</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1">
<widget class="QSpinBox" name="snapWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="snapHeight">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="resButton">
<property name="text">
<string>Change Resolution</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="keepAspect">
<property name="text">
<string>Keep aspect ratio</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="snapWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="snapHeight">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8192</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="resButton">
<property name="text">
<string>Change Resolution</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="keepAspect">
<property name="text">
<string>Keep aspect</string>
</property>
</widget>
</item>
<item row="6" column="1">
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Rendering options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="transparent">
<property name="text">
<string>Transparent background</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item>
<widget class="QCheckBox" name="hideCoordsys">
<property name="text">
<string>Hide coordinate system</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="multisampling">
<property name="text">
<string>Multisampling:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="num_samples">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>samples</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......@@ -171,7 +241,7 @@
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>Ok</string>
<string>OK</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment