From http://computerhistory.org/atchm/macpaint-and-quickdraw-source-code/