1QGLColormap(3qt) QGLColormap(3qt)
2
3
4
6 QGLColormap - Used for installing custom colormaps into QGLWidgets
7
9 #include <qglcolormap.h>
10
11 Public Members
12 QGLColormap ()
13 QGLColormap ( const QGLColormap & map )
14 ~QGLColormap ()
15 QGLColormap & operator= ( const QGLColormap & map )
16 bool isEmpty () const
17 int size () const
18 void detach ()
19 void setEntries ( int count, const QRgb * colors, int base = 0 )
20 void setEntry ( int idx, QRgb color )
21 void setEntry ( int idx, const QColor & color )
22 QRgb entryRgb ( int idx ) const
23 QColor entryColor ( int idx ) const
24 int find ( QRgb color ) const
25 int findNearest ( QRgb color ) const
26
28 The QGLColormap class is used for installing custom colormaps into
29 QGLWidgets.
30
31 QGLColormap provides a platform independent way of specifying and
32 installing indexed colormaps into QGLWidgets. QGLColormap is especially
33 useful when using the OpenGL color-index mode.
34
35 Under X11 you must use an X server that supports either a PseudoColor
36 or DirectColor visual class. If your X server currently only provides a
37 GrayScale, TrueColor, StaticColor or StaticGray visual, you will not be
38 able to allocate colorcells for writing. If this is the case, try
39 setting your X server to 8 bit mode. It should then provide you with at
40 least a PseudoColor visual. Note that you may experience colormap
41 flashing if your X server is running in 8 bit mode.
42
43 Under Windows the size of the colormap is always set to 256 colors.
44 Note that under Windows you can also install colormaps in child
45 widgets.
46
47 This class uses explicit sharing (see Shared Classes).
48
49 Example of use:
50
51 #include <qapplication.h>
52 #include <qglcolormap.h>
53 int main()
54 {
55 QApplication a( argc, argv );
56 MySuperGLWidget widget( 0 ); // A QGLWidget in color-index mode
57 QGLColormap colormap;
58 // This will fill the colormap with colors ranging from
59 // black to white.
60 for ( int i = 0; i < colormap.size(); i++ )
61 colormap.setEntry( i, qRgb( i, i, i ) );
62 widget.setColormap( colormap );
63 widget.show();
64 return a.exec();
65 }
66
67 See also QGLWidget::setColormap(), QGLWidget::colormap(), Graphics
68 Classes, and Image Processing Classes.
69
72 Construct a QGLColormap.
73
75 Construct a shallow copy of map.
76
78 Dereferences the QGLColormap and deletes it if this was the last
79 reference to it.
80
82 Detaches this QGLColormap from the shared block.
83
85 Returns the QRgb value in the colorcell with index idx.
86
88 Returns the QRgb value in the colorcell with index idx.
89
91 Returns the index of the color color. If color is not in the map, -1 is
92 returned.
93
95 Returns the index of the color that is the closest match to color
96 color.
97
99 Returns TRUE if the colormap is empty; otherwise returns FALSE. A
100 colormap with no color values set is considered to be empty.
101
103 Assign a shallow copy of map to this QGLColormap.
104
106 Set an array of cells in this colormap. count is the number of colors
107 that should be set, colors is the array of colors, and base is the
108 starting index.
109
111 Set cell at index idx in the colormap to color color.
112
114 This is an overloaded member function, provided for convenience. It
115 behaves essentially like the above function.
116
117 Set the cell with index idx in the colormap to color color.
118
120 Returns the number of colorcells in the colormap.
121
122
124 http://doc.trolltech.com/qglcolormap.html
125 http://www.trolltech.com/faq/tech.html
126
128 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
129 license file included in the distribution for a complete license
130 statement.
131
133 Generated automatically from the source code.
134
136 If you find a bug in Qt, please report it as described in
137 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
138 help you. Thank you.
139
140 The definitive Qt documentation is provided in HTML format; it is
141 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
142 web browser. This man page is provided as a convenience for those users
143 who prefer man pages, although this format is not officially supported
144 by Trolltech.
145
146 If you find errors in this manual page, please report them to qt-
147 bugs@trolltech.com. Please include the name of the manual page
148 (qglcolormap.3qt) and the Qt version (3.3.8).
149
150
151
152Trolltech AS 2 February 2007 QGLColormap(3qt)