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