1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/opengl/qglcolormap.cpp -->
7
<title>Qt 4.0: QGLColormap Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QGLColormap Class Reference</h1>
21
<p>The QGLColormap class is used for installing custom colormaps into QGLWidgets. <a href="#details">More...</a></p>
22
<pre>#include <QGLColormap></pre><p>Part of the <a href="qtopengl.html">QtOpenGL</a> module.</p>
24
<li><a href="qglcolormap-members.html">List of all members, including inherited members</a></li>
26
<a name="public-functions"></a>
27
<h3>Public Functions</h3>
29
<li><div class="fn"/><b><a href="qglcolormap.html#QGLColormap">QGLColormap</a></b> ()</li>
30
<li><div class="fn"/><b><a href="qglcolormap.html#QGLColormap-2">QGLColormap</a></b> ( const QGLColormap & <i>map</i> )</li>
31
<li><div class="fn"/><b><a href="qglcolormap.html#dtor.QGLColormap">~QGLColormap</a></b> ()</li>
32
<li><div class="fn"/>void <b><a href="qglcolormap.html#detach">detach</a></b> ()</li>
33
<li><div class="fn"/>QColor <b><a href="qglcolormap.html#entryColor">entryColor</a></b> ( int <i>idx</i> ) const</li>
34
<li><div class="fn"/>QRgb <b><a href="qglcolormap.html#entryRgb">entryRgb</a></b> ( int <i>idx</i> ) const</li>
35
<li><div class="fn"/>int <b><a href="qglcolormap.html#find">find</a></b> ( QRgb <i>color</i> ) const</li>
36
<li><div class="fn"/>int <b><a href="qglcolormap.html#findNearest">findNearest</a></b> ( QRgb <i>color</i> ) const</li>
37
<li><div class="fn"/>bool <b><a href="qglcolormap.html#isEmpty">isEmpty</a></b> () const</li>
38
<li><div class="fn"/>void <b><a href="qglcolormap.html#setEntries">setEntries</a></b> ( int <i>count</i>, const QRgb * <i>colors</i>, int <i>base</i> = 0 )</li>
39
<li><div class="fn"/>void <b><a href="qglcolormap.html#setEntry">setEntry</a></b> ( int <i>idx</i>, QRgb <i>color</i> )</li>
40
<li><div class="fn"/>void <b><a href="qglcolormap.html#setEntry-2">setEntry</a></b> ( int <i>idx</i>, const QColor & <i>color</i> )</li>
41
<li><div class="fn"/>int <b><a href="qglcolormap.html#size">size</a></b> () const</li>
42
<li><div class="fn"/>QGLColormap & <b><a href="qglcolormap.html#operator-eq">operator=</a></b> ( const QGLColormap & <i>map</i> )</li>
44
<a name="details"></a>
46
<h2>Detailed Description</h2>
47
<p>The QGLColormap class is used for installing custom colormaps into QGLWidgets.</p>
48
<p>QGLColormap provides a platform independent way of specifying and installing indexed colormaps into QGLWidgets. QGLColormap is especially useful when using the <a href="opengl.html">OpenGL</a> color-index mode.</p>
49
<p>Under <a href="winsystem.html#x11">X11</a> 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>
50
<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>
51
<p>This class uses explicit sharing (see <a href="shclass.html">Shared Classes</a>).</p>
52
<p>Example of use:</p>
53
<pre> #include <qapplication.h>
54
#include <qglcolormap.h>
58
QApplication a(argc, argv);
60
MySuperGLWidget widget(0); // A QGLWidget in color-index mode
63
// This will fill the colormap with colors ranging from
65
for (int i = 0; i < colormap.size(); i++)
66
colormap.setEntry(i, qRgb(i, i, i));
68
widget.setColormap(colormap);
72
<p>See also <a href="qglwidget.html#setColormap">QGLWidget::setColormap</a>() and <a href="qglwidget.html#colormap">QGLWidget::colormap</a>().</p>
74
<h2>Member Function Documentation</h2>
75
<h3 class="fn"><a name="QGLColormap"></a>QGLColormap::QGLColormap ()</h3>
76
<p>Construct a <a href="qglcolormap.html">QGLColormap</a>.</p>
77
<h3 class="fn"><a name="QGLColormap-2"></a>QGLColormap::QGLColormap ( const QGLColormap & <i>map</i> )</h3>
78
<p>Construct a shallow copy of <i>map</i>.</p>
79
<h3 class="fn"><a name="dtor.QGLColormap"></a>QGLColormap::~QGLColormap ()</h3>
80
<p>Dereferences the <a href="qglcolormap.html">QGLColormap</a> and deletes it if this was the last reference to it.</p>
81
<h3 class="fn"><a name="detach"></a>void QGLColormap::detach ()</h3>
82
<p>Detaches this <a href="qglcolormap.html">QGLColormap</a> from the shared block.</p>
83
<h3 class="fn"><a name="entryColor"></a><a href="qcolor.html">QColor</a> QGLColormap::entryColor ( int <i>idx</i> ) const</h3>
84
<p>Returns the QRgb value in the colorcell with index <i>idx</i>.</p>
85
<h3 class="fn"><a name="entryRgb"></a>QRgb QGLColormap::entryRgb ( int <i>idx</i> ) const</h3>
86
<p>Returns the QRgb value in the colorcell with index <i>idx</i>.</p>
87
<h3 class="fn"><a name="find"></a>int QGLColormap::find ( QRgb <i>color</i> ) const</h3>
88
<p>Returns the index of the color <i>color</i>. If <i>color</i> is not in the map, -1 is returned.</p>
89
<h3 class="fn"><a name="findNearest"></a>int QGLColormap::findNearest ( QRgb <i>color</i> ) const</h3>
90
<p>Returns the index of the color that is the closest match to color <i>color</i>.</p>
91
<h3 class="fn"><a name="isEmpty"></a>bool QGLColormap::isEmpty () const</h3>
92
<p>Returns true if the colormap is empty; otherwise returns false. A colormap with no color values set is considered to be empty.</p>
93
<h3 class="fn"><a name="setEntries"></a>void QGLColormap::setEntries ( int <i>count</i>, const QRgb * <i>colors</i>, int <i>base</i> = 0 )</h3>
94
<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>
95
<h3 class="fn"><a name="setEntry"></a>void QGLColormap::setEntry ( int <i>idx</i>, QRgb <i>color</i> )</h3>
96
<p>Set cell at index <i>idx</i> in the colormap to color <i>color</i>.</p>
97
<h3 class="fn"><a name="setEntry-2"></a>void QGLColormap::setEntry ( int <i>idx</i>, const <a href="qcolor.html">QColor</a> & <i>color</i> )</h3>
98
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
99
<p>Set the cell with index <i>idx</i> in the colormap to color <i>color</i>.</p>
100
<h3 class="fn"><a name="size"></a>int QGLColormap::size () const</h3>
101
<p>Returns the number of colorcells in the colormap.</p>
102
<h3 class="fn"><a name="operator-eq"></a>QGLColormap & QGLColormap::operator= ( const QGLColormap & <i>map</i> )</h3>
103
<p>Assign a shallow copy of <i>map</i> to this <a href="qglcolormap.html">QGLColormap</a>.</p>
104
<p /><address><hr /><div align="center">
105
<table width="100%" cellspacing="0" border="0"><tr class="address">
106
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
107
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
108
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
109
</tr></table></div></address></body>