Add writeToPainter()