evanw / glfx.js

An image effects library for JavaScript using WebGL
https://evanw.github.io/glfx.js/
MIT License
3.26k stars 402 forks source link

Curves(r,g,b) function does wrong interpolation #42

Open pastissolo opened 6 years ago

pastissolo commented 6 years ago

Hello, the interpolation function to generate the 255 points of the rgb channels is wrong: glfx.js line 806 is function splineInterpolate(points) { var interpolator = new SplineInterpolator(points); var array = []; for (var i = 0; i < 256; i++) { array.push(clamp(0, Math.floor(interpolator.interpolate(i / 255) * 256), 255)); } return array; } the line array.push(clamp(0, Math.floor(interpolator.interpolate(i / 255) * 256), 255)); make no sense, probably it should be: array.push(clamp(0, Math.floor((interpolator.interpolate(i) / 255) * 256), 255));