6#include <QtCore/qfileinfo.h>
7#include <QtQuick/qsggeometry.h>
8#include <QtQuick/qsgtexturematerial.h>
9#include <QtQuick/private/qsgnode_p.h>
10#include <QtQuick/private/qquickimage_p_p.h>
27 bool inverted =
false;
37 const int n = (inverted ? l - 1 : l) / 2;
44 bool stretched = !inverted;
45 for (
int i = 1;
i < l; ++
i) {
51 stretched = !stretched;
97 : m_geometry(
QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
115 const int xlen = xDivs.
count();
116 const int ylen = yDivs.
count();
118 if (xlen > 0 && ylen > 0) {
119 const int quads = (xlen - 1) * (ylen - 1);
120 static const int verticesPerQuad = 6;
121 m_geometry.
allocate(xlen * ylen, verticesPerQuad * quads);
127 for (
int y = 0;
y < ylen; ++
y) {
128 for (
int x = 0;
x < xlen; ++
x, ++vertices)
136 for (
int q = 0;
n--; ++
q) {
137 if ((
q + 1) % xlen == 0)
269 if (horizontal.
size() >= 2) {
277 if (vertical.
size() >= 2) {
286 emit q->topPaddingChanged();
288 emit q->bottomPaddingChanged();
290 emit q->leftPaddingChanged();
292 emit q->rightPaddingChanged();
303 if (horizontal.
size() >= 2 && horizontal.
first() == 0)
308 if (horizontal.
size() == 2 && horizontal.
first() > 0)
310 else if (horizontal.
size() == 4)
315 if (vertical.
size() >= 2 && vertical.
first() == 0)
320 if (vertical.
size() == 2 && vertical.
first() > 0)
322 else if (vertical.
size() == 4)
328 emit q->topInsetChanged();
330 emit q->bottomInsetChanged();
332 emit q->leftInsetChanged();
334 emit q->rightInsetChanged();
347 return d->topPadding /
d->devicePixelRatio;
353 return d->leftPadding /
d->devicePixelRatio;
359 return d->rightPadding /
d->devicePixelRatio;
365 return d->bottomPadding /
d->devicePixelRatio;
371 return d->topInset /
d->devicePixelRatio;
377 return d->leftInset /
d->devicePixelRatio;
383 return d->rightInset /
d->devicePixelRatio;
389 return d->bottomInset /
d->devicePixelRatio;
400 d->resetNode =
d->ninePatch.isNull();
402 d->ninePatch =
d->pix.image();
403 if (
d->ninePatch.depth() != 32)
406 int w =
d->ninePatch.width();
407 int h =
d->ninePatch.height();
408 d->pix.setImage(
QImage(
d->ninePatch.constBits() + 4 * (
w + 1),
w - 2,
h - 2,
d->ninePatch.bytesPerLine(),
d->ninePatch.format()));
429 d->resetNode = !
d->ninePatch.isNull();
443 d->resetNode =
false;
446 if (
d->ninePatch.isNull())
453 d->provider->updateTexture(
nullptr);
462#ifdef QSG_RUNTIME_DESCRIPTION
482#include "moc_qquickninepatchimage_p.cpp"
\inmodule QtCore \reentrant
QString completeSuffix() const
Returns the complete suffix (extension) of the file.
int width() const
Returns the width of the image.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
int height() const
Returns the height of the image.
const uchar * constBits() const
Returns a pointer to the first pixel data.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void pixmapChange() override
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QQuickNinePatchData xDivs
void updatePaddings(const QSizeF &size, const QList< qreal > &horizontal, const QList< qreal > &vertical)
QQuickNinePatchData yDivs
void updateInsets(const QList< qreal > &horizontal, const QList< qreal > &vertical)
QQuickNinePatchImage(QQuickItem *parent=nullptr)
void pixmapChange() override
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void initialize(QSGTexture *texture, const QSizeF &targetSize, const QSize &sourceSize, const QQuickNinePatchData &xDivs, const QQuickNinePatchData &yDivs, qreal dpr)
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
The QSGGeometryNode class is used for all rendered content in the scene graph.
QSGMaterial * material() const
Returns the material of the QSGGeometryNode.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
void setDrawingMode(unsigned int mode)
Sets the mode to be used for drawing this geometry.
TexturedPoint2D * vertexDataAsTexturedPoint2D()
Convenience function to access the vertex data as a mutable array of QSGGeometry::TexturedPoint2D.
void allocate(int vertexCount, int indexCount=0)
Resizes the vertex and index data of this geometry object to fit vertexCount vertices and indexCount ...
quint16 * indexDataAsUShort()
Convenience function to access the index data as a mutable array of 16-bit unsigned integers.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFiltering(QSGTexture::Filtering filteringType)
Sets the filtering to filtering.
void setTexture(QSGTexture *texture)
Sets the texture of this material to texture.
QSGTexture * texture() const
Returns this texture material's texture.
The QSGTextureMaterial class provides a convenient way of rendering textured geometry in the scene gr...
constexpr bool isValid() const noexcept
Returns true if both the width and height are equal to or greater than 0; otherwise returns false.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString toLower() const &
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLubyte GLsizei GLenum const void * coords
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLsizei GLenum const void * indices
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static QList< qreal > readCoords(const QRgb *data, int from, int count, int offset, QRgb color)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr QRgb qRgb(int r, int g, int b)
void qsgnode_set_description(QSGNode *node, const QString &description)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
QList< qreal > coordsForSize(qreal count) const
void fill(const QList< qreal > &coords, qreal count)
qreal at(int index) const
The QSGGeometry::TexturedPoint2D struct is a convenience struct for accessing 2D Points with texture ...
void set(float nx, float ny, float ntx, float nty)
Sets the position of the vertex to x and y and the texture coordinate to tx and ty.
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent