Programming Windows D Examples are now Online!

Johannes Pfau spam at example.com
Fri Jul 8 07:40:21 PDT 2011


Andrej Mitrovic wrote:
>Behold this glorious GUI with a rounded rectangle:
>http://i.imgur.com/Yszgd.png
>
>Okay, so that's actually Cairo with the win32 back-end. Surprisingly,
>using the two together is quite simple. I had to convert the cairo
>headers, do a little tweaks to help HTOD out, used implib with /s on
>the DLL, grabbed two other dependencies and ported a Python example to
>D.
>
>And it runs! Pretty cool having native windows controls and Cairo for
>smooth antialised graphics (with no flicker!).
>
>FWIW there's an object-oriented D1 wrapper for Cairo called CairOO,
>but it's severely outdated and the old dependencies don't even exist
>anymore.

Hi Andrej,

I'm currently writing a cairo wrapper for D2. The source code is
located here: https://github.com/jpf91/cairoD

There's no API documentation yet, but I try to keep a consistent
naming scheme (phobos like) and the naming follows cairo's names, so it
shouldn't be too bad. Documentation is probably what should be done
next, but there are some more things to be done (see the TODO list).

A word on memory management, as that's a little different from cairo:
All structs are either POD or ref-counted.
For classes, .dispose should be called when the class is no longer
needed. (The gc also calls dispose automatically to prevent memory
leaks, but that's not good enough for some use cases)

The Win32Surface hasn't been tested yet, so reports on that are welcome.
And if you want to help with the wrapper, just let me know.

-- 
Johannes Pfau



More information about the Digitalmars-d-announce mailing list