kiva.line_state module

LineState Class

The LineState class is used by the GraphicsState for Kiva backends which need to have their state tracked by Python, rather than by an internal graphics state (eg. Wx, SVG and PDF backends, but not Agg or QPainter).

class kiva.line_state.LineState(color, width, cap, join, dash)[source]

Bases: object

Stores information about the current line drawing settings.

This is split off from GraphicsState to make it easier to track line state changes. All the methods for setting these variables are left in the GraphicsStateBase class.

copy()[source]

Makes a copy of the current line state

is_dashed()[source]
kiva.line_state.exactly_equal(arr1, arr2)[source]
kiva.line_state.is_dashed(dash)[source]
kiva.line_state.line_state_equal(line1, line2)[source]

Compares two LineState objects to see if they are equivalent.

This is generally called by device-specific drawing routines before they stroke a path. It determines whether previously set line settings are equivalent to desired line settings for this drawing command. If true, the routine can bypass all the work needed to set all the line settings of the graphics device.

With the current Python implementation, this may not provide any time savings over just setting all the graphics state values. However, in C this could be a very fast memcmp if the C structure is set up correctly.

While this could be the __cmp__ method for LineState, I have left it as a function because I think it will move to C and be used to compare structures.