summaryrefslogtreecommitdiffstats
path: root/doc/html/tqglcolormap.html
blob: 7a83376dd956f7ab345f976e6aa5d22bb024c760 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/opengl/tqglcolormap.cpp:38 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQGLColormap Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQGLColormap Class Reference<br><small>[<a href="opengl.html">OpenGL module</a>]</small></h1>

<p>The TQGLColormap class is used for installing custom colormaps into
TQGLWidgets.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqglcolormap-h.html">tqglcolormap.h</a>&gt;</tt>
<p><a href="tqglcolormap-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQGLColormap"><b>TQGLColormap</b></a> ()</li>
<li class=fn><a href="#TQGLColormap-2"><b>TQGLColormap</b></a> ( const&nbsp;TQGLColormap&nbsp;&amp;&nbsp;map )</li>
<li class=fn><a href="#~TQGLColormap"><b>~TQGLColormap</b></a> ()</li>
<li class=fn>TQGLColormap &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQGLColormap&nbsp;&amp;&nbsp;map )</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>int <a href="#size"><b>size</b></a> () const</li>
<li class=fn>void <a href="#detach"><b>detach</b></a> ()</li>
<li class=fn>void <a href="#setEntries"><b>setEntries</b></a> ( int&nbsp;count, const&nbsp;TQRgb&nbsp;*&nbsp;colors, int&nbsp;base = 0 )</li>
<li class=fn>void <a href="#setEntry"><b>setEntry</b></a> ( int&nbsp;idx, TQRgb&nbsp;color )</li>
<li class=fn>void <a href="#setEntry-2"><b>setEntry</b></a> ( int&nbsp;idx, const&nbsp;TQColor&nbsp;&amp;&nbsp;color )</li>
<li class=fn>TQRgb <a href="#entryRgb"><b>entryRgb</b></a> ( int&nbsp;idx ) const</li>
<li class=fn>TQColor <a href="#entryColor"><b>entryColor</b></a> ( int&nbsp;idx ) const</li>
<li class=fn>int <a href="#find"><b>find</b></a> ( TQRgb&nbsp;color ) const</li>
<li class=fn>int <a href="#findNearest"><b>findNearest</b></a> ( TQRgb&nbsp;color ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQGLColormap class is used for installing custom colormaps into
TQGLWidgets.

<p> 


<p> TQGLColormap provides a platform independent way of specifying and
installing indexed colormaps into TQGLWidgets. TQGLColormap is
especially useful when using the <a href="opengl.html">OpenGL</a>
color-index mode.
<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> 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> This class uses <a href="shclass.html#explicit-sharing">explicit sharing</a> (see <a href="shclass.html">Shared
    Classes</a>).
<p> Example of use:
<pre>
    #include &lt;<a href="qapplication-h.html">ntqapplication.h</a>&gt;
    #include &lt;<a href="tqglcolormap-h.html">tqglcolormap.h</a>&gt;

    int main()
    {
        <a href="ntqapplication.html">TQApplication</a> a( argc, argv );

        MySuperGLWidget widget( 0 ); // A TQGLWidget in color-index mode
        TQGLColormap colormap;

        // This will fill the colormap with colors ranging from
        // black to white.
        for ( int i = 0; i &lt; colormap.<a href="#size">size</a>(); i++ )
            colormap.<a href="#setEntry">setEntry</a>( i, tqRgb( i, i, i ) );

        widget.setColormap( colormap );
        widget.show();
        return a.<a href="ntqapplication.html#exec">exec</a>();
    }
    </pre>
 
<p> <p>See also <a href="tqglwidget.html#setColormap">TQGLWidget::setColormap</a>(), <a href="tqglwidget.html#colormap">TQGLWidget::colormap</a>(), <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQGLColormap"></a>TQGLColormap::TQGLColormap ()
</h3>
Construct a TQGLColormap.

<h3 class=fn><a name="TQGLColormap-2"></a>TQGLColormap::TQGLColormap ( const&nbsp;<a href="tqglcolormap.html">TQGLColormap</a>&nbsp;&amp;&nbsp;map )
</h3>
Construct a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>map</em>.

<h3 class=fn><a name="~TQGLColormap"></a>TQGLColormap::~TQGLColormap ()
</h3>
Dereferences the TQGLColormap and deletes it if this was the last
reference to it.

<h3 class=fn>void <a name="detach"></a>TQGLColormap::detach ()
</h3>
Detaches this TQGLColormap from the shared block.

<h3 class=fn><a href="tqcolor.html">TQColor</a> <a name="entryColor"></a>TQGLColormap::entryColor ( int&nbsp;idx ) const
</h3>
Returns the TQRgb value in the colorcell with index <em>idx</em>.

<h3 class=fn>TQRgb <a name="entryRgb"></a>TQGLColormap::entryRgb ( int&nbsp;idx ) const
</h3>
Returns the TQRgb value in the colorcell with index <em>idx</em>.

<h3 class=fn>int <a name="find"></a>TQGLColormap::find ( TQRgb&nbsp;color ) const
</h3>
Returns the index of the color <em>color</em>. If <em>color</em> is not in the
map, -1 is returned.

<h3 class=fn>int <a name="findNearest"></a>TQGLColormap::findNearest ( TQRgb&nbsp;color ) const
</h3>
Returns the index of the color that is the closest match to color
<em>color</em>.

<h3 class=fn>bool <a name="isEmpty"></a>TQGLColormap::isEmpty () const
</h3>
Returns TRUE if the colormap is empty; otherwise returns FALSE. A
colormap with no color values set is considered to be empty.

<h3 class=fn><a href="tqglcolormap.html">TQGLColormap</a>&nbsp;&amp; <a name="operator-eq"></a>TQGLColormap::operator= ( const&nbsp;<a href="tqglcolormap.html">TQGLColormap</a>&nbsp;&amp;&nbsp;map )
</h3>
Assign a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>map</em> to this TQGLColormap.

<h3 class=fn>void <a name="setEntries"></a>TQGLColormap::setEntries ( int&nbsp;count, const&nbsp;TQRgb&nbsp;*&nbsp;colors, int&nbsp;base = 0 )
</h3>
Set an array of cells in this colormap. <em>count</em> is the number of
colors that should be set, <em>colors</em> is the array of colors, and
<em>base</em> is the starting index.

<h3 class=fn>void <a name="setEntry"></a>TQGLColormap::setEntry ( int&nbsp;idx, TQRgb&nbsp;color )
</h3>
Set cell at index <em>idx</em> in the colormap to color <em>color</em>.

<h3 class=fn>void <a name="setEntry-2"></a>TQGLColormap::setEntry ( int&nbsp;idx, const&nbsp;<a href="tqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;color )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Set the cell with index <em>idx</em> in the colormap to color <em>color</em>.

<h3 class=fn>int <a name="size"></a>TQGLColormap::size () const
</h3>
Returns the number of colorcells in the colormap.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>