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
qquickcontext2dtile.cpp
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
5
7
9 : m_dirty(true)
10 , m_rect(QRect(0, 0, 1, 1))
11 , m_device(nullptr)
12{
13}
14
20
21QPainter* QQuickContext2DTile::createPainter(bool smooth, bool antialiasing)
22{
23 if (m_painter.isActive())
24 m_painter.end();
25
27 if (m_device) {
31
32#ifdef QQUICKCONTEXT2D_DEBUG
33 int v = 100;
34 int gray = (m_rect.x() / m_rect.width() + m_rect.y() / m_rect.height()) % 2;
35 if (gray)
36 v = 150;
37 m_painter.fillRect(QRect(0, 0, m_rect.width(), m_rect.height()), QColor(v, v, v, 255));
38#endif
39
40 if (antialiasing)
42 else
44
45 if (smooth)
47 else
49
54 return &m_painter;
55 }
56
57 return nullptr;
58}
59
64
68
70{
71 if (m_rect == r)
72 return;
73 m_rect = r;
74 m_dirty = true;
75 if (m_image.size() != r.size()) {
77 }
78 m_device = &m_image;
79}
80
82
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
QSize size() const
Returns the size of the image, i.e.
@ Format_ARGB32_Premultiplied
Definition qimage.h:48
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setClipping(bool enable)
Enables clipping if enable is true, or disables clipping if enable is false.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
@ SmoothPixmapTransform
Definition qpainter.h:54
@ Antialiasing
Definition qpainter.h:52
@ TextAntialiasing
Definition qpainter.h:53
bool end()
Ends painting.
void resetTransform()
Resets any transformations that were made using translate(), scale(), shear(), rotate(),...
@ CompositionMode_SourceOver
Definition qpainter.h:98
@ CompositionMode_Source
Definition qpainter.h:101
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void setRenderHints(RenderHints hints, bool on=true)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint.
void setRect(const QRect &r) override
virtual QPainter * createPainter(bool smooth, bool antialiasing)
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:176
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:173
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:188
Combined button and popup list for selecting options.
GLsizei const GLfloat * v
[13]
GLboolean r
[2]
QObject::connect nullptr