*/
public void resize(int width, int height)
{
assert (image != null || this.canvas != null) : "You must load an image first";
CanvasElement canvas = Document.get().createCanvasElement().cast();
canvas.setWidth(width);
canvas.setHeight(height);
if (image != null)
{
canvas.getContext2d().drawImage(image.asImageElement(), 0, 0, width, height);
}
else
{
canvas.getContext2d().drawImage(this.canvas, 0, 0, this.canvas.getWidth(), this.canvas.getHeight(), 0, 0, width, height);
}
this.canvas = canvas;
image = null;
}