move shared types/functions to drawing.go