meltingice / CamanJS

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

Problem with latest commit! #122

Closed confile closed 10 years ago

confile commented 10 years ago

@meltingice There seems to be a bug in the latest comment from today 2013-11-13. I use the lomo filter as:

     var filterName = "lomo";
                Caman($originalCanvas[0], function () {

                    // If such an effect exists, use it
                    if ( filterName in this) {
                        this[filterName]();

                        this.render();
                    }
                }); 

It worked perfect in the old version but after the latest commit I get strange results when aplying filters like lomo. See the following image:

michael_gorski_-_buddy is

bebraw commented 10 years ago

Can you post an image of what it should look like?

confile commented 10 years ago

@bebraw sure here is the image how it should look like processed with the previous version of camen.full.pack.js:

michael_gorski_-_buddy is-2

You see that the black area is strange. Since everything is unchanged on my side it must be in the lib.

bebraw commented 10 years ago

It's hard to see how the curve work could cause that. Could it be due to the vignette option? Perhaps some option is on now by default that was off earlier?

bebraw commented 10 years ago

Okay, I think I know what is the likely culprit. It's those lowBound and highBound parameters of bezier. lomo uses vignette but doesn't provide values for those. As a result they will be treated as undefined. This in turn makes the generated curve contain a bunch of zeros which in turn causes the image you see.

bebraw commented 10 years ago

@confile I made a tentative fix. Could you check out the build of my branch to see whether it works?

confile commented 10 years ago

@bebraw I tested it but did not work.

bebraw commented 10 years ago

Ok. Something else going on then. I'll need to set up a test case for this and repro.

meltingice commented 10 years ago

You were right that the lowBound and highBound variables were causing issues. The RGB color space is represented between 0 and 255, so I have set those at the default values. Let me know if you're still having issues.

bebraw commented 10 years ago

Yeah. Makes sense. Thanks! :)

confile commented 10 years ago

okay now it is working! Thanks!

bebraw commented 10 years ago

@meltingice It just came to my mind you mind want to perform the same fix for hermite. Thanks.