|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.opengl.QGLColormap
public class 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(); }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QGLColormap()
Construct a QGLColormap. |
|
QGLColormap(QGLColormap arg__1)
Construct a shallow copy of arg__1. |
Method Summary | |
---|---|
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. |
static QGLColormap |
fromNativePointer(QNativePointer nativePointer)
This function returns the QGLColormap instance pointed to by nativePointer |
protected long |
handle()
This method is used internally by Qt Jambi. |
boolean |
isEmpty()
Returns true if the colormap is empty; otherwise returns false. |
static QNativePointer |
nativePointerArray(QGLColormap[] array)
This function returns a QNativePointer that is pointing to the specified QGLColormap array. |
void |
setEntries(int[] colors)
This is an overloaded method provided for convenience. |
void |
setEntries(int[] colors,
int base)
Sets an array of cells in this color map, where colors is the array of colors, and base is the starting index. |
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. |
protected void |
setHandle(long ahandle)
This method is used internally by Qt Jambi. |
int |
size()
Returns the number of colorcells in the colormap. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QGLColormap()
Construct a QGLColormap.
public QGLColormap(QGLColormap arg__1)
Construct a shallow copy of arg__1.
Method Detail |
---|
public final QColor entryColor(int idx)
Returns the QRgb value in the colorcell with index idx.
public final int entryRgb(int idx)
Returns the QRgb value in the colorcell with index idx.
public final int find(int color)
Returns the index of the color color. If color is not in the map, -1 is returned.
public final int findNearest(int color)
Returns the index of the color that is the closest match to color color.
protected final long handle()
This method is used internally by Qt Jambi. Do not use it in your applications.
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.
public final void setEntry(int idx, QColor color)
Set the cell with index idx in the colormap to color color.
public final void setEntry(int idx, int color)
Set cell at index idx in the colormap to color color.
protected final void setHandle(long ahandle)
This method is used internally by Qt Jambi. Do not use it in your applications.
public final int size()
Returns the number of colorcells in the colormap.
public static QGLColormap fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QGLColormap[] array)
array
- the array that the returned pointer will point to.
public final void setEntries(int[] colors, int base)
public final void setEntries(int[] colors)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |