File indexing completed on 2024-05-12 05:32:19

0001 /*
0002     SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
0003     SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 #pragma once
0008 
0009 #include "kwin_export.h"
0010 
0011 #include <memory>
0012 #include <optional>
0013 
0014 #include <QColor>
0015 #include <QObject>
0016 
0017 struct wl_resource;
0018 
0019 namespace KWin
0020 {
0021 class Display;
0022 class ContrastManagerInterfacePrivate;
0023 class ContrastInterfacePrivate;
0024 
0025 /**
0026  * @brief Represents the Global for org_kde_kwin_contrast_manager interface.
0027  *
0028  * This class creates ContrastInterfaces and attaches them to SurfaceInterfaces.
0029  *
0030  * @see ContrastInterface
0031  * @see SurfaceInterface
0032  */
0033 class KWIN_EXPORT ContrastManagerInterface : public QObject
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     explicit ContrastManagerInterface(Display *display, QObject *parent = nullptr);
0039     ~ContrastManagerInterface() override;
0040 
0041     void remove();
0042 
0043 private:
0044     std::unique_ptr<ContrastManagerInterfacePrivate> d;
0045 };
0046 
0047 /**
0048  * @brief Represents the Resource for the org_kde_kwin_contrast interface.
0049  *
0050  * Instances of this class are only generated by the ContrastManagerInterface.
0051  * The ContrastInterface gets attached to a SurfaceInterface and can be assessed
0052  * from there using @link SurfaceInterface::contrast() @endlink. Please note that
0053  * the ContrastInterface is only available on the SurfaceInterface after it has been
0054  * committed.
0055  *
0056  * @see ContrastManagerInterface
0057  * @see SurfaceInterface
0058  */
0059 class KWIN_EXPORT ContrastInterface : public QObject
0060 {
0061     Q_OBJECT
0062 public:
0063     ~ContrastInterface() override;
0064 
0065     QRegion region() const;
0066     qreal contrast() const;
0067     qreal intensity() const;
0068     qreal saturation() const;
0069     QColor frost() const;
0070 
0071 private:
0072     explicit ContrastInterface(wl_resource *resource);
0073     friend class ContrastManagerInterfacePrivate;
0074 
0075     std::unique_ptr<ContrastInterfacePrivate> d;
0076 };
0077 
0078 }