File indexing completed on 2024-12-22 04:12:49

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISSCREENINFORMATIONADAPTER_H
0008 #define KISSCREENINFORMATIONADAPTER_H
0009 
0010 #include "kritaui_export.h"
0011 #include <QScopedPointer>
0012 #include <QSurfaceFormat>
0013 #include "KisSurfaceColorSpace.h"
0014 
0015 class QScreen;
0016 class QOpenGLContext;
0017 
0018 class KRITAUI_EXPORT KisScreenInformationAdapter
0019 {
0020 public:
0021     struct ScreenInfo {
0022         QScreen *screen = 0;
0023         int bitsPerColor = 0;
0024         KisSurfaceColorSpace colorSpace = KisSurfaceColorSpace::DefaultColorSpace;
0025         qreal redPrimary[2] = {0, 0};
0026         qreal greenPrimary[2] = {0, 0};
0027         qreal bluePrimary[2] = {0, 0};
0028         qreal whitePoint[2] = {0, 0};
0029         qreal minLuminance = 0;
0030         qreal maxLuminance = 0;
0031         qreal maxFullFrameLuminance = 0;
0032 
0033         bool isValid() const {
0034             return screen;
0035         }
0036     };
0037 
0038 public:
0039     KisScreenInformationAdapter(QOpenGLContext *context);
0040     ~KisScreenInformationAdapter();
0041 
0042     bool isValid() const;
0043     QString errorString() const;
0044 
0045     ScreenInfo infoForScreen(QScreen *screen) const;
0046 
0047 
0048 private:
0049     struct Private;
0050     const QScopedPointer<Private> m_d;
0051 };
0052 
0053 QDebug operator<<(QDebug, const KisScreenInformationAdapter::ScreenInfo &);
0054 
0055 #endif // KISSCREENINFORMATIONADAPTER_H