File indexing completed on 2024-05-12 05:31:23

0001 /*
0002     SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "core/colorspace.h"
0010 #include "core/output.h"
0011 
0012 #include <QImage>
0013 
0014 namespace KWin
0015 {
0016 
0017 class GLFramebuffer;
0018 class GLTexture;
0019 
0020 class KWIN_EXPORT RenderTarget
0021 {
0022 public:
0023     explicit RenderTarget(GLFramebuffer *fbo, const ColorDescription &colorDescription = ColorDescription::sRGB);
0024     explicit RenderTarget(QImage *image, const ColorDescription &colorDescription = ColorDescription::sRGB);
0025 
0026     QSize size() const;
0027     OutputTransform transform() const;
0028     const ColorDescription &colorDescription() const;
0029 
0030     QImage *image() const;
0031     GLFramebuffer *framebuffer() const;
0032     GLTexture *texture() const;
0033 
0034 private:
0035     QImage *m_image = nullptr;
0036     GLFramebuffer *m_framebuffer = nullptr;
0037     const OutputTransform m_transform;
0038     const ColorDescription m_colorDescription;
0039 };
0040 
0041 } // namespace KWin