1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
<?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">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <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)</li><li><div class="fn" />int <b><a href="qglcolormap.html#entryRgb">entryRgb</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qglcolormap.html#find">find</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qglcolormap.html#findNearest">findNearest</a></b> (<i>self</i>, int)</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 <i>colors</i>, int <i>base</i> = 0)</li><li><div class="fn" /><b><a href="qglcolormap.html#setEntry">setEntry</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qglcolormap.html#setEntry-2">setEntry</a></b> (<i>self</i>, int, QColor)</li><li><div class="fn" /><b><a href="qglcolormap.html#setHandle">setHandle</a></b> (<i>self</i>, int)</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> #include <QApplication>
#include <QGLColormap>
int main()
{
QApplication app(argc, argv);
MySuperGLWidget widget; <span class="comment">// a QGLWidget in color-index mode</span>
QGLColormap colormap;
<span class="comment">// This will fill the colormap with colors ranging from</span>
<span class="comment">// black to white.</span>
for (int i = 0; i < colormap.size(); i++)
colormap.setEntry(i, qRgb(i, i, i));
widget.setColormap(colormap);
widget.show();
return app.exec();
}</pre>
<p>See also <a href="qglwidget.html#setColormap">QGLWidget.setColormap</a>() and <a href="qglwidget.html#colormap">QGLWidget.colormap</a>().</p>
<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>
<a name="//apple_ref/cpp/instm/QGLColormap/~QGLColormap" />
<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)</h3><p>Returns the <a href="qcolor.html#QRgb-typedef">QRgb</a> value in the colorcell with index <i>idx</i>.</p>
<a name="//apple_ref/cpp/instm/QGLColormap/entryRgb" />
<h3 class="fn"><a name="entryRgb" />int QGLColormap.entryRgb (<i>self</i>, int)</h3><p>Returns the <a href="qcolor.html#QRgb-typedef">QRgb</a> value in the colorcell with index <i>idx</i>.</p>
<a name="//apple_ref/cpp/instm/QGLColormap/find" />
<h3 class="fn"><a name="find" />int QGLColormap.find (<i>self</i>, int)</h3><p>Returns the index of the color <i>color</i>. If <i>color</i> is not in the map, -1 is returned.</p>
<a name="//apple_ref/cpp/instm/QGLColormap/findNearest" />
<h3 class="fn"><a name="findNearest" />int QGLColormap.findNearest (<i>self</i>, int)</h3><p>Returns the index of the color that is the closest match to color <i>color</i>.</p>
<a name="//apple_ref/cpp/instm/QGLColormap/isEmpty" />
<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>See also <a href="qglcolormap.html#size">size</a>().</p>
<a name="//apple_ref/cpp/instm/QGLColormap/setEntries" />
<h3 class="fn"><a name="setEntries" />QGLColormap.setEntries (<i>self</i>, list-of-int <i>colors</i>, int <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>
<a name="//apple_ref/cpp/instm/QGLColormap/setEntry" />
<h3 class="fn"><a name="setEntry" />QGLColormap.setEntry (<i>self</i>, int, int)</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, <a href="qcolor.html">QColor</a>)</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>
<a name="//apple_ref/cpp/instm/QGLColormap/size" />
<h3 class="fn"><a name="setHandle" />QGLColormap.setHandle (<i>self</i>, int)</h3><h3 class="fn"><a name="size" />int QGLColormap.size (<i>self</i>)</h3><p>Returns the number of colorcells in the colormap.</p>
<a name="//apple_ref/cpp/instm/QGLColormap/operator=" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|