Here is an example showing a more dynamic use of Wt's vector graphics API.
Wt's WPaintedWidget renders as SVG, VML or HTML5 graphics depending on the capabilities of the browser. The backend decides how to render the graphics, the application programmer has to draw his graphics using the available methods in the WPainter API. The drawing primitives include points, lines, arcs, cubic splines, text, etc.
update() method of
WPaintedWidget is called with
PaintUpdate rendering flag to update the canvas without
clearing the previously painted contents (which is the default behavior).
Every mouse drag operation on the simple painting device is sent to the server, which in turn updates the canvas. You could imagine more interesting use cases, such as a multi-user white board, or interactive visualizations.
You can use a custom cursor image (pencil) by providing a cursor image to WCssDecorationStyle.