Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.opengl
Class QGLColormap

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.opengl.QGLColormap

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QGLColormap

extends QtJambiObject
implements java.lang.Cloneable

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:

        public static void main(String args[]) {
            QApplication.initialize(args);

            MyGLWidget widget = new MyGLWidget();  // a QGLWidget in color-index mode
            QGLColormap colormap = new QGLColormap();

            // This will fill the colormap with colors ranging from black to white.
            for (int i = 0; i < colormap.size(); i++)
                colormap.setEntry(i, new QColor(i, i, i).rgb());

            widget.setColormap(colormap);
            widget.show();
            QApplication.exec();
        }

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

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QGLColormap()` Construct a QGLColormap.
`QGLColormap(QGLColormap arg__1)` Construct a shallow copy of `map`.

Method Summary
`QGLColormap` | `clone()` This method is reimplemented for internal reasons
`QColor` | `entryColor(int idx)` Returns the QRgb value in the colorcell with index `idx`.
`int` | `entryRgb(int idx)` Returns the QRgb value in the colorcell with index `idx`.
`int` | `find(int color)` Returns the index of the color `color`.
`int` | `findNearest(int color)` Returns the index of the color that is the closest match to color `color`.
`boolean` | `isEmpty()` Returns true if the colormap is empty; otherwise returns false.
`void` | `setEntries(int[] colors)` Set an array of cells in this colormap.
`void` | `setEntries(int[] colors, int base)` Set an array of cells in this colormap.
`void` | `setEntry(int idx, int color)` Set cell at index `idx` in the colormap to color `color`.
`void` | `setEntry(int idx, QColor color)` Set the cell with index `idx` in the colormap to color `color`.
`int` | `size()` Returns the number of colorcells in the colormap.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QGLColormap

    public QGLColormap()

  Construct a QGLColormap.

### QGLColormap

    public QGLColormap(QGLColormap arg__1)

  Construct a shallow copy of `map`.

Method Detail

### entryColor

    public final QColor entryColor(int idx)

  Returns the QRgb value in the colorcell with index `idx`.

### entryRgb

    public final int entryRgb(int idx)

  Returns the QRgb value in the colorcell with index `idx`.

### find

    public final int find(int color)

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

### findNearest

    public final int findNearest(int color)

  Returns the index of the color that is the closest match to color `color`.

### isEmpty

    public final boolean isEmpty()

  Returns true if the colormap is empty; otherwise returns false. A colormap with no color values set is considered to be empty.

### setEntry

    public final void setEntry(int idx,
                               QColor color)

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

### setEntry

    public final void setEntry(int idx,
                               int color)

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

### size

    public final int size()

  Returns the number of colorcells in the colormap.

### setEntries

    public final void setEntries(int[] colors,
                                 int base)

  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.

### setEntries

    public final void setEntries(int[] colors)

  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.

### clone

    public QGLColormap clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD