code: public void resize (float width, float height) {
      if (canvas != null) canvas.close();
      canvas = gfx.createCanvas(width, height);
    }
docs: Resizes the canvas that is displayed by this layer.
  
  <p>Note: this throws away the old canvas and creates a new blank canvas with the desired size.
  Thus this should immediately be followed by a {@link #begin}/{@link #end} pair which updates
  the contents of the new canvas. Until then, it will display the old image data.