• PySide 模块
  • PySide.QtOpenGL
  • 内容表

    上一话题

    QGLFormat

    下一话题

    QGLPixelBuffer

    QGLColormap

    概要

    函数

    详细描述

    PySide.QtOpenGL.QGLColormap class is used for installing custom colormaps into a PySide.QtOpenGL.QGLWidget .

    PySide.QtOpenGL.QGLColormap provides a platform independent way of specifying and installing indexed colormaps for a PySide.QtOpenGL.QGLWidget . PySide.QtOpenGL.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.

    PySide.QtOpenGL.QGLColormap.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 隐式共享 as a memory and speed optimization.

    用法范例:

    import sys
    from PySide.QtGui import QApplication, qRgb
    from PySide.QtOpenGL import QGLColormap
    def main(argv):
        app = QApplication(argv)
        widget = MySuperGLWidget()     # a QGLWidget in color-index mode
        colormap = QGLColormap()
        # This will fill the colormap with colors ranging from
        # black to white.
        for i in range(0, colormap.size()):
            colormap.setEntry(i, qRgb(i, i, i))
        widget.setColormap(colormap)
        widget.show()
        return app.exec_()
    if __name__ == "__main__":
        main(sys.argv)
    										
    class PySide.QtOpenGL. QGLColormap
    class PySide.QtOpenGL. QGLColormap ( arg__1 )
    参数: arg__1 PySide.QtOpenGL.QGLColormap

    构造 PySide.QtOpenGL.QGLColormap .

    Construct a shallow copy of map .

    PySide.QtOpenGL.QGLColormap. detach_helper ( )
    PySide.QtOpenGL.QGLColormap. entryColor ( idx )
    参数: idx PySide.QtCore.int
    返回类型: PySide.QtGui.QColor

    返回 QRgb value in the colorcell with index idx .

    PySide.QtOpenGL.QGLColormap. entryRgb ( idx )
    参数: idx PySide.QtCore.int
    返回类型: long

    返回 QRgb value in the colorcell with index idx .

    PySide.QtOpenGL.QGLColormap. find ( color )
    参数: color – long
    返回类型: PySide.QtCore.int
    PySide.QtOpenGL.QGLColormap. findNearest ( color )
    参数: color – long
    返回类型: PySide.QtCore.int
    PySide.QtOpenGL.QGLColormap. handle ( )
    返回类型: PySide.QtCore.Qt::HANDLE

    Returns the handle for this color map.

    PySide.QtOpenGL.QGLColormap. isEmpty ( )
    返回类型: PySide.QtCore.bool

    Returns true if the colormap is empty or it is not in use by a PySide.QtOpenGL.QGLWidget ;否则返回 false。

    A colormap with no color values set is considered to be empty. For historical reasons, a colormap that has color values set but which is not in use by a PySide.QtOpenGL.QGLWidget is also considered empty.

    比较 PySide.QtOpenGL.QGLColormap.size() with zero to determine if the colormap is empty regardless of whether it is in use by a PySide.QtOpenGL.QGLWidget or not.

    PySide.QtOpenGL.QGLColormap. setEntries ( count , colors [ , base=0 ] )
    参数:
    • count PySide.QtCore.int
    • colors – long
    • base PySide.QtCore.int
    PySide.QtOpenGL.QGLColormap. setEntry ( idx , color )
    参数:
    • idx PySide.QtCore.int
    • color – long
    PySide.QtOpenGL.QGLColormap. setEntry ( idx , color )
    参数:

    这是重载函数。

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

    PySide.QtOpenGL.QGLColormap. setHandle ( ahandle )
    参数: ahandle PySide.QtCore.Qt::HANDLE
    PySide.QtOpenGL.QGLColormap. size ( )
    返回类型: PySide.QtCore.int

    Returns the number of colorcells in the colormap.