【问题标题】:How to Totally clear the canvas using CamanJS如何使用 CamanJS 完全清除画布
【发布时间】:2017-07-25 19:04:56
【问题描述】:

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

【问题讨论】:

    标签: javascript android html camanjs


    【解决方案1】:

    试试下面,

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

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

    【讨论】:

      【解决方案2】:

      试试这个代码

      this.reloadCanvasData();
      this.revert(false);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-05
        相关资源
        最近更新 更多