Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QSGDEFAULTGLYPHNODE_P_P_H
5#define QSGDEFAULTGLYPHNODE_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qcolor.h>
19#include <QtQuick/qsgmaterial.h>
20#include <QtQuick/qsgtexture.h>
21#include <QtQuick/qsggeometry.h>
22#include <qshareddata.h>
23#include <QtQuick/private/qsgplaintexture_p.h>
24#include <QtQuick/private/qsgrhitextureglyphcache_p.h>
25#include <qrawfont.h>
26#include <qmargins.h>
27
29
30class QFontEngine;
31class Geometry;
34
36{
37public:
39 virtual ~QSGTextMaskMaterial();
40
41 QSGMaterialType *type() const override;
43 int compare(const QSGMaterial *other) const override;
44
45 void setColor(const QColor &c) {
46 const auto rgbC = c.toRgb();
47 setColor(QVector4D(rgbC.redF(), rgbC.greenF(), rgbC.blueF(), rgbC.alphaF()));
48 }
49 void setColor(const QVector4D &color);
50 const QVector4D &color() const { return m_color; }
51
52 QSGTexture *texture() const { return m_texture; }
53
54 bool ensureUpToDate();
55
58
59 void populate(const QPointF &position,
60 const QVector<quint32> &glyphIndexes, const QVector<QPointF> &glyphPositions,
61 QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine,
62 const QMargins &margins = QMargins(0, 0, 0, 0));
63
64private:
65 void init(QFontEngine::GlyphFormat glyphFormat);
66 void updateCache(QFontEngine::GlyphFormat glyphFormat);
67
69 QSGPlainTexture *m_texture;
70 QExplicitlySharedDataPointer<QFontEngineGlyphCache> m_glyphCache;
71 QRawFont m_font;
72 QFontEngine *m_retainedFontEngine = nullptr;
73 QRhi *m_rhi;
74 QVector4D m_color;
75 QSize m_size;
76};
77
79{
80public:
83
84 void setStyleShift(const QVector2D &shift) { m_styleShift = shift; }
85 const QVector2D &styleShift() const { return m_styleShift; }
86
87 void setStyleColor(const QColor &c) {
88 const auto rgbC = c.toRgb();
89 m_styleColor = QVector4D(rgbC.redF(), rgbC.greenF(), rgbC.blueF(), rgbC.alphaF());
90 }
91 void setStyleColor(const QVector4D &color) { m_styleColor = color; }
92 const QVector4D &styleColor() const { return m_styleColor; }
93
94 QSGMaterialType *type() const override;
96 int compare(const QSGMaterial *other) const override;
97
98private:
99 QVector2D m_styleShift;
100 QVector4D m_styleColor;
101};
102
112
114
115#endif
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qmargins.h:24
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QRawFont class provides access to a single physical instance of a font.
Definition qrawfont.h:24
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
The QSGMaterialShader class represents a graphics API independent shader program.
The QSGMaterial class encapsulates rendering state for a shader program.
Definition qsgmaterial.h:15
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...
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
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)
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 QVector< quint32 > &glyphIndexes, const QVector< QPointF > &glyphPositions, QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine, const QMargins &margins=QMargins(0, 0, 0, 0))
QSGTexture * texture() const
\inmodule QtQuick
Definition qsgtexture.h:20
\inmodule QtCore
Definition qsize.h:25
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
Combined button and popup list for selecting options.
static QT_WARNING_DISABLE_FLOAT_COMPARE ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
Definition qbezier.cpp:207
GLuint color
[2]
const GLubyte * c
static const QRectF boundingRect(const QPointF *points, int pointCount)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QSharedPointer< T > other(t)
[5]
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.