Ejemplo n.º 1
1
void ScreenSelector::grabColor()
{
    m_selectionRect = m_selectionRect.normalized();
    QDesktopWidget* desktop = QApplication::desktop();
    int screenNum = desktop->screenNumber(m_selectionRect.topLeft());
    QScreen* screen = QGuiApplication::screens()[screenNum];
    QPixmap screenGrab = screen->grabWindow(desktop->winId(),
        m_selectionRect.x(), m_selectionRect.y(), m_selectionRect.width(), m_selectionRect.height());
    QImage image = screenGrab.toImage();
    int numPixel = image.width() * image.height();
    int sumR = 0;
    int sumG = 0;
    int sumB = 0;

    for (int x = 0; x < image.width(); ++x) {
        for (int y = 0; y < image.height(); ++y) {
            QColor color = image.pixel(x, y);
            sumR += color.red();
            sumG += color.green();
            sumB += color.blue();
        }
    }

    QColor avgColor(sumR / numPixel, sumG / numPixel, sumB / numPixel);
    emit colorPicked(avgColor);
}
Ejemplo n.º 2
0
void MainWindow::on_getscreenimg_clicked()
{
    /*截屏*/
    QScreen *screen = QGuiApplication::primaryScreen();
    //ui->screenimg->hueLayerImage = screen->grabWindow(0);
    ui->screenimg->paint(screen->grabWindow(0));
    /*调整控件大小*/
    ui->screenimg->setMinimumWidth(screen->grabWindow(0).width());
    ui->screenimg->setMinimumHeight(screen->grabWindow(0).height());
    ui->scrollAreaWidgetContents->setMinimumWidth(screen->grabWindow(0).width());
    ui->scrollAreaWidgetContents->setMinimumHeight(screen->grabWindow(0).height());
}
void
GLView::grabScreen( ){

	if( parameterVerhalten.zustand == ParameterVerhalten::AUS ) {

		return;
	}

//	if(	texture ) {

//		glDeleteTextures( 1,	&texture );
//	}

	QRect
	desktopRect(	QGuiApplication::primaryScreen( )->availableGeometry( ) );

	QPixmap
	pixmap_;

	QScreen
	*screen = QGuiApplication::primaryScreen( );

	switch( parameterVerhalten.zustand ) {

		case ParameterVerhalten::AUS : {

			return;
		}

		case ParameterVerhalten::HORIZONTAL : {

			pixmap_ = screen->grabWindow( QApplication::desktop( )->winId( ), screenOnLowerSide * width( ),	y( ), width( ), height( ) );

			break;
		}

		case ParameterVerhalten::VERTIKAL : {

			pixmap_ =	screen->grabWindow( QApplication::desktop( )->winId( ), x( ),  desktopRect.y( ) + screenOnLowerSide * height( ), width( ), height( ) );

			break;
		}
	}

	screenShotImage	= pixmap_.toImage( );

	GLView::convertToGLFormat(	screenShotImage );
}
Ejemplo n.º 4
0
void MainWindow::setThumbnail(int i) {
    QLabel *screenshotLabel;

    if (thumbnails[i] == NULL) {
        screenshotLabel = new QLabel;
        screenshotLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        screenshotLabel->setAlignment(Qt::AlignCenter);
        screenshotLabel->setMinimumSize(240, 160);

        layout->addWidget(screenshotLabel, i / 3, i % 3);
        thumbnails[i] = screenshotLabel;
    }
    else {
        screenshotLabel = thumbnails[i];
    }

    QScreen *srn = QApplication::screens().at(0);
    QPixmap workspacePixmap = srn->grabWindow(QApplication::desktop()->winId());

    screenshotLabel->setPixmap(
        workspacePixmap.scaled(
            screenshotLabel->size(),
            Qt::KeepAspectRatio,
            Qt::SmoothTransformation
        )
    );
}
Ejemplo n.º 5
0
void ColorPicker::updatePosition()
{
    QPoint pos = QCursor::pos();
    QScreen *screen = findScreenAt(pos);
    if (!screen) {
        qWarning() << "Could not find a screen containing" << pos;
        return;
    }
    QRect desktopRect = screen->geometry();

    QPoint newPos;
    if (pos.x() + GRAB_SIZE + width() < desktopRect.width()) {
        newPos.setX(pos.x() + GRAB_SIZE);
    } else {
        newPos.setX(pos.x() - GRAB_SIZE - width());
    }
    if (pos.y() + GRAB_SIZE + height() < desktopRect.height()) {
        newPos.setY(pos.y() + GRAB_SIZE);
    } else {
        newPos.setY(pos.y() - GRAB_SIZE - height());
    }

    move(newPos);

    WId wid = QApplication::desktop()->winId();
    mPixmap = screen->grabWindow(wid, pos.x() - GRAB_SIZE / 2, pos.y() - GRAB_SIZE / 2, GRAB_SIZE, GRAB_SIZE);
    update();
}
void BleWindowsCaptureSource::run()
{
    // TODO make could select screen
    // QGuiApplication::screens();
    while (!m_stop) {
        QElapsedTimer elapsedTimer;
        elapsedTimer.start();

        QScreen *screen = QGuiApplication::primaryScreen();

        if (screen) {
            QPixmap pixmap = screen->grabWindow(m_wid, m_x, m_y, m_width, m_height);
#if 1
            // TODO to draw cursor to image
            QRect desktopRect = QRect(QPoint(0, 0), screen->size());
            if (desktopRect.contains(QCursor::pos())) {
                drawCursor(&pixmap);
            }
#endif
            QImage image = pixmap.toImage();

            m_modifyMutex.lock();           // Start lock

            BleImage be;
            be.width = image.width();
            be.height = image.height();

            int imageSize = be.width * be.height * 3;
            be.data = new char[imageSize];

            IplImage *oriImage = cvCreateImageHeader(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 4);
            cvSetData(oriImage, image.bits(), image.bytesPerLine());

            IplImage *dstImage = cvCreateImageHeader(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 3);
            cvSetData(dstImage, be.data, be.width * 3);

            cvCvtColor(oriImage, dstImage, CV_BGRA2BGR);

            be.dataSize = imageSize;
            be.format = BleImage_Format_BGR24;

            m_image = be;

            cvReleaseImageHeader(&oriImage);
            cvReleaseImageHeader(&dstImage);

            m_modifyMutex.unlock();        // End unlock
        }

        int elapsedMs = elapsedTimer.elapsed();
        int needSleepMs = m_interval - elapsedMs;
        if (needSleepMs < 0) {
            needSleepMs = 0;
        }
        msleep(needSleepMs);
    }

    log_trace("BleWindowsCaptureSource exit normally.");
}
Ejemplo n.º 7
0
QPixmap WizScreenShotWidget::getFullScreenPixmap()
{
    initCWizScreenShotWidget();
    QPixmap result = QPixmap();
    QScreen *screen = QGuiApplication::primaryScreen();
    result = screen->grabWindow(0);

    return result;
}
Ejemplo n.º 8
0
QPixmap ScreenshotGrabber::grabScreen()
{
    QScreen* screen = QGuiApplication::primaryScreen();
    QRect rec = screen->virtualGeometry();

    // Multiply by devicePixelRatio to get actual desktop size
    return screen->grabWindow(QApplication::desktop()->winId(), rec.x() * pixRatio,
                              rec.y() * pixRatio, rec.width() * pixRatio, rec.height() * pixRatio);
}
Ejemplo n.º 9
0
void Timer::shoot()
{
    QScreen *screen = QGuiApplication::primaryScreen();
    if (screen) {
        QPixmap pixmap;
        pixmap = screen->grabWindow(0);
        save(pixmap);
    }
}
Ejemplo n.º 10
0
QPixmap ScreenshotGrabber::grabScreen()
{
    QScreen* screen = QGuiApplication::primaryScreen();
    QRect rec = screen->virtualGeometry();
    return screen->grabWindow(QApplication::desktop()->winId(),
                              rec.x(),
                              rec.y(),
                              rec.width(),
                              rec.height());
}
Ejemplo n.º 11
0
QPixmap getFullScreenPixmap()
{
    QRect rect = QApplication::desktop()->geometry();
    QScreen *screen = QGuiApplication::primaryScreen();

    //QPixmap result = screen->grabWindow(QApplication::desktop()->winId(), rect.left(), rect.top(), rect.width(), rect.height());
    QPixmap result = screen->grabWindow(QApplication::desktop()->winId(), rect.left(), rect.top(), 500, 500);

    return result;
}
Ejemplo n.º 12
0
void CDlgScreenShot::mouseReleaseEvent(QMouseEvent *e)
{
    LOG_MODEL_DEBUG("screen shot", "mouseReleaseEvent:e->pos:x:%d;y:%d;QCursor::pos:x:%d;y:%d",
                    e->pos().x(), e->pos().y(),
                    QCursor::pos().x(), QCursor::pos().y());
    if(!m_bGrabing)
    {
        QWidget::mouseReleaseEvent(e);
        return;
    }
    if(e->button() == Qt::LeftButton)
    {
        m_bGrabing = false;
        setCursor(Qt::ArrowCursor);
        WId id = qApp->desktop()->winId();
        QRect rect = QRect(m_x,m_y,m_width,m_height).normalized();
        LOG_MODEL_DEBUG("screen shot", "x:%d;y:%d;width:%d;height:%d;DlgWidth:%d;DlgHeight:%d",
                        rect.x(),
                        rect.y(),
                        rect.width(),
                        rect.height(),
                        this->width(),
                        this->height());
        QPixmap pix = QPixmap();
        QScreen *pScreen = QGuiApplication::primaryScreen();
        pix = pScreen->grabWindow(id, rect.x(), rect.y(), rect.width(), rect.height());

        int x = rect.x(), y = rect.y() + rect.height();
        m_Editor.toolBar.show(); //需要先显示,才能得到正确的大小  
        QRect rectToolBar = m_Editor.toolBar.frameGeometry();
        LOG_MODEL_DEBUG("screen shot", "x:%d;y:%d;width:%d;height:%d",
                        rectToolBar.x(),
                        rectToolBar.y(),
                        rectToolBar.width(),
                        rectToolBar.height());
        if(y + rectToolBar.height() >= this->height())
        {
            y = rect.y() - rectToolBar.height();
        }
        else if(x + rectToolBar.width() >= this->width())
        {
            x = this->width() - rectToolBar.width();
            LOG_MODEL_ERROR("screen shot", "x:%d;y:%d;width:%d;height:%d;toolx:%d",
                            rectToolBar.x(),
                            rectToolBar.y(),
                            rectToolBar.width(),
                            rectToolBar.height(),
                            x);
        }
        m_Editor.toolBar.move(x, y);
        m_Editor.resetByImg(pix);
        m_Editor.move(rect.topLeft());//移动到当前选择的rect的左上角  
        m_Editor.show();
    }
}
Ejemplo n.º 13
0
QColor QgsColorButton::sampleColor( QPoint point ) const
{
  QScreen *screen = findScreenAt( point );
  if ( ! screen )
  {
    return QColor();
  }
  QPixmap snappedPixmap = screen->grabWindow( QApplication::desktop()->winId(), point.x(), point.y(), 1, 1 );
  QImage snappedImage = snappedPixmap.toImage();
  return snappedImage.pixel( 0, 0 );
}
Ejemplo n.º 14
0
void PaintWidget::makeScreenshot()
{
    QScreen *screen = QGuiApplication::primaryScreen();
    if (screen)
    {
        screenshot_ = screen->grabWindow(0);

        //std::cout << "screenshot: " << screenshot_.width()<< "," << screenshot_.height() << std::endl;
        drawScreenhot_ = true;
        this->update();
    }
}
Ejemplo n.º 15
0
QPixmap ScreenCaptureProvider::requestPixmap(const QString &/*id*/, QSize * /*size*/, const QSize& /*requestedSize*/)
{
	QScreen *screen = QGuiApplication::primaryScreen();
	if (screen)
	{
		QPixmap screenShotPixmap = screen->grabWindow(0);
		qDebug() << screen->geometry();
		setLastPixmap(screenShotPixmap);

		return screenShotPixmap;
	}

	return QPixmap();
}
Ejemplo n.º 16
0
void GrabScreenNode::inputsUpdated( qint64 pTimeStamp )
{
	if( !pTimeStamp )
	{
		return;
	}

	QScreen		*Screen = QGuiApplication::primaryScreen();

	if( !Screen )
	{
		return;
	}

	QPixmap PM = Screen->grabWindow(0);

	if( PM.isNull() )
	{
		return;
	}

	mImage = PM.toImage();

	if( mImage.isNull() )
	{
		return;
	}

	mValOutput->setSize( mImage.width(), mImage.height() );

	mValOutput->setLineSize( 0, mImage.bytesPerLine() );

	if( mImage.format() == QImage::Format_RGB32 )
	{
		mValOutput->setFormat( fugio::ImageInterface::FORMAT_BGRA8 );
	}
	else if( mImage.format() == QImage::Format_ARGB32 )
	{
		mValOutput->setFormat( fugio::ImageInterface::FORMAT_BGRA8 );
	}
	else
	{
		return;
	}

	memcpy( mValOutput->internalBuffer( 0 ), mImage.constBits(), mImage.byteCount() );

	pinUpdated( mPinOutput );
}
Ejemplo n.º 17
0
static QColor get_screen_color(const QPoint &global_pos)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
    WId id = QApplication::desktop()->winId();
    QImage img = QPixmap::grabWindow(id, global_pos.x(), global_pos.y(), 1, 1).toImage();
#else
    int screenNum = QApplication::desktop()->screenNumber(global_pos);
    QScreen *screen = QApplication::screens().at(screenNum);

    WId wid = QApplication::desktop()->winId();
    QImage img = screen->grabWindow(wid, global_pos.x(), global_pos.y(), 1, 1).toImage();
#endif

    return img.pixel(0,0);
}
Ejemplo n.º 18
0
void MainUI::getPixmap(){
  QScreen *scrn = QApplication::screens().at(0);
  QPixmap cpic;
  if( (cwin==0 && ui->radio_window->isChecked() ) || ui->radio_all->isChecked() ){
    //Grab the whole screen
    cpic = scrn->grabWindow(QApplication::desktop()->winId());
  }else if(cwin==0 && ui->radio_monitor->isChecked()){
    QRect geom = QApplication::desktop()->screenGeometry(ui->spin_monitor->value()-1);
    cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() );
  }else{
    //Grab just the designated window
    if(ui->check_frame->isChecked()){
      QRect geom = XCB->WindowGeometry(cwin, true); //include the frame
      cpic = scrn->grabWindow(QApplication::desktop()->winId(), geom.x(), geom.y(), geom.width(), geom.height() );
    }else{
      cpic = scrn->grabWindow(cwin);
    }
  }
  this->show();
  this->setGeometry(lastgeom);
  ui->tabWidget->setCurrentWidget(ui->tab_view); //view it right now
  //Now display the pixmap on the label as well
  IMG->LoadImage( cpic.toImage() );
}
Ejemplo n.º 19
0
//! [4]
void Screenshot::shootScreen()
{
    if (delaySpinBox->value() != 0)
        qApp->beep();
//! [4]
    originalPixmap = QPixmap(); // clear image for low memory situations
                                // on embedded devices.
//! [5]
    QScreen *screen = QGuiApplication::primaryScreen();
    if (screen)
        originalPixmap = screen->grabWindow(0);
    updateScreenshotLabel();

    newScreenshotButton->setDisabled(false);
    if (hideThisWindowCheckBox->isChecked())
        show();
}
Ejemplo n.º 20
0
//! [4]
void Screenshot::shootScreen()
{
    QScreen *screen = QGuiApplication::primaryScreen();
    if (const QWindow *window = windowHandle())
        screen = window->screen();
    if (!screen)
        return;

    if (x_spinBox->value() != 0)
        QApplication::beep();

    originalPixmap = screen->grabWindow(0);
    updateScreenshotLabel();

    newScreenshotButton->setDisabled(false);
    //if (hideThisWindowCheckBox->isChecked())
      //  show();
}
SelectAreaDialog::SelectAreaDialog() :
    rubberBand_(nullptr)
{
    setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
    setWindowState(Qt::WindowFullScreen);
    setParent(0);
    setAutoFillBackground(false);
    setAttribute(Qt::WA_NoSystemBackground, false);
    setAttribute(Qt::WA_TranslucentBackground, true);
    setAttribute(Qt::WA_PaintOnScreen);
    grabMouse();
    rubberBand_ = new QRubberBand(QRubberBand::Rectangle, this);
    QApplication::setOverrideCursor(Qt::CrossCursor);
    QScreen* screen = QGuiApplication::primaryScreen();
    if (screen) {
        originalPixmap_ = screen->grabWindow(0);
        originalPixmap_.setDevicePixelRatio(screen->devicePixelRatio());
    }
}
Ejemplo n.º 22
0
void DesktopCaptureElement::readFrame()
{
    QScreen *screen = QGuiApplication::screens()[this->m_curScreenNumber];
    AkFrac fps(30000, 1001);

    AkVideoCaps caps;
    caps.isValid() = true;
    caps.format() = AkVideoCaps::Format_rgb24;
    caps.bpp() = AkVideoCaps::bitsPerPixel(caps.format());
    caps.width() = screen->size().width();
    caps.height() = screen->size().height();
    caps.fps() = fps;

    QPixmap frame = screen->grabWindow(QApplication::desktop()->winId());
    QImage frameImg= frame.toImage().convertToFormat(QImage::Format_RGB888);
    AkPacket packet = AkUtils::imageToPacket(frameImg, caps.toCaps());

    if (!packet)
        return;

    qint64 pts = qint64(QTime::currentTime().msecsSinceStartOfDay()
                        * fps.value() / 1e3);

    packet.setPts(pts);
    packet.setTimeBase(fps.invert());
    packet.setIndex(0);
    packet.setId(this->m_id);

    if (!this->m_threadedRead) {
        emit this->oStream(packet);

        return;
    }

    if (!this->m_threadStatus.isRunning()) {
        this->m_curPacket = packet;

        this->m_threadStatus = QtConcurrent::run(&this->m_threadPool,
                                                 this->sendPacket,
                                                 this,
                                                 this->m_curPacket);
    }
}
Ejemplo n.º 23
0
void Player::recordScreen() {
#if 0
        if (isStopRecord)
                return;

        QScreen *screen = QGuiApplication::primaryScreen();

        QPixmap pix = screen->grabWindow(0);

        QByteArray ba;
        QBuffer buf(&ba);
        pix.save(&buf, "jpg");

        size_t num =write(fifo_fd, ba, ba.size());
        if (num == -1)
        {
        }
#endif
}
Ejemplo n.º 24
0
void Player::grabScreen() {
        QScreen *screen = QGuiApplication::primaryScreen();
        QPixmap pix = screen->grabWindow(0);

        QDateTime time = QDateTime::currentDateTime();
        QString dateStr = time.toString("yyyy-MM-dd_hh:mm:ss");

        QString filename = QFileDialog::getSaveFileName(this, tr("Save Image"),
                                                        "/tmp/" + dateStr + "_",
                                                        tr("*.jpg")); //选择路径

        if (filename.isEmpty()) {
                return;
        } else {
                if (!pix.save(filename + ".jpg", "jpg")) //保存图像
                {
                        QMessageBox::information(this, tr("Failed to save the image"),
                                                 tr("保存图片失败!"));
                        return;
                }
        }
}
Ejemplo n.º 25
0
void ScreenShot::setBackground(int w, int h)
{
    QScreen *screen = QGuiApplication::primaryScreen();
//    screen->grabWindow(0).save("bg.bmp","bmp");

    int r,g,b;
    bg = screen->grabWindow(0).toImage();
    QImage bg_grey(w,h,QImage::Format_RGB32);
    for(int i=0;i<w;i++)
    {
        for(int j=0;j<h;j++)
        {
            r = qRed(bg.pixel(i,j))*0.5;
            g = qGreen(bg.pixel(i,j))*0.5;
            b = qBlue(bg.pixel(i,j))*0.5;
            bg_grey.setPixel(i,j,qRgb(r,g,b));
        }
    }
    QPalette palette;
    palette.setBrush(this->backgroundRole(),QBrush(bg_grey));
    this->setPalette(palette);
}
Ejemplo n.º 26
0
void MainWindow::trayAction(QSystemTrayIcon::ActivationReason reason) {

	if(variables->verbose)
		LOG << CURDATE << "trayAction()" << NL;

	if(reason == QSystemTrayIcon::Trigger) {

		if(!variables->hiddenToTrayIcon) {
			variables->geometryWhenHiding = this->geometry();
			if(variables->verbose)
				LOG << CURDATE << "trayAction(): Hiding to tray" << NL;
			this->hide();
		} else {

			if(variables->verbose)
				LOG << CURDATE << "trayAction(): Updating screenshots" << NL;

			// Get screenshots
			for(int i = 0; i < QGuiApplication::screens().count(); ++i) {
				QScreen *screen = QGuiApplication::screens().at(i);
				QRect r = screen->geometry();
				QPixmap pix = screen->grabWindow(0,r.x(),r.y(),r.width(),r.height());
				if(!pix.save(QDir::tempPath() + QString("/photoqt_screenshot_%1.jpg").arg(i)))
					LOG << CURDATE << "ERROR: Unable to update screenshot for screen #" << i << NL;
			}

			if(variables->verbose)
				LOG << CURDATE << "trayAction(): SHowing window" << NL;

			updateWindowGeometry();

			if(variables->currentDir == "")
				QMetaObject::invokeMethod(object, "openFile");
		}

	}

}
void BleWindowsCaptureSource::run()
{
    // TODO make could select screen
    // QGuiApplication::screens();
    while (!m_stop) {
        QElapsedTimer elapsedTimer;
        elapsedTimer.start();

        // TODO make this to option
        // option: could select screen
        QScreen *screen = QGuiApplication::primaryScreen();

        if (screen) {
            QPixmap pixmap = screen->grabWindow(m_wid, m_x, m_y, m_width, m_height);

            // TODO make this to option
#if 1
            QRect desktopRect = QRect(QPoint(0, 0), screen->size());
            if (desktopRect.contains(QCursor::pos())) {
                drawCursor(&pixmap);
            }
#endif
            m_modifyMutex.lock();           // Start lock
            m_image = pixmap.toImage();
            m_modifyMutex.unlock();
        }

        int elapsedMs = elapsedTimer.elapsed();
        int needSleepMs = m_interval - elapsedMs;
        if (needSleepMs < 0) {
            needSleepMs = 0;
        }
        msleep(needSleepMs);
    }

    log_trace("BleWindowsCaptureSource exit normally.");
}
Ejemplo n.º 28
0
bool QtSnapshot::GrabWindow(char* Size)
{
	int x = 0;int y = 0;
	int iWidth = QApplication::desktop()->width();
	int iHeight = QApplication::desktop()->height();

	vector<int> SizeInfo;
	if (Size != NULL) {
		ParseParam ParamParser;
		SizeInfo = ParamParser.ParseInputNValue(Size);
	}
		
	int iNSize = SizeInfo.size();
	if (iNSize != 1 && iNSize != 4 &&  iNSize != 8 && iNSize != 0)
		return false;

	if (iNSize != 1) {
		x = SizeInfo[0];y = SizeInfo[1];
		iWidth = SizeInfo[2];
		iHeight = SizeInfo[3];

		if (iNSize == 8) {
			string temSize = Size;
			memset(Size, 0, strlen(Size));
			temSize.copy(Size, temSize.length()/2, temSize.length()/2+1);
		}
	}

	QScreen* Myscreen = QGuiApplication::primaryScreen();
	QPixmap pixmap = Myscreen->grabWindow(QApplication::desktop()->winId(), 
		x, y, iWidth, iHeight);
	
	this->QPImgGrab = pixmap;
	if (pixmap.height() == NULL) return false;

	return true;
}
Ejemplo n.º 29
0
static PyObject *meth_QScreen_grabWindow(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;

    {
        WId* a0;
        int a0State = 0;
        int a1 = 0;
        int a2 = 0;
        int a3 = -1;
        int a4 = -1;
        QScreen *sipCpp;

        static const char *sipKwdList[] = {
            NULL,
            sipName_x,
            sipName_y,
            sipName_width,
            sipName_height,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "BJ1|iiii", &sipSelf, sipType_QScreen, &sipCpp, sipType_quintptr,&a0, &a0State, &a1, &a2, &a3, &a4))
        {
            QPixmap*sipRes;

            sipRes = new QPixmap(sipCpp->grabWindow(*a0,a1,a2,a3,a4));
            sipReleaseType(a0,sipType_quintptr,a0State);

            return sipConvertFromNewType(sipRes,sipType_QPixmap,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QScreen, sipName_grabWindow, doc_QScreen_grabWindow);

    return NULL;
}
Ejemplo n.º 30
0
QPixmap LinuxWindowCapture::Capture( int x, int y, int w, int h ) {
    LOG("Capturing window: %d, %d, %d, %d", x, y, h, w );
    QScreen *screen = QGuiApplication::primaryScreen();
    QPixmap pixmap = screen->grabWindow( mWindow, x, y, w, h );
  return pixmap;
}