Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 704

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGLColormap Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGLColormap Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1><p>The QGLColormap class is used for installing custom colormaps
into a <a href="qglwidget.html">QGLWidget</a>. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qglcolormap.html#QGLColormap">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcolormap.html#QGLColormap-2">__init__</a></b> (<i>self</i>, QGLColormap)</li><li><div class="fn" /><b><a href="qglcolormap.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qglcolormap.html#entryColor">entryColor</a></b> (<i>self</i>, int&#160;<i>idx</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#entryRgb">entryRgb</a></b> (<i>self</i>, int&#160;<i>idx</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#find">find</a></b> (<i>self</i>, int&#160;<i>color</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#findNearest">findNearest</a></b> (<i>self</i>, int&#160;<i>color</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qglcolormap.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qglcolormap.html#setEntries">setEntries</a></b> (<i>self</i>, list-of-int&#160;<i>colors</i>, int&#160;<i>base</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qglcolormap.html#setEntry">setEntry</a></b> (<i>self</i>, int&#160;<i>idx</i>, int&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qglcolormap.html#setEntry-2">setEntry</a></b> (<i>self</i>, int&#160;<i>idx</i>, QColor&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qglcolormap.html#setHandle">setHandle</a></b> (<i>self</i>, int&#160;<i>ahandle</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#size">size</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGLColormap class is used for installing custom colormaps
into a <a href="qglwidget.html">QGLWidget</a>.</p>
<p>QGLColormap provides a platform independent way of specifying
and installing indexed colormaps for a <a href="qglwidget.html">QGLWidget</a>. QGLColormap is especially useful
when using the OpenGL color-index mode.</p>
<p>Under X11 you must use an X server that supports either a
<tt>PseudoColor</tt> or <tt>DirectColor</tt> visual class. If your
X server currently only provides a <tt>GrayScale</tt>,
<tt>TrueColor</tt>, <tt>StaticColor</tt> or <tt>StaticGray</tt>
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 <tt>PseudoColor</tt>
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="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">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
 {
     <span class="type"><a href="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">QGLColormap</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">const</span> <span class="type">int</span> size <span class="operator">=</span> <span class="number">256</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> size; <span class="operator">+</span><span class="operator">+</span>i)
         colormap<span class="operator">.</span>setEntry(i<span class="operator">,</span> <a href="qtgui.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><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGLColormap" />QGLColormap.__init__ (<i>self</i>)</h3><p>Construct a <a href="qglcolormap.html">QGLColormap</a>.</p>


<h3 class="fn"><a name="QGLColormap-2" />QGLColormap.__init__ (<i>self</i>, <a href="qglcolormap.html">QGLColormap</a>)</h3><p>Construct a shallow copy of <i>map</i>.</p>


<h3 class="fn"><a name="detach" />QGLColormap.detach (<i>self</i>)</h3><h3 class="fn"><a name="entryColor" /><a href="qcolor.html">QColor</a> QGLColormap.entryColor (<i>self</i>, int&#160;<i>idx</i>)</h3><p>Returns the <a href="qcolor.html#QRgb-typedef">QRgb</a> value in
the colorcell with index <i>idx</i>.</p>


<h3 class="fn"><a name="entryRgb" />int QGLColormap.entryRgb (<i>self</i>, int&#160;<i>idx</i>)</h3><p>Returns the <a href="qcolor.html#QRgb-typedef">QRgb</a> value in
the colorcell with index <i>idx</i>.</p>


<h3 class="fn"><a name="find" />int QGLColormap.find (<i>self</i>, int&#160;<i>color</i>)</h3><p>Returns the index of the color <i>color</i>. If <i>color</i> is
not in the map, -1 is returned.</p>


<h3 class="fn"><a name="findNearest" />int QGLColormap.findNearest (<i>self</i>, int&#160;<i>color</i>)</h3><p>Returns the index of the color that is the closest match to
color <i>color</i>.</p>


<h3 class="fn"><a name="handle" />int QGLColormap.handle (<i>self</i>)</h3><h3 class="fn"><a name="isEmpty" />bool QGLColormap.isEmpty (<i>self</i>)</h3><p>Returns true if the colormap is empty or it is not in use by a
<a href="qglwidget.html">QGLWidget</a>; otherwise returns
false.</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 <a href="qglwidget.html">QGLWidget</a> 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 <a href="qglwidget.html">QGLWidget</a> or not.</p>
<p><b>See also</b> <a href="qglcolormap.html#size">size</a>().</p>


<h3 class="fn"><a name="setEntries" />QGLColormap.setEntries (<i>self</i>, list-of-int&#160;<i>colors</i>, int&#160;<i>base</i>&#160;=&#160;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>


<h3 class="fn"><a name="setEntry" />QGLColormap.setEntry (<i>self</i>, int&#160;<i>idx</i>, int&#160;<i>color</i>)</h3><p>Set cell at index <i>idx</i> in the colormap to color
<i>color</i>.</p>


<h3 class="fn"><a name="setEntry-2" />QGLColormap.setEntry (<i>self</i>, int&#160;<i>idx</i>, <a href="qcolor.html">QColor</a>&#160;<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>


<h3 class="fn"><a name="setHandle" />QGLColormap.setHandle (<i>self</i>, int&#160;<i>ahandle</i>)</h3><h3 class="fn"><a name="size" />int QGLColormap.size (<i>self</i>)</h3><p>Returns the number of colorcells in the colormap.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>