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
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
24QT_BEGIN_NAMESPACE
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
59 void setFiltering(QSGTexture::Filtering filtering) override { m_filtering = filtering; markDirty(DirtyMaterial); }
60 QSGTexture::Filtering filtering() const override { return m_filtering; }
61
63 QSGTexture::Filtering mipmapFiltering() const override { return QSGTexture::None; }
64
66 QSGTexture::AnisotropyLevel anisotropyLevel() const override { return QSGTexture::AnisotropyNone; }
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;
97 void setPadding(qreal left, qreal top, qreal right, qreal bottom) 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
113QT_END_NAMESPACE
114
115#endif // QSGSOFTWAREPUBLICNODES_H
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 paint(QPainter *painter)
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 setInnerSourceRect(const QRectF &rect) override
void setTexture(QSGTexture *texture) override
void setSubSourceRect(const QRectF &rect) override
void preprocess() override
Override this function to do processing on the node before it is rendered.
void setTargetRect(const QRectF &rect) override
void setVerticalWrapMode(QSGTexture::WrapMode wrapMode) override
void setInnerTargetRect(const QRectF &rect) override
void setMirror(bool mirrorHorizontally, bool mirrorVertically) override
void setMipmapFiltering(QSGTexture::Filtering filtering) override
void setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) override
void setFiltering(QSGTexture::Filtering filtering) override
void setAntialiasing(bool antialiasing) override
void setColor(const QColor &color) override
void setGradientStops(const QGradientStops &stops) override
void setPenColor(const QColor &color) override
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
QSGTexture * texture() const override
void setDirty(const QRect &dirtyRect=QRect()) override
void setTextureSize(const QSize &size) override
void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override
void setOpaquePainting(bool opaque) override
void paint(QPainter *painter)
void setSmoothPainting(bool s) override
void setMipmapping(bool mipmapping) override
QImage toImage() const override
void setContentsScale(qreal s) override
void setFillColor(const QColor &c) override
void setLinearFiltering(bool linearFiltering) override
void setFastFBOResizing(bool dynamic) override
QSGSoftwarePainterNode(QQuickPaintedItem *item)
void setSize(const QSize &size) override
bool hasAlphaChannel() const override
Returns true if the texture data contains an alpha channel.
bool hasMipmaps() const override
Returns true if the texture data contains mipmap levels.
QSize textureSize() const override
Returns the size of the texture in pixels.
qint64 comparisonKey() const override
Returns a key suitable for comparing textures.
QSGSoftwarePixmapTexture(const QPixmap &pixmap)
QRectF rect() const override
Returns the rectangle that this rect node covers.
void paint(QPainter *painter)
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.
QVarLengthArray< QPainter::PixmapFragment, 16 > QPixmapFragmentsArray
QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
QTileRules(Qt::TileRule rule=Qt::StretchTile)