Add Raster.clear() to clear associated canvas

This commit is contained in:
Jürg Lehni 2019-04-11 19:38:12 +02:00
parent e436d44f14
commit ea91efe810

View file

@ -680,6 +680,14 @@ var Raster = Item.extend(/** @lends Raster# */{
ctx.putImageData(imageData, point.x, point.y); ctx.putImageData(imageData, point.x, point.y);
}, },
/**
* Clears the image, if it is backed by a canvas.
*/
clear: function() {
var size = this._size;
this.getContext().clearRect(0, 0, size.width + 1, size.height + 1);
},
// DOCS: document Raster#createImageData // DOCS: document Raster#createImageData
/** /**
* {@grouptitle Image Data} * {@grouptitle Image Data}