meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Remove Current Filter to apply new filter #79

Open myjangle opened 11 years ago

myjangle commented 11 years ago

Ok, so i applied one filter to an image after that i applied another but the problem here is that second filter is applied on top of the first filter that i applied like a stack e.g Second Filter <---> First Filter <---> Image

how do stop it to do this any help will be appreciated. Anyways Tnx

sandbochs commented 11 years ago

The easiest way to get around this is to keep a copy of the original image around. When applying a filter, clone the img element, create a new caman object and apply the filter. When you want to apply a different filter, do the same thing and remove the previous clone.

myjangle commented 11 years ago

tnx!

daGUY commented 10 years ago

Is there no way to simply remove an applied filter? For instance, if I apply a greyscale filter like this...

Caman("#canvas", function() { this.greyscale().render(); });

...is there a way to just remove the greyscale filter later without doing anything else to the canvas? The usage guides show how to apply filters, but don't say anything about removing them.

I'm aware of this.revert(), but that reverts the canvas entirely; I want to specifically remove an applied filter without touching the canvas otherwise.