Fix #19 Type Casts in Triangle

Hey @individual61 - this one is for you to review :)

Fixes the issue reported in #19 / [sourceforge#forum#6e7f2697](http://sourceforge.net/p/pngwriter/discussion/238247/thread/6e7f2697/) by Andrea Charao from April 2009.