|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.meltingice.caman.util.Bezier
public class Bezier
Class for generating a Bezier curve that can be queried by X coordinate to return a Y coordinate. For CamanJ, the X coordinate is the input color, and the Y coordinate is the output color. It helps to think of Photoshop's curves functionality when thinking about Bezier curves. While that uses a different curves equation, the idea is very similar. It generates the curve by running a certain number of iterations from the start coordinate to the end coordinate. For edge cases where certain X coordinates aren't defined, it uses linear interpolation to approximate what the value should be. Usually this approximation is very accurate.
Constructor Summary | |
---|---|
Bezier(int[] start,
int[] ctrl1,
int[] ctrl2,
int[] end)
Create a new Bezier curve with the given points. |
|
Bezier(int[] start,
int[] ctrl1,
int[] ctrl2,
int[] end,
int lowBound,
int highBound)
Create a new Bezier curve with the given points and bounds. |
Method Summary | |
---|---|
void |
fillEnds(int s,
int e)
Fills the edges of the bezier curve out to a certain start and end point. |
int |
query(int x)
Lets you query the Bezier curve to convert an X input into a Y output value. |
void |
setIterations(int iter)
Sets the number of iterations to run between the start and end coordinates. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bezier(int[] start, int[] ctrl1, int[] ctrl2, int[] end, int lowBound, int highBound)
start
- The start x,y coordsctrl1
- The control point 1 x,y coordsctrl2
- The control point 2 x,y coordsend
- The end x,y coordslowBound
- The low bound of the Y values in the Bezier curvehighBound
- The high bound of the Y values in the Bezier curvepublic Bezier(int[] start, int[] ctrl1, int[] ctrl2, int[] end)
start
- The start x,y coordsctrl1
- The control point 1 x,y coordsctrl2
- The control point 2 x,y coordsend
- The end x,y coordsMethod Detail |
---|
public void setIterations(int iter)
iter
- The number of iterationspublic void fillEnds(int s, int e)
s
- e
- public int query(int x)
x
- The input color
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |