view README.rst @ 106:f42e2b9e1ad9

Removed Anchored protocol, "layer-size" function in Layer replaced with "geometry" which returns a structure describing both layer size and anchor point. Indyvon now requires Clojure 1.3.
author Mikhail Kryshen <mikhail@kryshen.net>
date Wed, 21 Sep 2011 02:27:11 +0300
parents b04bdeec5700
children b729e5ea9687
line source
1 =========
2 Indyvon
3 =========
5 Indyvon [INteractive DYnamic VisualizatiON] is an experimental GUI
6 library for Clojure.
8 It is based around the idea of basically stateless UI elements defined
9 by the following simple protocol::
11 (defprotocol Layer
12 (render! [layer]
13 "Draws the layer.")
14 (geometry [layer]
15 "Returns preferred size for the layer."))
17 Layer functions are called in the Layer context which is defined by
18 bindings to vars including:
20 - ``*graphics*`` — an instance of java.awt.Graphics2D used for drawing;
21 - ``*width*`` and ``*height*`` — size of the drawing bounds;
22 - ``*clip*`` — clipping area (instance of java.awt.geom.Shape).
24 In the ``render!`` function layer could draw using the provided
25 Graphics2D instance, display another layers at the specified locations
26 relative to it's own context, and register event handlers.
28 Event dispatching is done by remembering the clipping areas and affine
29 transforms of visible layer contexts after every repaint for the time
30 until the rendering of the next frame is complete.
32 It is possible to draw layers asynchronously in a separate thread by
33 wrapping them in ``async-layer`` which uses two off-screen buffers
34 (triple buffering) to avoid locking.