<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qsgimagenode.cpp --> <title>QSGImageNode Class | Qt Quick 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-module.html">C++ Classes</a></td><td >QSGImageNode</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QSGImageNode Class</h1> <!-- $$$QSGImageNode-brief --> <p>The <a href="qsgimagenode.html">QSGImageNode</a> class is provided for convenience to easily draw textured content using the QML scene graph. <a href="#details">More...</a></p> <!-- @@@QSGImageNode --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QSGImageNode></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += quick</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.8</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qsggeometrynode.html">QSGGeometryNode</a></td></tr></table></div><ul> <li><a href="qsgimagenode-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformFlag</a></b> { NoTransform, MirrorHorizontally, MirrorVertically }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformMode</a></b></td></tr> </table></div> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#dtor.QSGImageNode">~QSGImageNode</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSGTexture::Filtering </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#filtering">filtering</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSGTexture::Filtering </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#mipmapFiltering">mipmapFiltering</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#ownsTexture">ownsTexture</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QRectF </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#rect">rect</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setFiltering">setFiltering</a></b>(QSGTexture::Filtering <i>filtering</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setMipmapFiltering">setMipmapFiltering</a></b>(QSGTexture::Filtering <i>filtering</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setOwnsTexture">setOwnsTexture</a></b>(bool <i>owns</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setRect">setRect</a></b>(const QRectF &<i>rect</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setRect-1">setRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setSourceRect">setSourceRect</a></b>(const QRectF &<i>rect</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setSourceRect-1">setSourceRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setTexture">setTexture</a></b>(QSGTexture *<i>texture</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#setTextureCoordinatesTransform">setTextureCoordinatesTransform</a></b>(TextureCoordinatesTransformMode <i>mode</i>) = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QRectF </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#sourceRect">sourceRect</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSGTexture *</td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#texture">texture</a></b>() const = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual TextureCoordinatesTransformMode </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#textureCoordinatesTransform">textureCoordinatesTransform</a></b>() const = 0</td></tr> </table></div> <ul> <li class="fn">4 public functions inherited from <a href="qsggeometrynode.html#public-functions">QSGGeometryNode</a></li> <li class="fn">3 public functions inherited from <a href="qsgbasicgeometrynode.html#public-functions">QSGBasicGeometryNode</a></li> <li class="fn">20 public functions inherited from <a href="qsgnode.html#public-functions">QSGNode</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsgimagenode.html#rebuildGeometry">rebuildGeometry</a></b>(QSGGeometry *<i>g</i>, QSGTexture *<i>texture</i>, const QRectF &<i>rect</i>, QRectF <i>sourceRect</i>, TextureCoordinatesTransformMode <i>texCoordMode</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QSGImageNode-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qsgimagenode.html">QSGImageNode</a> class is provided for convenience to easily draw textured content using the QML scene graph.</p> <p><b>Warning:</b> The image node class must have a texture before being added to the scene graph to be rendered.</p> </div> <!-- @@@QSGImageNode --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$TextureCoordinatesTransformFlag$$$NoTransform$$$MirrorHorizontally$$$MirrorVertically --> <h3 class="flags" id="TextureCoordinatesTransformFlag-enum"><a name="TextureCoordinatesTransformFlag-enum"></a>enum QSGImageNode::<span class="name">TextureCoordinatesTransformFlag</span><br/>flags QSGImageNode::<span class="name">TextureCoordinatesTransformMode</span></h3> <p>The TextureCoordinatesTransformFlag enum is used to specify the mode used to generate texture coordinates for a textured quad.</p> <div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><code>QSGImageNode::NoTransform</code></td><td class="topAlign tblval"><code>0x00</code></td><td class="topAlign">Texture coordinates are oriented with window coordinates i.e. with origin at top-left.</td></tr> <tr><td class="topAlign"><code>QSGImageNode::MirrorHorizontally</code></td><td class="topAlign tblval"><code>0x01</code></td><td class="topAlign">Texture coordinates are inverted in the horizontal axis with respect to window coordinates</td></tr> <tr><td class="topAlign"><code>QSGImageNode::MirrorVertically</code></td><td class="topAlign tblval"><code>0x02</code></td><td class="topAlign">Texture coordinates are inverted in the vertical axis with respect to window coordinates</td></tr> </table></div> <p>The TextureCoordinatesTransformMode type is a typedef for <a href="">QFlags</a><TextureCoordinatesTransformFlag>. It stores an OR combination of TextureCoordinatesTransformFlag values.</p> <!-- @@@TextureCoordinatesTransformFlag --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$~QSGImageNode[overload1]$$$~QSGImageNode --> <h3 class="fn" id="dtor.QSGImageNode"><a name="dtor.QSGImageNode"></a><code>[virtual] </code>QSGImageNode::<span class="name">~QSGImageNode</span>()</h3> <p>Destroys the instance of QSGImageNode. The destructor is virtual.</p><!-- @@@~QSGImageNode --> <!-- $$$filtering[overload1]$$$filtering --> <h3 class="fn" id="filtering"><a name="filtering"></a><code>[pure virtual] </code><span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> QSGImageNode::<span class="name">filtering</span>() const</h3> <p>Returns the filtering for this image node.</p> <p><b>See also </b><a href="qsgimagenode.html#setFiltering">setFiltering</a>().</p> <!-- @@@filtering --> <!-- $$$mipmapFiltering[overload1]$$$mipmapFiltering --> <h3 class="fn" id="mipmapFiltering"><a name="mipmapFiltering"></a><code>[pure virtual] </code><span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> QSGImageNode::<span class="name">mipmapFiltering</span>() const</h3> <p>Returns the mipmap filtering for this image node.</p> <p><b>See also </b><a href="qsgimagenode.html#setMipmapFiltering">setMipmapFiltering</a>().</p> <!-- @@@mipmapFiltering --> <!-- $$$ownsTexture[overload1]$$$ownsTexture --> <h3 class="fn" id="ownsTexture"><a name="ownsTexture"></a><code>[pure virtual] </code><span class="type">bool</span> QSGImageNode::<span class="name">ownsTexture</span>() const</h3> <p>Returns <code>true</code> if the node takes ownership of the texture; otherwise <code>false</code>.</p> <p><b>See also </b><a href="qsgimagenode.html#setOwnsTexture">setOwnsTexture</a>().</p> <!-- @@@ownsTexture --> <!-- $$$rebuildGeometry[overload1]$$$rebuildGeometryQSGGeometry*QSGTexture*constQRectF&QRectFTextureCoordinatesTransformMode --> <h3 class="fn" id="rebuildGeometry"><a name="rebuildGeometry"></a><code>[static] </code><span class="type">void</span> QSGImageNode::<span class="name">rebuildGeometry</span>(<span class="type"><a href="qsggeometry.html">QSGGeometry</a></span> *<i>g</i>, <span class="type"><a href="qsgtexture.html">QSGTexture</a></span> *<i>texture</i>, const <span class="type">QRectF</span> &<i>rect</i>, <span class="type">QRectF</span> <i>sourceRect</i>, <span class="type"><a href="qsgimagenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformMode</a></span> <i>texCoordMode</i>)</h3> <!-- @@@rebuildGeometry --> <!-- $$$rect[overload1]$$$rect --> <h3 class="fn" id="rect"><a name="rect"></a><code>[pure virtual] </code><span class="type">QRectF</span> QSGImageNode::<span class="name">rect</span>() const</h3> <p>Returns the target rect of this image node.</p> <p><b>See also </b><a href="qsgimagenode.html#setRect">setRect</a>().</p> <!-- @@@rect --> <!-- $$$setFiltering[overload1]$$$setFilteringQSGTexture::Filtering --> <h3 class="fn" id="setFiltering"><a name="setFiltering"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setFiltering</span>(<span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> <i>filtering</i>)</h3> <p>Sets the filtering to be used for this image node to <i>filtering</i>.</p> <p>For smooth scaling, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Linear</a>. For normal scaling, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Nearest</a>.</p> <p><b>See also </b><a href="qsgimagenode.html#filtering">filtering</a>().</p> <!-- @@@setFiltering --> <!-- $$$setMipmapFiltering[overload1]$$$setMipmapFilteringQSGTexture::Filtering --> <h3 class="fn" id="setMipmapFiltering"><a name="setMipmapFiltering"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setMipmapFiltering</span>(<span class="type"><a href="qsgtexture.html#Filtering-enum">QSGTexture::Filtering</a></span> <i>filtering</i>)</h3> <p>Sets the mipmap filtering to be used for this image node to <i>filtering</i>.</p> <p>For smooth scaling between mip maps, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Linear</a>. For normal scaling, use <a href="qsgtexture.html#Filtering-enum">QSGTexture::Nearest</a>.</p> <p><b>See also </b><a href="qsgimagenode.html#mipmapFiltering">mipmapFiltering</a>().</p> <!-- @@@setMipmapFiltering --> <!-- $$$setOwnsTexture[overload1]$$$setOwnsTexturebool --> <h3 class="fn" id="setOwnsTexture"><a name="setOwnsTexture"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setOwnsTexture</span>(<span class="type">bool</span> <i>owns</i>)</h3> <p>Sets whether the node takes ownership of the texture to <i>owns</i>.</p> <p>By default, the node does not take ownership of the texture.</p> <p><b>See also </b><a href="qsgimagenode.html#ownsTexture">ownsTexture</a>().</p> <!-- @@@setOwnsTexture --> <!-- $$$setRect[overload1]$$$setRectconstQRectF& --> <h3 class="fn" id="setRect"><a name="setRect"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setRect</span>(const <span class="type">QRectF</span> &<i>rect</i>)</h3> <p>Sets the target rect of this image node to <i>rect</i>.</p> <p><b>See also </b><a href="qsgimagenode.html#rect">rect</a>().</p> <!-- @@@setRect --> <!-- $$$setRect$$$setRectqrealqrealqrealqreal --> <h3 class="fn" id="setRect-1"><a name="setRect-1"></a><span class="type">void</span> QSGImageNode::<span class="name">setRect</span>(<span class="type">qreal</span> <i>x</i>, <span class="type">qreal</span> <i>y</i>, <span class="type">qreal</span> <i>w</i>, <span class="type">qreal</span> <i>h</i>)</h3> <p>This is an overloaded function.</p> <p>Sets the rectangle of this image node to begin at (<i>x</i>, <i>y</i>) and have width <i>w</i> and height <i>h</i>.</p> <!-- @@@setRect --> <!-- $$$setSourceRect[overload1]$$$setSourceRectconstQRectF& --> <h3 class="fn" id="setSourceRect"><a name="setSourceRect"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setSourceRect</span>(const <span class="type">QRectF</span> &<i>rect</i>)</h3> <p>Sets the source rect of this image node to <i>rect</i>.</p> <p><b>See also </b><a href="qsgimagenode.html#sourceRect">sourceRect</a>().</p> <!-- @@@setSourceRect --> <!-- $$$setSourceRect$$$setSourceRectqrealqrealqrealqreal --> <h3 class="fn" id="setSourceRect-1"><a name="setSourceRect-1"></a><span class="type">void</span> QSGImageNode::<span class="name">setSourceRect</span>(<span class="type">qreal</span> <i>x</i>, <span class="type">qreal</span> <i>y</i>, <span class="type">qreal</span> <i>w</i>, <span class="type">qreal</span> <i>h</i>)</h3> <p>This is an overloaded function.</p> <p>Sets the rectangle of this image node to show its texture from (<i>x</i>, <i>y</i>) and have width <i>w</i> and height <i>h</i> relatively to the <a href="qsgtexture.html#textureSize">QSGTexture::textureSize</a>.</p> <!-- @@@setSourceRect --> <!-- $$$setTexture[overload1]$$$setTextureQSGTexture* --> <h3 class="fn" id="setTexture"><a name="setTexture"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setTexture</span>(<span class="type"><a href="qsgtexture.html">QSGTexture</a></span> *<i>texture</i>)</h3> <p>Sets the texture of this image node to <i>texture</i>.</p> <p>Use <a href="qsgimagenode.html#setOwnsTexture">setOwnsTexture</a>() to set whether the node should take ownership of the texture. By default, the node does not take ownership.</p> <p><b>Warning:</b> An image node must have a texture before being added to the scenegraph to be rendered.</p> <p><b>See also </b><a href="qsgimagenode.html#texture">texture</a>().</p> <!-- @@@setTexture --> <!-- $$$setTextureCoordinatesTransform[overload1]$$$setTextureCoordinatesTransformTextureCoordinatesTransformMode --> <h3 class="fn" id="setTextureCoordinatesTransform"><a name="setTextureCoordinatesTransform"></a><code>[pure virtual] </code><span class="type">void</span> QSGImageNode::<span class="name">setTextureCoordinatesTransform</span>(<span class="type"><a href="qsgimagenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformMode</a></span> <i>mode</i>)</h3> <p>Sets the method used to generate texture coordinates to <i>mode</i>. This can be used to obtain correct orientation of the texture. This is commonly needed when using a third-party OpenGL library to render to texture as OpenGL has an inverted y-axis relative to Qt Quick.</p> <p><b>See also </b><a href="qsgimagenode.html#textureCoordinatesTransform">textureCoordinatesTransform</a>().</p> <!-- @@@setTextureCoordinatesTransform --> <!-- $$$sourceRect[overload1]$$$sourceRect --> <h3 class="fn" id="sourceRect"><a name="sourceRect"></a><code>[pure virtual] </code><span class="type">QRectF</span> QSGImageNode::<span class="name">sourceRect</span>() const</h3> <p>Returns the source rect of this image node.</p> <p><b>See also </b><a href="qsgimagenode.html#setSourceRect">setSourceRect</a>().</p> <!-- @@@sourceRect --> <!-- $$$texture[overload1]$$$texture --> <h3 class="fn" id="texture"><a name="texture"></a><code>[pure virtual] </code><span class="type"><a href="qsgtexture.html">QSGTexture</a></span> *QSGImageNode::<span class="name">texture</span>() const</h3> <p>Returns the texture for this image node.</p> <p><b>See also </b><a href="qsgimagenode.html#setTexture">setTexture</a>().</p> <!-- @@@texture --> <!-- $$$textureCoordinatesTransform[overload1]$$$textureCoordinatesTransform --> <h3 class="fn" id="textureCoordinatesTransform"><a name="textureCoordinatesTransform"></a><code>[pure virtual] </code><span class="type"><a href="qsgimagenode.html#TextureCoordinatesTransformFlag-enum">TextureCoordinatesTransformMode</a></span> QSGImageNode::<span class="name">textureCoordinatesTransform</span>() const</h3> <p>Returns the mode used to generate texture coordinates for this node.</p> <p><b>See also </b><a href="qsgimagenode.html#setTextureCoordinatesTransform">setTextureCoordinatesTransform</a>().</p> <!-- @@@textureCoordinatesTransform --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>