我正在使用CamanJS创建一个带有滤镜的照片编辑应用程序。我让它完美地工作,但在用户上传一张图片之后,一旦他们应用了任何过滤器,就会通过上传另一张图片的过程,它会将画布恢复到之前上传的图片。我使用了revert()函数,但我也将画布重新分配给新上传的图像,但它仍然恢复为第一个图像。所以我的问题是,有没有一种方法可以完全清除canvas/camanJS还原内存,使camanJS revert()不会还原到之前的图像?
我的一个过滤器:
function vintage(){
Caman("#myFilterCanvas", function () {
this.revert();
this.greyscale();
this.contrast(5);
this.noise(3);
this.sepia(100);
this.channels({
red: 8,
blue: 2,
green: 4
});
this.gamma(0.87);
this.vignette("40%", 30);
this.render();
});
}发布于 2014-07-28 18:11:38
尝试使用下面的代码,
this.revert(false);
this[effect]();
this.render();或
你能用JSfiddle分享一些代码吗?
发布于 2017-07-25 19:03:15
尝试此代码
this.reloadCanvasData();
this.revert(false);https://stackoverflow.com/questions/23085271
复制相似问题