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

Hermite curve variant #116

Closed bebraw closed 11 years ago

bebraw commented 11 years ago

The hermite curve variant guarantees that the curve passes through given control points. This is the method that applications such as Photoshop and GIMP use for tone mapping. Consequently it will be easier to port effects from those environments to CamanJS.

The new curve variant may be passed as an optional parameter to the curves effect. It defaults to bezier when one is not provided.

Note that this is based on #114. I suggest you merge that first and this after. That way you avoid possible conflicts.

If you want to check out the original algorithm, check out Unity wiki page on the topic.

Here's a little demo image:

screenshot 2013-10-24 21 33 16

meltingice commented 11 years ago

This looks sweet. I'm currently on vacation but will check this out in full on Monday.

bebraw commented 11 years ago

Ok. No probs.

There is probably potential for tweaking. For instance if you use some vector library already, you might want to hook up the code with that etc. Now it's just a bunch of custom ops. :)

confile commented 11 years ago

@bebraw Great work I like it! @meltingice I would be happy if you can merge that request.

confile commented 11 years ago

@meltingice Will you merge this request?

bebraw commented 11 years ago

@confile I'm guessing he is busy right now. For now you can try and test the dist version available at my branch. It contains both the multi control point patch and this one.

confile commented 11 years ago

@bebraw okay which branch is it?

bebraw commented 11 years ago

@confile hermite should contain the both. See /dist.

confile commented 11 years ago

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

confile commented 11 years ago

@bebraw could support some kind of documentation for the new hermite curve?

bebraw commented 11 years ago

@confile The API docs should explain it. There is also an example around at examples/browser/curves.html.

confile commented 11 years ago

@bebraw yes of course but you should add it here too: http://camanjs.com/guides/#BuiltIn

good job by the way! Thank you!

bebraw commented 11 years ago

@confile I think @meltingice will do that once he releases a new version. :)