CanvasElement canvas

Source

CanvasElement get canvas {
  if (_source is CanvasElement) {
    return _source;
  } else if (_source is ImageElement) {
    ImageElement imageElement = _source;
    _canvas = _source = new CanvasElement(width: _width, height: _height);
    _canvas.context2D.drawImageScaled(imageElement, 0, 0, _width, _height);
    return _canvas;
  } else {
    throw new StateError("RenderTexture is read only.");
  }
}