Expression painter:refresh() immediately repaints the displayed image, regardless of the nesting count of functions painter:begin() and painter:end().
painter:refresh()
painter:begin()
painter:end()