Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QGLColormap Class Reference
[QtOpenGL module]

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

 #include <QGLColormap>

Public Functions


Detailed 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 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().


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.

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 )

This is an overloaded member function, provided for convenience.

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.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web