void Viewport::screenshot() { // ensure high quality drawingState = HIGH_QUALITY; updateBuffers(RM_FULL, RM_FULL); // render into our buffer QGLFramebufferObject b(width, height); QPainter p(&b); bool success = drawScene(&p, false); // reset drawing state endNoHQ(); if (!success) return; QImage img = b.toImage(); // write out cv::Mat output = QImage2Mat(img); GerbilIO io(target, "Screenshot File", "screenshot"); io.setFileSuffix(".png"); io.setFileCategory("Screenshot"); io.writeImage(output); }
void Viewport::toggleHQ() { if (drawHQ->isChecked()) { // triggers drawing update endNoHQ(); } else { startNoHQ(); // deliberately make display worse for user to see effect updateBuffers(); } }
void DistViewGUI::initVC(representation::t type) { /* create VC, apply UI to it, then add to GV */ vc = new AutohideWidget(); uivc = new Ui::ViewportControl(); uivc->setupUi(vc); ui->gv->addWidget(AutohideWidget::LEFT, vc); // small hack to enable proximity trigger for said autohide widget ui->gv->fitContentRect(QRect(20, 0, 0, 0)); //!! change when adding widgets! /* we are ready to connect signals/slots */ // let user see how many bins he will end up with connect(uivc->binSlider, SIGNAL(sliderMoved(int)), this, SLOT(setBinLabel(int))); connect(uivc->binSlider, SIGNAL(valueChanged(int)), this, SLOT(setBinCount(int))); connect(uivc->alphaSlider, SIGNAL(valueChanged(int)), this, SLOT(setAlpha(int))); // low quality drawing while user works the slider connect(uivc->alphaSlider, SIGNAL(sliderPressed()), vp, SLOT(startNoHQ())); connect(uivc->alphaSlider, SIGNAL(sliderReleased()), vp, SLOT(endNoHQ())); connect(uivc->limiterButton, SIGNAL(toggled(bool)), vp, SLOT(setLimitersMode(bool))); connect(uivc->limiterMenuButton, SIGNAL(clicked()), this, SLOT(showLimiterMenu())); connect(uivc->formatButton, SIGNAL(released()), this, SLOT(showFrameBufferMenu())); // default UI stuff if (type != representation::IMG) uivc->rgbButton->setVisible(false); setAlpha(uivc->alphaSlider->value()); setBinCount(uivc->binSlider->value()); createFrameBufferMenu(); // initialize from VP as we only implicitely store it updateBufferFormat(vp->format()); initVPActions(); }