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
qsgsoftwarepublicnodes_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QSGSOFTWAREPUBLICNODES_H
5#define QSGSOFTWAREPUBLICNODES_H
6
7#include <QtQuick/qsgrectanglenode.h>
8#include <QtQuick/qsgimagenode.h>
9#include <QtQuick/qsgninepatchnode.h>
10#include <QtGui/qpixmap.h>
11#include <QtCore/private/qglobal_p.h>
12
13//
14// W A R N I N G
15// -------------
16//
17// This file is not part of the Qt API. It exists purely as an
18// implementation detail. This header file may change from version to
19// version without notice, or even be removed.
20//
21// We mean it.
22//
23
25
27{
28public:
30
31 void setRect(const QRectF &rect) override { m_rect = rect; markDirty(DirtyMaterial); }
32 QRectF rect() const override { return m_rect; }
33
34 void setColor(const QColor &color) override { m_color = color; markDirty(DirtyMaterial); }
35 QColor color() const override { return m_color; }
36
37 void paint(QPainter *painter);
38
39private:
40 QRectF m_rect;
41 QColor m_color;
42};
43
45{
46public:
49
50 void setRect(const QRectF &rect) override { m_rect = rect; markDirty(DirtyMaterial); }
51 QRectF rect() const override { return m_rect; }
52
53 void setSourceRect(const QRectF &r) override { m_sourceRect = r; }
54 QRectF sourceRect() const override { return m_sourceRect; }
55
56 void setTexture(QSGTexture *texture) override;
57 QSGTexture *texture() const override { return m_texture; }
58
60 QSGTexture::Filtering filtering() const override { return m_filtering; }
61
64
67
68 void setTextureCoordinatesTransform(TextureCoordinatesTransformMode transformNode) override;
69 TextureCoordinatesTransformMode textureCoordinatesTransform() const override { return m_transformMode; }
70
71 void setOwnsTexture(bool owns) override { m_owns = owns; }
72 bool ownsTexture() const override { return m_owns; }
73
74 void paint(QPainter *painter);
75
76private:
77 void updateCachedMirroredPixmap();
78
79 QPixmap m_cachedPixmap;
80 QSGTexture *m_texture;
81 QRectF m_rect;
82 QRectF m_sourceRect;
83 bool m_owns;
84 QSGTexture::Filtering m_filtering;
85 TextureCoordinatesTransformMode m_transformMode;
86 bool m_cachedMirroredPixmapIsDirty;
87};
88
90{
91public:
93
94 void setTexture(QSGTexture *texture) override;
95 void setBounds(const QRectF &bounds) override;
96 void setDevicePixelRatio(qreal ratio) override;
98 void update() override;
99
100 void paint(QPainter *painter);
101
102 QRectF bounds() const;
103
104 bool isOpaque() const { return !m_pixmap.hasAlphaChannel(); }
105
106private:
107 QPixmap m_pixmap;
108 QRectF m_bounds;
109 qreal m_pixelRatio = 1.0;
110 QMargins m_margins;
111};
112
114
115#endif // QSGSOFTWAREPUBLICNODES_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
Definition qmargins.h:24
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
bool hasAlphaChannel() const
\inmodule QtCore\reentrant
Definition qrect.h:484
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
\inmodule QtQuick
@ DirtyMaterial
Definition qsgnode.h:75
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:624
The QSGRectangleNode class is a convenience class for drawing solid filled rectangles using scenegrap...
QSGTexture::Filtering filtering() const override
Returns the filtering for this image node.
QRectF sourceRect() const override
Returns the source rect of this image node.
void setAnisotropyLevel(QSGTexture::AnisotropyLevel) override
Sets this image node's anistropy level to level.
void setRect(const QRectF &rect) override
Sets the target rect of this image node to rect.
void setTexture(QSGTexture *texture) override
Sets the texture of this image node to texture.
void setSourceRect(const QRectF &r) override
Sets the source rect of this image node to rect.
void setMipmapFiltering(QSGTexture::Filtering) override
Sets the mipmap filtering to be used for this image node to filtering.
QSGTexture::Filtering mipmapFiltering() const override
Returns the mipmap filtering for this image node.
QRectF rect() const override
Returns the target rect of this image node.
QSGTexture * texture() const override
Returns the texture for this image node.
TextureCoordinatesTransformMode textureCoordinatesTransform() const override
Returns the mode used to generate texture coordinates for this node.
bool ownsTexture() const override
void setTextureCoordinatesTransform(TextureCoordinatesTransformMode transformNode) override
Sets the method used to generate texture coordinates to mode.
void setFiltering(QSGTexture::Filtering filtering) override
Sets the filtering to be used for this image node to filtering.
void setOwnsTexture(bool owns) override
Sets whether the node takes ownership of the texture to owns.
QSGTexture::AnisotropyLevel anisotropyLevel() const override
Returns this image node's anistropy level.
void setDevicePixelRatio(qreal ratio) override
void setTexture(QSGTexture *texture) override
void setPadding(qreal left, qreal top, qreal right, qreal bottom) override
void setBounds(const QRectF &bounds) override
QRectF rect() const override
Returns the rectangle that this rect node covers.
QColor color() const override
Returns the color of this rectangle.
void setColor(const QColor &color) override
Sets the color of this rectangle to color.
void setRect(const QRectF &rect) override
Sets the rectangle of this rect node to rect.
\inmodule QtQuick
Definition qsgtexture.h:20
Filtering
Specifies how sampling of texels should filter when texture coordinates are not pixel aligned.
Definition qsgtexture.h:34
AnisotropyLevel
Specifies the anisotropic filtering level to be used when the texture is not screen aligned.
Definition qsgtexture.h:40
QPainter paint
Combined button and popup list for selecting options.
GLboolean r
[2]
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLuint color
[2]
GLint left
GLint GLint bottom
GLenum GLuint texture
double qreal
Definition qtypes.h:187
QPainter painter(this)
[7]