Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 2047

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qglcolormap.cpp -->
  <title>QGLColormap Class | Qt OpenGL</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="qtopengl-index.html">Qt OpenGL</a></td><td ><a href="qtopengl-module.html">C++ Classes</a></td><td >QGLColormap</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-functions">Public Functions</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">QGLColormap Class</h1>
<!-- $$$QGLColormap-brief -->
<p>The <a href="qglcolormap.html">QGLColormap</a> class is used for installing custom colormaps into a <a href="qglwidget.html">QGLWidget</a>. <a href="#details">More...</a></p>
<!-- @@@QGLColormap -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGLColormap&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += opengl</td></tr></table></div><p><b>This class is obsolete.</b> It is provided to keep old source code working. We strongly advise against using it in new code.</p>
<ul>
<li><a href="qglcolormap-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#QGLColormap">QGLColormap</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#QGLColormap-1">QGLColormap</a></b>(const QGLColormap &amp;<i>map</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#dtor.QGLColormap">~QGLColormap</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#entryColor">entryColor</a></b>(int <i>idx</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRgb </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#entryRgb">entryRgb</a></b>(int <i>idx</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#find">find</a></b>(QRgb <i>color</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#findNearest">findNearest</a></b>(QRgb <i>color</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#isEmpty">isEmpty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#setEntries">setEntries</a></b>(int <i>count</i>, const QRgb *<i>colors</i>, int <i>base</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#setEntry">setEntry</a></b>(int <i>idx</i>, QRgb <i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#setEntry-1">setEntry</a></b>(int <i>idx</i>, const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGLColormap &amp;</td><td class="memItemRight bottomAlign"><b><a href="qglcolormap.html#operator-eq">operator=</a></b>(const QGLColormap &amp;<i>map</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QGLColormap-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qglcolormap.html">QGLColormap</a> class is used for installing custom colormaps into a <a href="qglwidget.html">QGLWidget</a>.</p>
<p><a href="qglcolormap.html">QGLColormap</a> provides a platform independent way of specifying and installing indexed colormaps for a <a href="qglwidget.html">QGLWidget</a>. <a href="qglcolormap.html">QGLColormap</a> is especially useful when using the OpenGL color-index mode.</p>
<p>Under X11 you must use an X server that supports either a <code>PseudoColor</code> or <code>DirectColor</code> visual class. If your X server currently only provides a <code>GrayScale</code>, <code>TrueColor</code>, <code>StaticColor</code> or <code>StaticGray</code> visual, you will not be able to allocate colorcells for writing. If this is the case, try setting your X server to 8 bit mode. It should then provide you with at least a <code>PseudoColor</code> visual. Note that you may experience colormap flashing if your X server is running in 8 bit mode.</p>
<p>The <a href="qglcolormap.html#size">size</a>() of the colormap is always set to 256 colors. Note that under Windows you can also install colormaps in child widgets.</p>
<p>This class uses <a href="../qtcore/implicit-sharing.html">implicit sharing</a> as a memory and speed optimization.</p>
<p>Example of use:</p>
<pre class="cpp">

  <span class="preprocessor">#include &lt;QApplication&gt;</span>
  <span class="preprocessor">#include &lt;QGLColormap&gt;</span>

  <span class="type">int</span> main()
  {
      <span class="type"><a href="../qtwidgets/qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv);

      MySuperGLWidget widget;     <span class="comment">// a QGLWidget in color-index mode</span>
      <span class="type"><a href="qglcolormap.html#QGLColormap">QGLColormap</a></span> colormap;

      <span class="comment">// This will fill the colormap with colors ranging from</span>
      <span class="comment">// black to white.</span>
      <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> colormap<span class="operator">.</span>size(); i<span class="operator">+</span><span class="operator">+</span>)
          colormap<span class="operator">.</span>setEntry(i<span class="operator">,</span> <a href="../qtgui/qcolor.html#qRgb">qRgb</a>(i<span class="operator">,</span> i<span class="operator">,</span> i));

      widget<span class="operator">.</span>setColormap(colormap);
      widget<span class="operator">.</span>show();
      <span class="keyword">return</span> app<span class="operator">.</span>exec();
  }

</pre>
</div>
<p><b>See also </b><a href="qglwidget.html#setColormap">QGLWidget::setColormap</a>() and <a href="qglwidget.html#colormap">QGLWidget::colormap</a>().</p>
<!-- @@@QGLColormap -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGLColormap[overload1]$$$QGLColormap -->
<h3 class="fn" id="QGLColormap"><a name="QGLColormap"></a>QGLColormap::<span class="name">QGLColormap</span>()</h3>
<p>Construct a <a href="qglcolormap.html" class="obsolete">QGLColormap</a>.</p>
<!-- @@@QGLColormap -->
<!-- $$$QGLColormap$$$QGLColormapconstQGLColormap& -->
<h3 class="fn" id="QGLColormap-1"><a name="QGLColormap-1"></a>QGLColormap::<span class="name">QGLColormap</span>(const <span class="type"><a href="qglcolormap.html#QGLColormap">QGLColormap</a></span> &amp;<i>map</i>)</h3>
<p>Construct a shallow copy of <i>map</i>.</p>
<!-- @@@QGLColormap -->
<!-- $$$~QGLColormap[overload1]$$$~QGLColormap -->
<h3 class="fn" id="dtor.QGLColormap"><a name="dtor.QGLColormap"></a>QGLColormap::<span class="name">~QGLColormap</span>()</h3>
<p>Dereferences the <a href="qglcolormap.html" class="obsolete">QGLColormap</a> and deletes it if this was the last reference to it.</p>
<!-- @@@~QGLColormap -->
<!-- $$$entryColor[overload1]$$$entryColorint -->
<h3 class="fn" id="entryColor"><a name="entryColor"></a><span class="type"><a href="../qtgui/qcolor.html">QColor</a></span> QGLColormap::<span class="name">entryColor</span>(<span class="type">int</span> <i>idx</i>) const</h3>
<p>Returns the <a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a> value in the colorcell with index <i>idx</i>.</p>
<!-- @@@entryColor -->
<!-- $$$entryRgb[overload1]$$$entryRgbint -->
<h3 class="fn" id="entryRgb"><a name="entryRgb"></a><span class="type"><a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a></span> QGLColormap::<span class="name">entryRgb</span>(<span class="type">int</span> <i>idx</i>) const</h3>
<p>Returns the <a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a> value in the colorcell with index <i>idx</i>.</p>
<!-- @@@entryRgb -->
<!-- $$$find[overload1]$$$findQRgb -->
<h3 class="fn" id="find"><a name="find"></a><span class="type">int</span> QGLColormap::<span class="name">find</span>(<span class="type"><a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a></span> <i>color</i>) const</h3>
<p>Returns the index of the color <i>color</i>. If <i>color</i> is not in the map, -1 is returned.</p>
<!-- @@@find -->
<!-- $$$findNearest[overload1]$$$findNearestQRgb -->
<h3 class="fn" id="findNearest"><a name="findNearest"></a><span class="type">int</span> QGLColormap::<span class="name">findNearest</span>(<span class="type"><a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a></span> <i>color</i>) const</h3>
<p>Returns the index of the color that is the closest match to color <i>color</i>.</p>
<!-- @@@findNearest -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn" id="isEmpty"><a name="isEmpty"></a><span class="type">bool</span> QGLColormap::<span class="name">isEmpty</span>() const</h3>
<p>Returns <code>true</code> if the colormap is empty or it is not in use by a QGLWidget; otherwise returns <code>false</code>.</p>
<p>A colormap with no color values set is considered to be empty. For historical reasons, a colormap that has color values set but which is not in use by a QGLWidget is also considered empty.</p>
<p>Compare <a href="qglcolormap.html#size">size</a>() with zero to determine if the colormap is empty regardless of whether it is in use by a QGLWidget or not.</p>
<p><b>See also </b><a href="qglcolormap.html#size">size</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$setEntries[overload1]$$$setEntriesintconstQRgb*int -->
<h3 class="fn" id="setEntries"><a name="setEntries"></a><span class="type">void</span> QGLColormap::<span class="name">setEntries</span>(<span class="type">int</span> <i>count</i>, const <span class="type"><a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a></span> *<i>colors</i>, <span class="type">int</span> <i>base</i> = 0)</h3>
<p>Set an array of cells in this colormap. <i>count</i> is the number of colors that should be set, <i>colors</i> is the array of colors, and <i>base</i> is the starting index. The first element in <i>colors</i> is set at <i>base</i> in the colormap.</p>
<!-- @@@setEntries -->
<!-- $$$setEntry[overload1]$$$setEntryintQRgb -->
<h3 class="fn" id="setEntry"><a name="setEntry"></a><span class="type">void</span> QGLColormap::<span class="name">setEntry</span>(<span class="type">int</span> <i>idx</i>, <span class="type"><a href="../qtgui/qcolor.html#QRgb-typedef">QRgb</a></span> <i>color</i>)</h3>
<p>Set cell at index <i>idx</i> in the colormap to color <i>color</i>.</p>
<!-- @@@setEntry -->
<!-- $$$setEntry$$$setEntryintconstQColor& -->
<h3 class="fn" id="setEntry-1"><a name="setEntry-1"></a><span class="type">void</span> QGLColormap::<span class="name">setEntry</span>(<span class="type">int</span> <i>idx</i>, const <span class="type"><a href="../qtgui/qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>This is an overloaded function.</p>
<p>Set the cell with index <i>idx</i> in the colormap to color <i>color</i>.</p>
<!-- @@@setEntry -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><span class="type">int</span> QGLColormap::<span class="name">size</span>() const</h3>
<p>Returns the number of colorcells in the colormap.</p>
<!-- @@@size -->
<!-- $$$operator=[overload1]$$$operator=constQGLColormap& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qglcolormap.html#QGLColormap">QGLColormap</a></span> &amp;QGLColormap::<span class="name">operator=</span>(const <span class="type"><a href="qglcolormap.html#QGLColormap">QGLColormap</a></span> &amp;<i>map</i>)</h3>
<p>Assign a shallow copy of <i>map</i> to this <a href="qglcolormap.html" class="obsolete">QGLColormap</a>.</p>
<!-- @@@operator= -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</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>