[Grace-core] Grace Graphics API?

Michael Homer mwh at ecs.vuw.ac.nz
Wed May 22 23:46:13 PDT 2013


On Thu, May 23, 2013 at 6:23 PM, James Noble <kjx at ecs.vuw.ac.nz> wrote:
> Hi all
> 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
No it doesn't, it uses a canvas, which is implicitly double-buffered.
The GTK one isn't, but it could be (patches welcome!). See
sample/js/simplegraphics.grace and grace-gtk:simplegraphics.grace. The
actual API is fundamentally the same up to spelling. There are no
elements added and it does the drawing itself.
> 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?)
You can pass structured messages in and out with postMessage, which
appear as events on the receiver. They can't share mutable state. You
can have parallel processing that has input events passed into it and
that sends graphic or other instructions to a proxy on the outside,
which is basically the same as direct access.
-Michael


More information about the Grace-core mailing list