Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgdistancefieldglyphnode_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSGDISTANCEFIELDGLYPHNODE_P_P_H
6#define QSGDISTANCEFIELDGLYPHNODE_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick/qsgmaterial.h>
20#include <QtQuick/private/qsgplaintexture_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QSGPlainTexture;
27
28class Q_QUICK_EXPORT QSGDistanceFieldTextMaterial: public QSGMaterial
29{
30public:
31 QSGDistanceFieldTextMaterial();
32 ~QSGDistanceFieldTextMaterial();
33
34 QSGMaterialType *type() const override;
35 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
36 int compare(const QSGMaterial *other) const override;
37
38 virtual void setColor(const QColor &color);
39 const QVector4D &color() const { return m_color; }
40
41 void setGlyphCache(QSGDistanceFieldGlyphCache *a) { m_glyph_cache = a; }
42 QSGDistanceFieldGlyphCache *glyphCache() const { return m_glyph_cache; }
43
44 void setTexture(const QSGDistanceFieldGlyphCache::Texture * tex) { m_texture = tex; }
45 const QSGDistanceFieldGlyphCache::Texture * texture() const { return m_texture; }
46
47 void setFontScale(qreal fontScale) { m_fontScale = fontScale; }
48 qreal fontScale() const { return m_fontScale; }
49
50 QSize textureSize() const { return m_size; }
51
52 bool updateTextureSize();
53 bool updateTextureSizeAndWrapper();
54 QSGTexture *wrapperTexture() const { return m_sgTexture; }
55
56protected:
57 QSize m_size;
58 QVector4D m_color;
59 QSGDistanceFieldGlyphCache *m_glyph_cache;
60 const QSGDistanceFieldGlyphCache::Texture *m_texture;
61 qreal m_fontScale;
62 QSGPlainTexture *m_sgTexture;
63};
64
65class Q_QUICK_EXPORT QSGDistanceFieldStyledTextMaterial : public QSGDistanceFieldTextMaterial
66{
67public:
68 QSGDistanceFieldStyledTextMaterial();
69 ~QSGDistanceFieldStyledTextMaterial();
70
71 QSGMaterialType *type() const override = 0;
72 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override = 0;
73 int compare(const QSGMaterial *other) const override;
74
75 void setStyleColor(const QColor &color);
76 const QVector4D &styleColor() const { return m_styleColor; }
77
78protected:
79 QVector4D m_styleColor;
80};
81
82class Q_QUICK_EXPORT QSGDistanceFieldOutlineTextMaterial : public QSGDistanceFieldStyledTextMaterial
83{
84public:
85 QSGDistanceFieldOutlineTextMaterial();
86 ~QSGDistanceFieldOutlineTextMaterial();
87
88 QSGMaterialType *type() const override;
89 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
90};
91
92class Q_QUICK_EXPORT QSGDistanceFieldShiftedStyleTextMaterial : public QSGDistanceFieldStyledTextMaterial
93{
94public:
95 QSGDistanceFieldShiftedStyleTextMaterial();
96 ~QSGDistanceFieldShiftedStyleTextMaterial();
97
98 QSGMaterialType *type() const override;
99 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
100 int compare(const QSGMaterial *other) const override;
101
102 void setShift(const QPointF &shift) { m_shift = shift; }
103 const QPointF &shift() const { return m_shift; }
104
105protected:
106 QPointF m_shift;
107};
108
109class Q_QUICK_EXPORT QSGHiQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
110{
111public:
112 QSGMaterialType *type() const override;
113 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
114 void setColor(const QColor &color) override {
115 const auto rgbColor = color.toRgb();
116 m_color = QVector4D(rgbColor.redF(), rgbColor.greenF(), rgbColor.blueF(), rgbColor.alphaF());
117 }
118};
119
120class Q_QUICK_EXPORT QSGLoQSubPixelDistanceFieldTextMaterial : public QSGDistanceFieldTextMaterial
121{
122public:
123 QSGMaterialType *type() const override;
124 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
125 void setColor(const QColor &color) override {
126 const auto rgbColor = color.toRgb();
127 m_color = QVector4D(rgbColor.redF(), rgbColor.greenF(), rgbColor.blueF(), rgbColor.alphaF());
128 }
129};
130
131QT_END_NAMESPACE
132
133#endif
void invalidateGlyphs(const QList< quint32 > &glyphs) override
QSGDistanceFieldGlyphNode(QSGRenderContext *context)
void setStyleColor(const QColor &color) override
void setStyle(QQuickText::TextStyle style) override
void setRenderTypeQuality(int renderTypeQuality) override
void setColor(const QColor &color) override
void setPreferredAntialiasingMode(AntialiasingMode mode) override
void preprocess() override
Override this function to do processing on the node before it is rendered.
void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override
Combined button and popup list for selecting options.
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQIORing)