Skip to content

Commit

Permalink
feat(effect): provide screenshot scale information
Browse files Browse the repository at this point in the history
  • Loading branch information
zzag authored and romangg committed Apr 20, 2023
1 parent 4107b20 commit ffddb42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions effect/effects/screenshot/org.kde.KWin.ScreenShot2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
Available only if the image type is "raw"
* "windowId" (s): The window id of the captured window. Available
since version 4.
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureWindow">
<arg name="handle" type="s" direction="in" />
Expand Down Expand Up @@ -100,6 +103,9 @@
Available only if the image type is "raw"
* "windowId" (s): The window id of the captured window. Available
since version 4.
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureActiveWindow">
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap" />
Expand Down Expand Up @@ -142,6 +148,9 @@
image type is "raw"
* "format" (u): The image format, as defined in QImage::Format.
Available only if the image type is "raw"
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureArea">
<arg name="x" type="i" direction="in" />
Expand Down Expand Up @@ -187,6 +196,9 @@
Available only if the image type is "raw"
* "screen" (s): The name of the captured screen, same as QScreen::name().
Available since version 4
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureScreen">
<arg name="name" type="s" direction="in" />
Expand Down Expand Up @@ -230,6 +242,9 @@
Available only if the image type is "raw"
* "screen" (s): The name of the captured screen, same as QScreen::name().
Available since version 4
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureActiveScreen">
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap" />
Expand Down Expand Up @@ -268,6 +283,9 @@
image type is "raw"
* "format" (u): The image format, as defined in QImage::Format.
Available only if the image type is "raw"
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
The following results get returned when taking a window screenshot:
Expand Down Expand Up @@ -319,6 +337,9 @@
image type is "raw"
* "format" (u): The image format, as defined in QImage::Format.
Available only if the image type is "raw"
* "scale" (d): The ratio between the native size and the logical
size of the contents, corresponds to QImage::devicePixelRatio().
Available since version 4.
-->
<method name="CaptureWorkspace">
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap" />
Expand Down
1 change: 1 addition & 0 deletions effect/effects/screenshot/screenshotdbusinterface2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ void ScreenShotSinkPipe2::flush(const QImage& image, const QVariantMap& attribut
results.insert(QStringLiteral("width"), quint32(image.width()));
results.insert(QStringLiteral("height"), quint32(image.height()));
results.insert(QStringLiteral("stride"), quint32(image.bytesPerLine()));
results.insert(QStringLiteral("scale"), double(image.devicePixelRatio()));
QDBusConnection::sessionBus().send(m_replyMessage.createReply(results));

QtConcurrent::run(
Expand Down

0 comments on commit ffddb42

Please sign in to comment.