blob: a5eeafde2272a08a9f9539997359114c27281df5 (
plain)
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
|
/*
* Copyright (c) 2012 Yoann Blein
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include "QtDesktopScreenGrabber.h"
#include <QImage>
#include <QPixmap>
#include <QApplication>
#include <QDesktopWidget>
#include <Swiften/ScreenSharing/Image.h>
/*#include <QImage>
#include <QLabel>*/
namespace Swift {
QtDesktopScreenGrabber::QtDesktopScreenGrabber()
{
/*Image img = grab();
QImage qImg(img.data.data(), img.width, img.height, QImage::Format_RGB888);
QLabel *label = new QLabel;
label->setPixmap(QPixmap::fromImage(qImg));
label->show();*/
}
QtDesktopScreenGrabber::~QtDesktopScreenGrabber()
{
}
Image QtDesktopScreenGrabber::grab() const
{
QImage qImg = QPixmap::grabWindow(QApplication::desktop()->winId()).toImage().convertToFormat(QImage::Format_RGB888);
return Image(qImg.width(), qImg.height(), qImg.constBits());
}
}
|