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

Curves plugin - Support arbitrary amount of control points #114

Closed bebraw closed 10 years ago

bebraw commented 10 years ago

I haven't tested it a lot. I mainly ran examples/browser/ and that seems to work ok. Filter.curves API looks the same as before. We just support arbitrary amount of control points. The original ... was very handy this way.

The biggest changes were made to Calculate.bezier. In that case I shimmed it so that it works both using the new declaration ([control points], lowBound, upperBound) and the original one. The docs point at the new one. I suggest you drop the shim at 5.0.

The algorithm itself is really simple. It's just an implementation of de Casteljau's algorithm. I suspect it's slower with low amount of control points but I'm not sure if that's really an issue. If it is, you might want to add back the old implementation and revert to that with a low amount of control points (<= 4) and use this one otherwise.

Closes #43.

confile commented 10 years ago

@bebraw Please have a look at this issue: https://github.com/meltingice/CamanJS/issues/112

confile commented 10 years ago

@bebraw @meltingice There seems to be a bug in the latest commit see here: https://github.com/meltingice/CamanJS/issues/122