Functions painter:gbegin and painter:gend can be used to bracket code segments that perform drawings that are meaningful as a whole. The actual display is usually postponed until the last call to painter:gend. This is useful for implementing smooth transitions between successive drawings.