QGLColormap(3qt)

NAME
QGLColormap - Used for installing custom colormaps into QGLWidgets

SYNOPSIS
#include <ntqglcolormap.h>

  Public Members
QGLColormap ()
QGLColormap ( const QGLColormap & map )
~QGLColormap ()
QGLColormap & operator= ( const QGLColormap & map )
bool isEmpty () const
int size () const
void detach ()
void setEntries ( int count, const TQRgb * colors, int base = 0 )
void setEntry ( int idx, TQRgb color )
void setEntry ( int idx, const TQColor & color )
TQRgb entryRgb ( int idx ) const
TQColor entryColor ( int idx ) const
int find ( TQRgb color ) const
int findNearest ( TQRgb color ) const

DESCRIPTION
The QGLColormap class is used for installing custom colormaps into QGLWidgets.

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.

Under X11 you must use an X server that supports either a PseudoColor or DirectColor visual class. If your X server currently only provides a GrayScale, TrueColor, StaticColor or StaticGray 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 PseudoColor visual. Note that you may experience colormap flashing if your X server is running in 8 bit mode.

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.

This class uses explicit sharing (see Shared Classes).

Example of use:

    #include <ntqapplication.h>
    #include <ntqglcolormap.h>
    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 < colormap.size(); i++ )
            colormap.setEntry( i, tqRgb( i, i, i ) );
        widget.setColormap( colormap );
        widget.show();
        return a.exec();
    }

See also QGLWidget::setColormap(), QGLWidget::colormap(), Graphics Classes, and Image Processing Classes.

MEMBER FUNCTION DOCUMENTATION

QGLColormap::QGLColormap ()
Construct a QGLColormap.

QGLColormap::QGLColormap ( const QGLColormap & map )
Construct a shallow copy of map.

QGLColormap::~QGLColormap ()
Dereferences the QGLColormap and deletes it if this was the last reference to it.

void QGLColormap::detach ()
Detaches this QGLColormap from the shared block.

TQColor QGLColormap::entryColor ( int idx ) const
Returns the TQRgb value in the colorcell with index idx.

TQRgb QGLColormap::entryRgb ( int idx ) const
Returns the TQRgb value in the colorcell with index idx.

int QGLColormap::find ( TQRgb color ) const
Returns the index of the color color. If color is not in the map, -1 is returned.

int QGLColormap::findNearest ( TQRgb color ) const
Returns the index of the color that is the closest match to color color.

bool QGLColormap::isEmpty () const
Returns true if the colormap is empty; otherwise returns false. A colormap with no color values set is considered to be empty.

QGLColormap & QGLColormap::operator= ( const QGLColormap & map )
Assign a shallow copy of map to this QGLColormap.

void QGLColormap::setEntries ( int count, const TQRgb * colors, int base = 0 )
Set an array of cells in this colormap. count is the number of colors that should be set, colors is the array of colors, and base is the starting index.

void QGLColormap::setEntry ( int idx, TQRgb color )
Set cell at index idx in the colormap to color color.

void QGLColormap::setEntry ( int idx, const TQColor & color )
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Set the cell with index idx in the colormap to color color.

int QGLColormap::size () const
Returns the number of colorcells in the colormap.

SEE ALSO
http://doc.trolltech.com/ntqglcolormap.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqglcolormap.3qt) and the Qt version (3.3.8).