Here are some ideas I used in Indyvon (https://bitbucket.org/kryshen/
indyvon).

* Methods that modify graphics context (java.awt.Graphics2D instance)
are wrapped in with- macros, e.g. with-color sets the current color to
the specified value, executes body in try block, and resets the color
to the original value in the finally clause.

* Graphics context is passed between rendering functions via thread-
local bindings rather than an argument.

* To be sure that some function will not leave the graphics context in
a changed state a copy made using Graphics.create() could be passed
instead of the original.

* Rendering could be done in parallel using separate offscreen buffers
for each thread. In Indyvon rendering is mainly done on the AWT event
dispatching thread except parts of the scene wrapped in async-layer
are rendered on separate threads. On the event dispatching thread the
last finished rendering of async-layer is copied. Triple buffering is
used to avoid locking.

* Geometry objects (java.awt.geom) could be used locally as transients
and converted to persistent structures upon returning. Another
approach would be to create an object clone every time before doing
modifications.

--
Mikhail

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to