[Grace-core] Grace Graphics API?

James Noble kjx at ecs.vuw.ac.nz
Wed May 22 23:23:03 PDT 2013


Hi all

so I've been thinking a little about what graphics libraries we should be using for Grace.

(perhaps under a delusion we can soon close on say an 0.5 language spec,
and then move to worrying about libraries, particularly collections & graphics)


this is prompted because  thanks to MIchael - there is now a "simplegraphics" module
which works under both GTK/C and DOM/JS, It's quite basic but can presumably be expanded.
and because Kim wants to start doing more graphics stuff

The catch is that GTK vs JS seem to have quite different "models" of doing things,
and then that these models are different to the model underlying Kim's ObjectDraw.
GTK requires programs to respond to "draw" events, while in Javascript you just
add elements to the "DOM" which does the actual layout and drawing.
simplegraphics (as far as I can tell)  adopts a DOM-style "retained" graphics
model and emulates this under GTK. 

the next catch is that this is output only - it doesn't have any input handling.
ideally it would be - nice to have something common to both-
clearly we can handle input by talking directly to GTK or the JS DOM individually.
or we should pick one of the platforms as the primary one for development.

Then there is the treading model, JavaScript is unlikely to have Java-style
threads any time soon - unless I'm mistaken (Michael? Tim?) it's mostly
a single thread with callbacks model, with "webworker" threads that
can't handle graphics (or even share state directly?)   I think it should be possible
to make a GTK library that works with the same threading model as the DOM
(this seems to be partly what simplegraphics does)  but I don't know what
consequences that has for objectdraw.

James




More information about the Grace-core mailing list