split platform independent drawing function into draw.h