DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dbackdropnode_p.h
1// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#pragma once
6
7#include <dtkdeclarative_global.h>
8#include <QSGRenderNode>
9#include <QPointer>
10#include <QImage>
11
12QT_BEGIN_NAMESPACE
13class QQuickItem;
14class QSGTexture;
15QT_END_NAMESPACE
16
17DQUICK_BEGIN_NAMESPACE
18
19class DBackdropNode : public QSGRenderNode {
20public:
21 inline QSizeF size() const {
22 return m_size;
23 }
24 QSGTexture *texture() const;
25
26 static DBackdropNode *createRhiNode(QQuickItem *item);
27 static DBackdropNode *createSoftwareNode(QQuickItem *item);
28
29 QRectF rect() const override;
30 RenderingFlags flags() const override;
31
32 void resize(const QSizeF &size);
33 void setContentItem(QQuickItem *item);
34
35 typedef void(*TextureChangedNotifer)(DBackdropNode *node, void *data);
36 void setTextureChangedCallback(TextureChangedNotifer callback, void *data);
37 inline void doNotifyTextureChanged() {
38 if (!m_renderCallback || !m_item)
39 return;
40 m_renderCallback(this, m_callbackData);
41 }
42 virtual QImage toImage() const { return QImage(); }
43
44 QQuickWindow *renderWindow() const;
45 qreal effectiveDevicePixelRatio() const;
46
47protected:
48 DBackdropNode(QQuickItem *item, QSGTexture *texture);
49
50 QPointer<QQuickItem> m_item;
51 QPointer<QQuickItem> m_content;
52 QSizeF m_size;
53 QRectF m_rect;
54 QScopedPointer<QSGTexture> m_texture;
55 TextureChangedNotifer m_renderCallback = nullptr;
56 void *m_callbackData = nullptr;
57};
58
59DQUICK_END_NAMESPACE
Definition dbackdropnode_p.h:19