Implement Raster#clone.

This commit is contained in:
Jonathan Puckey 2011-05-21 12:50:02 +02:00
parent fd810e9804
commit 73a2f0f256

View file

@ -35,8 +35,16 @@ var Raster = this.Raster = Item.extend({
},
clone: function() {
// TODO: Implement!
return this.base();
var image = this._image;
if (!image) {
// If the Raster contains a Canvas object, we need to create
// a new one and draw this raster's canvas on it.
image = CanvasProvider.getCanvas(this._size);
image.getContext('2d').drawImage(this._canvas, 0, 0);
}
var raster = new Raster(image);
raster.matrix = this.matrix.clone();
return raster;
},
/**