view README.rst @ 142:b729e5ea9687

Corrections in README.
author Mikhail Kryshen <mikhail@kryshen.net>
date Sun, 21 Apr 2013 04:36:43 +0400
parents f42e2b9e1ad9
children 844921c135d6
line wrap: on
line source

=========
 Indyvon
=========

Indyvon [INteractive DYnamic VisualizatiON] is an experimental GUI
library for Clojure. Indyvon allows you to combine and immediately
draw interactive objects 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 Layer
    (render! [layer]
      "Draws the layer.")
    (geometry [layer]
      "Returns preferred size for the layer."))

Layer functions are called in the Layer 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 layer could draw using the provided
Graphics2D instance, display another layers 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 layer contexts after every repaint for the time
until the rendering of the next frame is complete.

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