DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dsoftwareroundedimagenode_p.h
1// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DSOFTWAREROUNDEDIMAGENODE_P_H
6#define DSOFTWAREROUNDEDIMAGENODE_P_H
7
8#include <dtkdeclarative_global.h>
9#include <QSGRenderNode>
10#include <QImage>
11#include <QPainterPath>
12
13QT_BEGIN_NAMESPACE
14class QQuickItem;
15class QSGTexture;
16QT_END_NAMESPACE
17
18DQUICK_BEGIN_NAMESPACE
19
20class Q_DECL_EXPORT DSoftwareRoundedImageNode : public QSGRenderNode
21{
22public:
23 DSoftwareRoundedImageNode(QQuickItem *owner);
24
25 void setTexture(QSGTexture *texture);
26 inline QSGTexture *texture() const
27 { return m_texture;}
28 void setRadius(qreal radius);
29 void setSmooth(bool smooth);
30 void setSourceRect(const QRectF &source);
31 void setRect(const QRectF &target);
32
33 void render(const RenderState *state) override;
34 void releaseResources() override;
35 RenderingFlags flags() const override;
36 QRectF rect() const override;
37
38private:
39 void updateCachedImage();
40 QRectF convertToTextureNormalizedSourceRect() const;
41
42 qreal radius = 0;
43 bool smooth = false;
44 QRectF sourceRect;
45 QRectF targetRect;
46 QPainterPath clipPath;
47
48 QSGTexture *m_texture = nullptr;
49 QQuickItem *item = nullptr;
50 QImage cachedImage;
51};
52
53DQUICK_END_NAMESPACE
54
55#endif // DSOFTWAREROUNDEDIMAGENODE_P_H
Definition dsoftwareroundedimagenode_p.h:21