Hi,
I just committed a simple canvas component to
contrib
. It doesn’t do much except wrap some of the API of the
GWTCanvas
widget.
You use it (server side) like this:
Canvas canvas = new Canvas();
canvas.setSizeFull();
canvas.setBackgroundColor("#002200");
canvas.setStrokeColor("#aaaaff");
canvas.saveContext();
canvas.arc(100, 90, 50, 0, Math.PI, true);
canvas.stroke();
canvas.beginPath();
canvas.restoreContext();
canvas.arc(75, 30, 20, 0, Math.PI, false);
canvas.arc(125, 30, 20, 0, Math.PI, false);
canvas.stroke();
This creates a new canvas instance and uses almost the entirety of the supported API to draw an extremely ugly smiley face
Still missing, perhaps to come later:
- Javadocs
- Support for other operations besides arc()
Maybe someone will find a use for it. Please reply to the thread if you use it somewhere, and patches are always welcome