File: qglcolormap.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (50 lines) | stat: -rw-r--r-- 7,866 bytes parent folder | download
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
<?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="../pyqt4ref.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 QGLWidgets. <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" />unsigned long <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>, unsigned long&#160;<i>color</i>)</li><li><div class="fn" />int <b><a href="qglcolormap.html#findNearest">findNearest</a></b> (<i>self</i>, unsigned long&#160;<i>color</i>)</li><li><div class="fn" />unsigned long <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&#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>, unsigned long&#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>, unsigned long&#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 QGLWidgets.</p>
<p>QGLColormap provides a platform independent way of specifying and installing indexed colormaps into QGLWidgets. 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>Under Windows the size 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 explicit sharing (see <a href="shclass.html">Shared Classes</a>).</p>
<p>Example of use:</p>
<pre>
    #include &lt;qapplication.h&gt;
    #include &lt;qglcolormap.h&gt;

    int main()
    {
        QApplication a(argc, argv);

        MySuperGLWidget widget(0); // A QGLWidget in color-index mode
        QGLColormap colormap;

        // This will fill the colormap with colors ranging from
        // black to white.
        for (int i = 0; i &lt; colormap.size(); i++)
            colormap.setEntry(i, qRgb(i, i, i));

        widget.setColormap(colormap);
        widget.show();
        return a.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>
<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" />unsigned long 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>, unsigned long&#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>, unsigned long&#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" />unsigned long 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; otherwise returns false. A colormap with no color values set is considered to be empty.</p>
<h3 class="fn"><a name="setEntries" />QGLColormap.setEntries (<i>self</i>, list&#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.</p>
<h3 class="fn"><a name="setEntry" />QGLColormap.setEntry (<i>self</i>, int&#160;<i>idx</i>, unsigned long&#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 member function, provided for convenience.</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>, unsigned long&#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 width="25%">PyQt&#160;4.0.1 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.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>