indyvon
 

Indyvon

Indyvon [INteractive DYnamic VisualizatiON] is an experimental GUI library for Clojure. Indyvon allows you to build and draw interactive objects in immediate mode without maintaining a scene graph or a

Changes (full changelog)

(Mikhail Kryshen)
2016-02-12: Converted README to Markdown (for hgsite). tip

Converted README to Markdown (for hgsite).

(Mikhail Kryshen)
2015-12-01: Workaround to allow empty text lines in labels.

Workaround to allow empty text lines in labels.

(Mikhail Kryshen)
2015-11-18: Fixed a misplaced docstring.

Fixed a misplaced docstring.

(Mikhail Kryshen)
2015-10-22: Adjusted viewport scaling.

Adjusted viewport scaling.

Readme

Indyvon

Indyvon [INteractive DYnamic VisualizatiON] is an experimental GUI library for Clojure. Indyvon allows you to build and draw interactive objects in immediate mode without maintaining a scene graph or a hierarchy of widgets.

It is based around the idea of basically stateless UI elements defined by the following simple protocol:

(defprotocol View
  (render! [view]
    "Draws the view.")
  (geometry [view]
    "Returns preferred size for the view."))

View functions are called in the View context which is defined by bindings to vars including:

  • *graphics* — an instance of java.awt.Graphics2D used for drawing;
  • *width* and *height* — size of the drawing bounds;
  • *clip* — clipping area (instance of java.awt.geom.Shape).

In the render! function View could draw using the provided Graphics2D instance, display another Views at the specified locations relative to it's own context, and register event handlers.

Event dispatching is done by remembering the clipping areas and affine transforms of visible View contexts after every repaint for the time until the rendering of the next frame is complete.

It is possible to draw Views asynchronously in parallel threads by wrapping them in async-view, which uses two off-screen buffers (triple buffering) to avoid locking.