Package swingtree.api
Interface NoiseFunction
- All Known Implementing Classes:
UI.NoiseType
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A noise function is used to render
NoiseConf
styles
by taking a float based
coordinate and returning a gradient value between 0 and 1.
The value is used to determine the color of a pixel in virtual space.
Conceptually speaking, this maps the translated, scaled and rotated virtual space
to a gradient value of a pixel in the color space / view space of the screen.
Please take a look at UI.NoiseType
for a rich set of
predefined noise function implementations.
There you will most likely find a noise function that fits your needs.
-
Method Summary
Modifier and TypeMethodDescriptiondefault NoiseFunction
andThen
(FloatFunction after) Compose this noise function with another (scalar) function.default NoiseFunction
compose
(FloatFunction before) Compose this noise function with another (scalar) function.float
getFractionAt
(float x, float y) Get the noise value at the given coordinate.
-
Method Details
-
getFractionAt
float getFractionAt(float x, float y) Get the noise value at the given coordinate.- Parameters:
x
- The x coordinate in translated, scaled and rotated virtual space.y
- The y coordinate in translated, scaled and rotated virtual space.- Returns:
- The gradient value between 0 and 1 used to determine the color of a pixel in the color space / view space of the screen.
-
andThen
Compose this noise function with another (scalar) function.- Parameters:
after
- The function to apply after this function.- Returns:
- A new noise function that applies this noise function and then the given scalar function, which takes the result of this noise function as input.
-
compose
Compose this noise function with another (scalar) function.- Parameters:
before
- The function to apply to the input of this function, which is the x and y coordinate in translated, scaled and rotated virtual space.- Returns:
- A new noise function that applies the given scalar function and then this noise function, which takes the result of the given scalar function as input.
-