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
qsgdefaultglyphnode_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 QSGDEFAULTGLYPHNODE_P_P_H
6#define QSGDEFAULTGLYPHNODE_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 <qcolor.h>
20#include <QtQuick/qsgmaterial.h>
21#include <QtQuick/qsgtexture.h>
22#include <QtQuick/qsggeometry.h>
23#include <qshareddata.h>
24#include <QtQuick/private/qsgplaintexture_p.h>
25#include <QtQuick/private/qsgrhitextureglyphcache_p.h>
26#include <qrawfont.h>
27#include <qmargins.h>
28
29QT_BEGIN_NAMESPACE
30
31class QFontEngine;
32class Geometry;
33class QSGRenderContext;
34class QSGDefaultRenderContext;
35
37{
38public:
39 QSGTextMaskMaterial(QSGRenderContext *rc, const QVector4D &color, const QRawFont &font, QFontEngine::GlyphFormat glyphFormat = QFontEngine::Format_None);
40 virtual ~QSGTextMaskMaterial();
41
42 QSGMaterialType *type() const override;
43 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
44 int compare(const QSGMaterial *other) const override;
45
46 void setColor(const QColor &c) {
47 const auto rgbC = c.toRgb();
48 setColor(QVector4D(rgbC.redF(), rgbC.greenF(), rgbC.blueF(), rgbC.alphaF()));
49 }
50 void setColor(const QVector4D &color);
51 const QVector4D &color() const { return m_color; }
52
53 QSGTexture *texture() const { return m_texture; }
54
55 bool ensureUpToDate();
56
59
60 void populate(const QPointF &position,
61 const QList<quint32> &glyphIndexes, const QList<QPointF> &glyphPositions,
62 QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine,
63 const QMargins &margins = QMargins(0, 0, 0, 0));
64
65private:
66 void init(QFontEngine::GlyphFormat glyphFormat);
67 void updateCache(QFontEngine::GlyphFormat glyphFormat);
68
69 QSGDefaultRenderContext *m_rc;
70 QSGPlainTexture *m_texture;
71 QExplicitlySharedDataPointer<QFontEngineGlyphCache> m_glyphCache;
72 QRawFont m_font;
73 QFontEngine *m_retainedFontEngine = nullptr;
74 QRhi *m_rhi;
75 QVector4D m_color;
76 QSize m_size;
77};
78
80{
81public:
82 QSGStyledTextMaterial(QSGRenderContext *rc, const QRawFont &font);
83 virtual ~QSGStyledTextMaterial() { }
84
85 void setStyleShift(const QVector2D &shift) { m_styleShift = shift; }
86 const QVector2D &styleShift() const { return m_styleShift; }
87
88 void setStyleColor(const QColor &c) {
89 const auto rgbC = c.toRgb();
90 m_styleColor = QVector4D(rgbC.redF(), rgbC.greenF(), rgbC.blueF(), rgbC.alphaF());
91 }
92 void setStyleColor(const QVector4D &color) { m_styleColor = color; }
93 const QVector4D &styleColor() const { return m_styleColor; }
94
95 QSGMaterialType *type() const override;
96 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
97 int compare(const QSGMaterial *other) const override;
98
99private:
100 QVector2D m_styleShift;
101 QVector4D m_styleColor;
102};
103
105{
106public:
107 QSGOutlinedTextMaterial(QSGRenderContext *rc, const QRawFont &font);
109
110 QSGMaterialType *type() const override;
111 QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
112};
113
114QT_END_NAMESPACE
115
116#endif
\inmodule QtCore
Definition qmargins.h:27
constexpr void setTop(int top) noexcept
Sets the Top margin to Top.
Definition qmargins.h:148
constexpr void setBottom(int bottom) noexcept
Sets the bottom margin to bottom.
Definition qmargins.h:154
constexpr QMargins(int left, int top, int right, int bottom) noexcept
Constructs margins with the given left, top, right, and bottom.
Definition qmargins.h:126
friend class QFontEngine
Definition qpainter.h:433
The QRawFont class provides access to a single physical instance of a font.
Definition qrawfont.h:24
QSGOutlinedTextMaterial(QSGRenderContext *rc, const QRawFont &font)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
\inmodule QtQuick
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
void setStyleColor(const QVector4D &color)
const QVector2D & styleShift() const
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
void setStyleShift(const QVector2D &shift)
QSGStyledTextMaterial(QSGRenderContext *rc, const QRawFont &font)
const QVector4D & styleColor() const
void setStyleColor(const QColor &c)
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGTextMaskMaterial(QSGRenderContext *rc, const QVector4D &color, const QRawFont &font, QFontEngine::GlyphFormat glyphFormat=QFontEngine::Format_None)
void setColor(const QVector4D &color)
const QVector4D & color() const
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode renderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
void setColor(const QColor &c)
QTextureGlyphCache * glyphCache() const
QSGRhiTextureGlyphCache * rhiGlyphCache() const
void populate(const QPointF &position, const QList< quint32 > &glyphIndexes, const QList< QPointF > &glyphPositions, QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine, const QMargins &margins=QMargins(0, 0, 0, 0))
QSGTexture * texture() const
Combined button and popup list for selecting options.