CamanJS - change underlying canvas after applying filters/manipulations

前端 未结 1 1851
天命终不由人
天命终不由人 2021-01-05 11:11

CamanJS is a great library for doing live image manipulation in the browser.

I am using Caman on a pre-existing canvas object. I may need to change the image on tha

相关标签:
1条回答
  • 2021-01-05 11:45

    I emailed Ryan (creator of CamanJS) and he replied that there's a function called reloadCanvasData() that can be called to 'refresh' Caman's image data cache with any changes to the canvas's original context. Here's the source link: https://github.com/meltingice/CamanJS/blob/master/src/core/caman.coffee#L387-L392

    This worked perfectly: store the Caman instance you create for your canvas and then call .reloadCanvasData() on any subsequent runs. You'll then need to re-apply any Caman manipulations you desire.

    I wanted to document this function as google doesn't appear to contain any references to it yet.

    0 讨论(0)
提交回复
热议问题