fsleyes.gl.colourbarcanvas

This module provides the ColourBarCanvas.

The ColourBarCanvas uses a ColourBar draw a colour bar (with labels), and then renders said colour bar as a texture using OpenGL.

See the colourbar and fsleyes_widgets.utils.colourbarbitmap modules for details on how the colour bar is created.

class fsleyes.gl.colourbarcanvas.ColourBarCanvas(overlayList, displayCtx)[source]

Bases: __main__.docbuilder.run.<locals>.MockClass

Contains logic to render a colour bar as an OpenGL texture.

highDpi = <MagicMock name='mock.Boolean()' id='140735756653168'>

Scale colour bar canvas for high-resolution screens.

barSize = <MagicMock name='mock.Percentage()' id='140735756052720'>

Size of the colour bar along its major axis, as a proportion of the available space.

__init__(overlayList, displayCtx)[source]

Adds a few listeners to the properties of this object, to update the colour bar when they change.

property colourBar

Returns a reference to the ColourBar object that actually generates the colour bar bitmap.

updateColourBarTexture(*a)[source]

Called whenever the colour bar texture needs to be updated.

_initGL()[source]

Called automatically by the OpenGL canvas target superclass (see the WXGLCanvasTarget and OSMesaCanvasTarget for details).

Generates the colour bar texture.

__highDpiChanged(*a)

Called when the highDpi property changes. Calls the GLCanvasTarget.EnableHighDPI() method.

destroy()[source]

Should be called when this ColourBarCanvas is no longer needed. Destroys the Texture2D and ColourBar instances used to render the colour bar.

__genColourBarTexture()

Retrieves a colour bar bitmap from the ColourBar, and copies it to a Texture2D.

__annotations__ = {}
__module__ = 'fsleyes.gl.colourbarcanvas'
_draw()[source]

Renders the colour bar texture using all available canvas space.