0

我正在使用 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();
});
}
4

2 回答 2

1

试试下面,

                        this.revert(false);
                        this[effect]();
                        this.render();

或者

您能否在 JSfiddle 中分享一些代码。

于 2014-07-28T10:11:37.540 回答
0

试试这个代码

this.reloadCanvasData();
this.revert(false);
于 2017-07-25T11:03:15.103 回答