15. decors — 2D decorations for the OpenGL canvas.

2D decorations for the OpenGL canvas.

class decors.Decoration(x, y)

A decoration is a 2-D drawing at canvas position x,y.

All decoration have at least the following attributes:

x,y : (int) window coordinates of the insertion point drawGL() : function that draws the decoration at (x,y).

This should only use openGL function that are allowed in a display list.

Create a decoration at canvas coordinates x,y

Decoration objects have the following methods:

class decors.GlutText(text, x, y, font='9x15', size=None, gravity=None, adjust=None, color=None, zoom=None)

A viewport decoration showing a text.

Create a text actor

GlutText objects have the following methods:

drawGL(mode='wireframe', color=None)
Draw the text.
class decors.ColorLegend(colorlegend, x, y, w, h, font=None, size=None, dec=2, scale=0, grid=0, linewidth=None, lefttext=False)

A viewport decoration showing a colorscale legend.

ColorLegend objects have the following methods:

drawGL(mode='wireframe', color=None)
use_list()
class decors.Rectangle(x1, y1, x2, y2, color=None)

A 2D-rectangle on the canvas.

Rectangle objects have the following methods:

drawGL(mode='wireframe', color=None)
class decors.Grid(x1, y1, x2, y2, nx=1, ny=1, color=None, linewidth=None)

A 2D-grid on the canvas.

Grid objects have the following methods:

drawGL(mode='wireframe', color=None)
class decors.Line(x1, y1, x2, y2, color=None, linewidth=None)

A straight line on the canvas.

Line objects have the following methods:

drawGL(mode='wireframe', color=None)
class decors.LineDrawing(data, color=None, linewidth=None)

A collection of straight lines on the canvas.

Initially a Line Drawing.

data can be a 2-plex Formex or equivalent coordinate data. The z-coordinates of the Formex are unused. A (n,2,2) shaped array will do as well.

LineDrawing objects have the following methods:

drawGL(mode=None, color=None)

Functions defined in the module decors

decors.drawDot(x, y)
Draw a dot at canvas coordinates (x,y).
decors.drawLine(x1, y1, x2, y2)
Draw a straight line from (x1,y1) to (x2,y2) in canvas coordinates.
decors.drawGrid(x1, y1, x2, y2, nx, ny)

Draw a rectangular grid of lines

The rectangle has (x1,y1) and and (x2,y2) as opposite corners. There are (nx,ny) subdivisions along the (x,y)-axis. So the grid has (nx+1) * (ny+1) lines. nx=ny=1 draws a rectangle. nx=0 draws 1 vertical line (at x1). nx=-1 draws no vertical lines. ny=0 draws 1 horizontal line (at y1). ny=-1 draws no horizontal lines.

decors.drawRect(x1, y1, x2, y2)
decors.drawRectangle(x1, y1, x2, y2, color)

Documentation

Previous topic

14. actors — OpenGL actors for populating the 3D scene.

Next topic

16. marks — OpenGL marks for annotating 3D actors.

This Page