Kirigami2

managedtexturenode.h
1 /*
2  * SPDX-FileCopyrightText: 2011 Marco Martin <[email protected]>
3  * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <[email protected]>
4  * SPDX-FileCopyrightText: 2020 Carson Black <[email protected]>
5  *
6  * SPDX-License-Identifier: LGPL-2.0-or-later
7  */
8 
9 #pragma once
10 #include <QImage>
11 #include <QQuickWindow>
12 #include <QSGSimpleTextureNode>
13 #include <QSGTexture>
14 #include <memory>
15 
17 {
18  Q_DISABLE_COPY(ManagedTextureNode)
19 public:
21 
22  void setTexture(std::shared_ptr<QSGTexture> texture);
23 
24 private:
25  std::shared_ptr<QSGTexture> m_texture;
26 };
27 
29 
30 struct ImageTexturesCachePrivate {
31  TexturesCache cache;
32 };
33 
35 {
36 public:
39 
40  /**
41  * @returns the texture for a given @p window and @p image.
42  *
43  * If an @p image id is the same as one already provided before, we won't create
44  * a new texture and return a shared pointer to the existing texture.
45  */
46  std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options);
47 
48  std::shared_ptr<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image);
49 
50 private:
51  std::unique_ptr<ImageTexturesCachePrivate> d;
52 };
typedef CreateTextureOptions
QSGTexture * texture() const const
QSharedPointer< QSGTexture > loadTexture(QQuickWindow *window, const QImage &image, QQuickWindow::CreateTextureOptions options)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.