There are eleven drawing methods, such as drawLine, drawRect, and drawImage. Four methods provide font metrics, often needed for positioning text within the canvas. For interactive canvases, three callback functions are defined, which will be called when the user clicks in the canvas, moves the mouse over it, or presses a key while the canvas is active. Finally, there are two helper methods which are seldom needed by users. Most of the methods in piddle.
Canvas have default implementations.
A minimal derived canvas need only implement the abstract methods, shown in italics in Table 1 . Finally, note that while the drawing mode is immediate, the actual output of any particular backend may not appear until the canvas is flushed. All coordinates are interpreted as floating-point values, and fractional coordinates are explicitly allowed, though some backends may round to the nearest point. For an interactive application, one would also assign callback functions to the canvas, which will be invoked on a mouse or keyboard event. These callbacks would do some additional drawing, then flush the canvas again.