Creating code, mostly for the fun of seeing it work.

Error handling

OSMPosted by Chris Fri, October 10, 2008 22:28:31
So I've taken a look at libpng. The first thing that jumped out at me was the dodgy error handling. It uses a long jump routine to trap errors, which doesn't really give many options. The good news is that the library seems very stable, so errors are rare.

I found a c++ wrapper called png++, but it is simply a header stuffed with templates. It seems to work, but it makes each compile take a long time and most of the stuff is not needed. So I've put a simple class wrapper around libpng and it seems to work. This creates an object type grea - short for graphics area. This where the graphics get drawn.

I've also taken a brief look at fonts, especially freetype. It looks quite manageable so I think I'll look at this next. The libfreetype documentation demonstrates the process of turning characters from a font file into a bitmap to be used on my grea. This includes using a matrix to transform the character. This is great because it will allow a rotation which is needed to draw a name along a road at any angle. I will need to draw each character separately because each one may be at its own angle. This is just how libfreetype seems to work.

If I can get fonts to work, then there's the issue of anti-aliasing and then bezier curves then icons, then line thickness and casings then ...

  • Comments(1)//