Hieroglyph

Hieroglyph is in release 2.23 as of 5/28/2009

Haddock documentation is here

Hieroglyph is on Hackage in the category Graphics

Release History

  • 2.23: major reworking of practically everything.  Nominal OpenGL support added.  Interactive Cairo support removed, but will reappear using Buster soon.

About

Hieroglyph is a pure-functional 2D graphics library focused on visualization.  The same code for visualizing data can be used both in high-quality static visualizations and in interactive visualizations, which makes for ease of transition between literature and interactive work. Hieroglyph tries to be semantically clean, and is forever working on this goal.  My current work is focused on nailing down the semantics of visual primitives, but the library is perfectly usable, stable, and clean without this having been nailed down quite yet.

Hieroglyph is in use in several applications already and is fairly stable and complete.

Hieroglyph has two main concepts, the Visual and the Primitive.  Visual is a typeclass of data that have a visual representation and whose visual representation can be modified with combinators for things like color, line width, font, etcetera.  There are basic typeclasses for Primitive, [Primitive], [Visual], and maps and sets containing Visuals.  Primitives are merely descriptions of geometry which appear as “labeled” functions using the Haskell record syntax to define default values for the attributes of a geometric primitive.  The following primitives are defined:

  • dots: A collection of vertices intended to be visible as points.
  • path: A possibly discontiguous, possibly closed collection of line and spline segments
  • rectangle: A rectangle
  • arc: A circular arc, defined as the parametric function t = r cos(theta) + r sin(theta)
  • string: A Text.PrettyPrint.Doc formatted via Pango in full TrueType font glory, even in OpenGL.
  • union: A union of primitives to define the vertices of a single shape.
  • hidden: A placeholder primitive that cannot be seen

The coordinate system is by default in pixels, where a pixel is 1/72nd of a point, although this may change in the future to be specifiable as “Real | Relative | IsometricRelative” where Real is the current mode, Relative is the rectangle <0,0> - <1,1>, and IsometricRelative is the rectangle defined by <0,0>-<1,1> on the short axis and the proportional number of square units on the long axis.

To Do

Currently OpenGL is only mostly supported in Hieroglyph.  In particular, the union primitive is not supported, and the clipping plane, line caps, stipples, and line corner styles, which are supported in the Cairo version are ignored by the OpenGL version.  These are lower priority and harder to support features for me, so I’m leaving them off for now. If anyone wants to add these, please email me.

Also, although images are cached, complex geometries are not.  I would very much like to move to a model where all geometry is compiled into Vertex Buffer Objects, but currently everything is implemented in immediate mode.  Anyone who is competent in these things and wants to offer their help should email me.

Splines are not particularly well tested in the OpenGL version, and although I believe they will work in all cases, I can’t guarantee that they will be the same as in the Cairo version.

Primitives need to be nailed down semantically speaking.