[Haskell-cafe] Re: Why binding to existing widget toolkits doesn't make any sense

Antony Courtney antony.courtney at gmail.com
Fri Jan 30 16:56:44 EST 2009


On Fri, Jan 30, 2009 at 4:25 PM, Bryan O'Sullivan <bos at serpentine.com> wrote:
> On Fri, Jan 30, 2009 at 1:11 PM, Antony Courtney <antony.courtney at gmail.com>
> wrote:
>>
>> A 2-D vector graphics library such as Java2D ( or Quartz on OS/X or
>> GDI+ on Windows ) supports things like computing tight bounding
>> rectangles for arbitrary shapes, hit testing for determining whether a
>> point is inside or outside a shape and constructive area geometry for
>> shape compositing and clipping without dropping down to a raster
>> representation.
>
> These are the kinds of capabilities provided by Cairo, which is very
> pleasant to use (PDF-style imaging model) and quite portable. There are
> already Cairo bindings provided by gtk2hs, too.
>

Hi Bryan,

Nice to hear from you!  Been a while...

Just had a quick look and it does indeed appear that Cairo now
supports some of the features I mention above (bounds calculations and
hit testing).  Cairo has clearly come a long way from when I was last
working on Fruit and Haven in 2003/2004;  back then it looked like it
only provided a way to render or rasterize vector graphics on to
bitmap surfaces and not much else.

It's not clear to me if the Cairo API in its current form supports
vector-level clipping or constructive area geometry, and it looks like
the API is still pretty render-centric (e.g. is it possible to obtain
the vector representation of rendering text in a particular font?).
That might make it challenging to use Cairo for something like the
Haven API, but maybe one can live without that level of generality.

In any case: delighted to see progress on this front!  Hopefully some
enterprising Haskell hacker will wrap Cairo in a nice purely
functional API.

    -Antony


More information about the Haskell-Cafe mailing list