I'm keen to see graphics frameworks on clojure move away from imperative
api call wrappers and towards a more declarative approach, where you define
as data what you want to draw. I have done this for a number of personal
projects, using a hiccup like syntax to define my drawing operations, and
then have a thin rendering layer which takes the generated data and draws
it each frame/refresh etc. Longer term you could do far more clever things
with this approach like only redrawing what you need to, rendering sub
elements together and then compositing the final image etc. plus it would
be easy to implement this cross platform - it's just data.

For example:
[[:line {:colour :black :thickness 5} 0 0 20 20]
 [:circle {:colour :red :fill true} 200 200 20]
 [:text ....]]

and so on. Defining basic drawing operations like this would be easily
extensible, attributes could be added, and rendering engines which don't
support all the features (say if you added a drop shadow attribute) could
degrade fairly gracefully. You can also save this nicely. Think of it like
a lispy SVG format, where you can manipulate graphics using higher order
functions.

You could also apply transforms using nesting and define things like (defn
box [attrs x1 y1 x2 y2] [[:line attrs x1 y1 x2 y1] [:line attrs x2 y1 x2
y2] ...]) which could be quite nice, giving you something like:

[:transform {:rotation 30} (box {:line-thickness 5} 0 0 50 30)]

Obviously all of this would need to be ironed out and the exact semantics
smoothed over, but what do people think in principle to a more declarative
graphics library which could then be optimised far more than manual api
calls ever could while encouraging a clean functional, testable approach.

Adam


Adam


On Thu, Mar 13, 2014 at 10:37 PM, Omer Shapira <halus...@gmail.com> wrote:

> Hey,
>
> I'm applying to GSoC this year, and I'm looking for mentors.
>
> I want to create a cljs-idiomatic web graphics package. I have graphics
> programming experience, being a member of the Processing and openFrameworks
> communities, and a researcher at Ken Perlin's lab at NYU.
>
> While I'm still learning Clojure's abstractions, I have been programming
> in Scheme for a long time.
>
> Anyone who wants to mentor me / chat about some ideas can reply here or
> find me at http://omershapira.com
>
> Thanks!
> Omer
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to