One of the goals of the canvas is to eliminate flicker when drawing items. Flicker is caused when an area is repainted multiple times with different colors; for example, a stack of colored rectangles would flicker if it were painted directly to the screen, one rectangle after another.
The canvas solves this problem by using a special form of double-buffering. When an area of the canvas needs to be repainted, the following actions take place:
The visual effect is that the whole area is painted simultaneously, eliminating all flicker.
This process actually takes place during the idle loop of the application. Repainting the canvas in the idle loop means that at that point all interaction between the application and canvas items is finished, i.e. the application literally has nothing else to do, so it is appropriate to flush all pending redraws.