File size: 2,765 Bytes
985c397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /***************************************************************************
* Copyright (c) 2019 WandererFan <wandererfan@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <Base/Console.h>
#include <Gui/MainWindow.h>
#include <Gui/MDIView.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include "Grabber3d.h"
using namespace TechDrawGui;
using namespace Gui;
void Grabber3d::quickView(View3DInventor* view3d,
const QColor bgColor,
QImage &image)
{
// Base::Console().message("G3d::quickView());
if (!Gui::getMainWindow()) {
//this should already be checked in the caller
Base::Console().warning("G3d::quickView - no Main Window - returning\n");
return;
}
if (!view3d) {
//this should also already be checked in the caller
Base::Console().warning("G3d::quickView - no 3D view for ActiveView - returning\n");
return;
}
View3DInventorViewer* viewer = view3d->getViewer();
if (!viewer) {
Base::Console().warning("G3d::quickView - could not create viewer - returning\n");
return;
}
int samples = 8; //magic number from Gui::View3DInventorViewer
viewer->savePicture(image.width(), image.height(), samples, bgColor, image);
}
|