Qt:Документация 4.3.2/qglcolormap

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QGLColormap Class Reference
[модуль QtOpenGL ]

The QGLColormap class is used for installing custom colormaps into QGLWidgets. Далее...

 #include <QGLColormap>

[править] Открытые функции


[править] Подробное описание

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 implicit sharing as a memory and speed optimization.

Example of use:

 #include <QApplication>
 #include <QGLColormap>
 
 int main()
 {
     QApplication app(argc, argv);
 
     MySuperGLWidget widget;     // 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, qRgb(i, i, i));
 
     widget.setColormap(colormap);
     widget.show();
     return app.exec();
 }

See also QGLWidget::setColormap() and QGLWidget::colormap().


[править] Описание функций-членов

[править]
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.

[править]
QColor QGLColormap::entryColor ( int idx ) const

Returns the QRgb value in the colorcell with index idx.

[править]
QRgb QGLColormap::entryRgb ( int idx ) const

Returns the QRgb value in the colorcell with index idx.

[править]
int QGLColormap::find ( QRgb color ) const

Returns the index of the color color. If color is not in the map, -1 is returned.

[править]
int QGLColormap::findNearest ( QRgb 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.

[править]
void QGLColormap::setEntries ( int count, const QRgb * 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, QRgb color )

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

[править]
void QGLColormap::setEntry ( int idx, const QColor & color )

Эта перегруженная функция предоставлена для удобства.

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

[править]
int QGLColormap::size () const

Returns the number of colorcells in the colormap.

[править]
QGLColormap & QGLColormap::operator= ( const QGLColormap & map )

Assign a shallow copy of map to this QGLColormap.



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2