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

Applying Curves in a row! #111

Closed confile closed 11 years ago

confile commented 11 years ago

I want to apply curves multiple times. What is the correct way of doing this:

1:

 this.curves('rgb', [0, 0], [55, 43], [149, 177], [255, 255]);
this.curves('rgb', [0, 0], [55, 43], [140, 196], [255, 255]);

2:

 this.curves('rgb', [0, 0], [55, 43], [149, 177], [255, 255]);
        this.newLayer(function () {

            this.filter.curves('rgb', [0, 0], [55, 43], [140, 196], [255, 255]);

        }); 

3.

 this.curves('rgb', [0, 0], [55, 43], [149, 177], [255, 255]);
        this.newLayer(function () {
        this.copyParent();
            this.filter.curves('rgb', [0, 0], [55, 43], [140, 196], [255, 255]);

        }); 
meltingice commented 11 years ago

The first method is correct. Filters are applied to the image in the order that they are called, and they can be called any number of times.

confile commented 11 years ago

@meltingice I tested all variants and it turns out that the effect is stronger on variante 2,3