[plt-dev] update on experiment in re-implementing MrEd

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Mar 30 05:13:11 EDT 2009

On Sun, Mar 29, 2009 at 7:00 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> `dc<%>' already supports `dc-path%', which is close to the Cairo (i.e.,
> PostScript) model. There's also already a global alpha, and we'll add
> more things like rotation (or, more generally, a transformation
> matrix).
>
> Is masking different from clipping? I guess I'll find out...

Heh. I didn't know about this stuff. I even went so far as to start
implementing 2D vector graphics in OpenGL to replicate this
functionality.

> BTW, I'm writing this message in a SirMail that's running on top of
> `editor<%>' classes that are implemented in Scheme instead of C++
> (which is phase 1 of this re-implement MrEd experiment). If testing
> continues to go well, I may be able to merge to the trunk soon.

Cool.

I've implemented a bit of the dc<%> interface. Commit message
reproduced below. I have an issue writing tests. It appears that I
can't use Cairo/Cocoa from a MrEd application. This is understandable.
There also appears to be a threading issue. Does Cocoa take over the
main thread or something? cocoa.ss runs, but my almost identical
dc-test.ss (replace #lang scheme/gui with #lang scheme/base, comment
out MrEd code) doesn't draw anything. The only difference I can see is
the thread created in cocoa, so perhaps I need to duplicate that.

Commit msg:

Start implementing the dc<%> interface. Currently draw-rectangle and
draw-line are defined for Cocoa only.

common/dc.ss:
 - contains a mixin that defines the common Cairo based methods
 - defines an interface, dc-backend<%>, that the backends must implement

cocoa/dc.ss:
 - defines a Cocoa specific backend and a Cocoa dc implementation

tests/dc-test.ss
 - An attempt to define a test comparing Cocoa/Cairo rendering and
MrEd rendering. This just hangs -- I don't know why. Run as

  mred dc-test.ss {cocoa|mred}

To add new dc<%> methods:
 - Extend cairo.ss with any new cairo functions needed
 - Implement methods on common/dc.ss
 - Add test to tests/dc-test.ss (and get dc-test.ss working if you know how!)


N.


Posted on the dev mailing list.