我可以像这里一样向图像添加过滤器:
// apply grayscale filter to second image
filteredYoda.applyFilter({
filter: Kinetic.Filters.Grayscale,
callback: function() {
layer.draw();
}
});
,但我怎样才能删除它并获得初始图像?
更新: 解决问题的代码:
imageCanvas.initailImage = imageCanvas.getImage();
imageCanvas.disconnect = function () {
imageCanvas.applyFilter({
filter: Kinetic.Filters.Grayscale,
callback: function() {
//imageCanvas.deviceName += " - Disconnected.";
stage.get('#deviceLayer')[0].draw();
}
});
};
imageCanvas.connect = function () {
if (imageCanvas.hasOwnProperty('initailImage')) {
imageCanvas.setImage(imageCanvas.initailImage);
stage.get('#deviceLayer')[0].draw();
}
};