optimized pen drawing