DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dmaskeffectnode_p.h
1// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DMASKEFFECTNODE_P_H
6#define DMASKEFFECTNODE_P_H
7
8#include "private/qsgtexturematerial_p.h"
9
10#include <dtkdeclarative_global.h>
11
12#include <QSGImageNode>
13#include <QPointer>
14
15DQUICK_BEGIN_NAMESPACE
16
17class OpaqueTextureMaterial : public QSGOpaqueTextureMaterial
18{
19public:
20 QSGMaterialType *type() const override;
21
22#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
23 QSGMaterialShader *createShader() const override;
24#else
25 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
26#endif
27 int compare(const QSGMaterial *other) const override;
28
29 void setMaskTexture(QSGTexture *texture);
30 QSGTexture *maskTexture() const { return m_maskTexture.data(); }
31
32 void setMaskScale(QVector2D maskScale);
33 QVector2D maskScale() const { return m_maskScale; }
34
35 void setMaskOffset(QVector2D maskOffset);
36 QVector2D maskOffset() const { return m_maskOffset; }
37
38 void setSourceScale(QVector2D sourceScale);
39 QVector2D sourceScale() const { return m_sourceScale; }
40
41private:
42 QPointer<QSGTexture> m_maskTexture = nullptr;
43 QVector2D m_maskScale;
44 QVector2D m_maskOffset;
45 QVector2D m_sourceScale;
46};
47
49{
50public:
51 QSGMaterialType *type() const override;
52#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
53 QSGMaterialShader *createShader() const override;
54#else
55 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
56#endif
57 int compare(const QSGMaterial *other) const override;
58};
59
60class MaskEffectNode : public QSGImageNode
61{
62public:
64 ~MaskEffectNode() override;
65
66 void setRect(const QRectF &rect) override;
67 QRectF rect() const override;
68
69 void setSourceRect(const QRectF &r) override;
70 QRectF sourceRect() const override;
71
72 void setTexture(QSGTexture *texture) override;
73 QSGTexture *texture() const override;
74
75 void setFiltering(QSGTexture::Filtering filtering) override;
76 QSGTexture::Filtering filtering() const override;
77
78 void setMipmapFiltering(QSGTexture::Filtering filtering) override;
79 QSGTexture::Filtering mipmapFiltering() const override;
80
81 void setTextureCoordinatesTransform(TextureCoordinatesTransformMode mode) override;
82 TextureCoordinatesTransformMode textureCoordinatesTransform() const override;
83
84 void setOwnsTexture(bool owns) override;
85 bool ownsTexture() const override;
86
87 void setAnisotropyLevel(QSGTexture::AnisotropyLevel level);
88
89 void setMaskTexture(QSGTexture *texture);
90 void setMaskScale(QVector2D maskScale);
91 void setMaskOffset(QVector2D maskOffset);
92 void setSourceScale(QVector2D sourceScale);
93
94 QSGTexture::AnisotropyLevel anisotropyLevel() const;
95private:
96 QSGGeometry m_geometry;
97 OpaqueTextureMaterial m_opaque_material;
98 TextureMaterial m_material;
99 QRectF m_rect;
100 QRectF m_sourceRect;
101 TextureCoordinatesTransformMode m_texCoordMode;
102 uint m_isAtlasTexture : 1;
103 uint m_ownsTexture : 1;
104};
105
106DQUICK_END_NAMESPACE
107
108#endif // DMASKEFFECTNODE_P_H
Definition dmaskeffectnode_p.h:61
Definition dmaskeffectnode_p.h:18
Definition dmaskeffectnode_p.h:49