[Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

Andrew Coppin andrewcoppin at btinternet.com
Sat Jul 4 13:56:44 EDT 2009


OK, so having released AC-HalfInteger, I got slightly carried away and 
released three other small packages. These are packages that many 
programs I write all end up using. I'm forever copying these files, so I 
made them into actual bonafide packages.


http://hackage.haskell.org/package/AC-Vector-1.1.1

This provides two types, Vector2 and Vector3, which are unboxed vectors 
of Doubles, with arithmetic, dot product and cross product, and a few 
other useful items.


http://hackage.haskell.org/package/AC-Colour-1.1.1

This provides two types, Colour and Colour8. Both implement simple RGB 
colour types with arithmetic. Colour has unboxed Double fields, and 
Colour8 has unboxed Word8 fields. My usual workflow is to do all the 
image generation with Colour, and to convert to Colour8 just before the 
data hits the I/O channels. You can, however, do arithmetic directly on 
Colour8. (I haven't extensively tested that it works properly though...)


http://hackage.haskell.org/package/AC-EasyRaster-GTK-1.1.1

This is a layer over Gtk2hs. As you all probably know, Gtk2hs provides a 
Cairo binding that makes vector graphics wonderfully easy. However, 
*bitmapped* graphics is darned tricky. I basically had to sit in the 
#haskell channel with Duncan for a few hours trying to figure out how 
the hell to do it. This knowledge is now codified in the above package. 
Load it up and you don't need to know a thing about GTK; you can just 
create an ImageBuffer, write some pixels to it (efficiently!), save it 
to disk or display it on screen. (But you *can* access the underlying 
GTK+ resources if you wish...)


In other news, it appears that the batch job to generate the 
documentation just ran, so you can view it all online. :-D

Comments, suggestions, random flames, etc...

[I'm particularly curios to know what Duncan will make of the GTK thing...]



More information about the Haskell-Cafe mailing list