Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Wednesday, 10 June 2009

ContextFree yet another drawing tool

Just compiled the ContextFree cpp source to try it out, I just came accross it searching for shell shapes, yet another tool to create images. Syntax seems very simple, possible svg or png output.
I also remembered that Jeremy Ashkenas of ruby processing had mentioned it so I did a quick search and this what I found http://ashkenas.com/codework/context-free.html where he is attempting include the libraries to make them available via ruby-processing (essentially it is a DSL exercise, and rubys good for that).
Here is a rule file I hacked up earlier, based on some old rule file from the context free crowd (it needed a few mods to run as they've obviously modified the syntax since version 1.2 June 2005 current version is 2.2). Result is pretty impressive eh, syntax highlighting for vim is using colortype 'delek'!!!


 1 startshape GarishRainbow 
 2
 3 rule rainbow {
 4    // this draws the actual bow, as a full circle
 5    CIRCLE {}
 6    // this chops off the bottom half to make the "bow"
 7    // rotate the color and fade to white
 8    rainbow {s 0.99 hue 10 sat -0.04}
 9    SQUARE { sat -1 y -0.5 }
10 }
11
12 rule GarishRainbow {
13    rainbow {x 250 y -100 b 1 sat 1 }
14


Produces Garish Rainbow as png (or svg file)

2 comments:

  1. Context Free looks brilliant!
    thanks for the link
    b e n

    ReplyDelete
  2. Yeah simple elegant rules, produce fantastic results, however it appears as though it pays to be happy about recursion. Including the libraries into ruby-processing should make for more readable code/rules.

    ReplyDelete

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2