translation of classic Quartz 2D code written by David Gelphman