Class NoiseConf
NoiseFunction
which is a function
that takes a coordinate and returns a value between 0 and 1. The noise gradient is then defined by a list of colors which will transition from one to the next in the order they are specified.
The noise gradient can also be offset, scaled, rotated and clipped to a specific area of the component, and positioned at a specific boundary of the component.
-
Method Summary
Modifier and TypeMethodDescriptionboundary
(UI.ComponentBoundary boundary) Define the boundary at which the noise gradient should start in terms of its base position.clipTo
(UI.ComponentArea area) Define the area of the component to which the noise gradient is clipped to.Define a list of colors which will, as part of the noise gradient, transition from one to the next in the order they are specified.Define a list ofString
based colors which will, as part of the noise gradient, transition from one to the next in the order they are specified.boolean
fractions
(double... fractions) Define the fractions of the noise gradient which is an array of values between 0 and 1 that defines the relative position of each color in the noise gradient.function
(NoiseFunction function) Accepts theNoiseFunction
, which takes a coordinate and returns a value between 0 and 1.int
hashCode()
static NoiseConf
none()
Use the returned instance as a representation of the absence of a noise gradient.offset
(double x, double y) Define the offset of the noise gradient which is the start position of the noise gradient on the x and y-axis.rotation
(float rotation) Define the rotation of the noise gradient in degrees.scale
(double scale) Define the scale of the noise gradient in terms of its size / granularity.scale
(double x, double y) Define the x and y scale of the noise gradient in terms of its size / granularity.toString()
-
Method Details
-
none
Use the returned instance as a representation of the absence of a noise gradient.- Returns:
- A noise gradient without any colors, effectively representing the absence of a noise gradient.
-
function
Accepts theNoiseFunction
, which takes a coordinate and returns a value between 0 and 1.
The noise function is used to define the noise gradient.Take a look at
UI.NoiseType
for a rich set of predefined noise functions.- Parameters:
function
- The noise function mapping the translated, scaled and rotated virtual space to a gradient value of a pixel in the color space / view space of the screen.- Returns:
- A new noise gradient style with the specified noise function.
-
colors
Define a list of colors which will, as part of the noise gradient, transition from one to the next in the order they are specified.Note that you need to specify at least two colors for a noise gradient to be visible.
- Parameters:
colors
- The colors in the noise gradient.- Returns:
- A new noise gradient style with the specified colors.
- Throws:
NullPointerException
- if any of the colors isnull
.
-
colors
Define a list ofString
based colors which will, as part of the noise gradient, transition from one to the next in the order they are specified.Note that you need to specify at least two colors for a noise gradient to be visible.
- Parameters:
colors
- The colors in the noise gradient inString
format.- Returns:
- A new noise gradient style with the specified colors.
- Throws:
NullPointerException
- if any of the colors isnull
.
-
offset
Define the offset of the noise gradient which is the start position of the noise gradient on the x and y-axis.
Note that the offset is relative to the component that the noise gradient is applied to.- Parameters:
x
- The noise gradient start offset on the x-axis.y
- The noise gradient start offset on the y-axis.- Returns:
- A new noise gradient style with the specified offset.
-
scale
Define the scale of the noise gradient in terms of its size / granularity. It scales the input space of the noise function.- Parameters:
scale
- The noise gradient size.- Returns:
- A new noise gradient style with the specified size.
-
scale
Define the x and y scale of the noise gradient in terms of its size / granularity. It scales the input space of the noise function.- Parameters:
x
- The noise gradient size on the x-axis.y
- The noise gradient size on the y-axis.- Returns:
- A new noise gradient style with the specified size.
-
clipTo
Define the area of the component to which the noise gradient is clipped to. Which means that the noise gradient will only be visible within the specified area of the component.- Parameters:
area
- The area of the component to which the noise gradient is clipped to.- Returns:
- A new noise gradient style with the specified area.
-
boundary
Define the boundary at which the noise gradient should start in terms of its base position. So if the boundary is set toUI.ComponentBoundary.EXTERIOR_TO_BORDER
then the noise gradient position will be determined by the margin of the component.
Here a complete list of the available boundaries:UI.ComponentBoundary.OUTER_TO_EXTERIOR
- The outermost boundary of the entire component, including any margin that might be applied. Using this boundary will cause the noise gradient to be positioned somewhere at the outer most edge of the component.UI.ComponentBoundary.EXTERIOR_TO_BORDER
- The boundary located after the margin but before the border. This tightly wraps the entireUI.ComponentArea.BODY
. Using this boundary will cause the noise gradient to be positioned somewhere at the outer most edge of the component's body, which is between the margin and the border.UI.ComponentBoundary.BORDER_TO_INTERIOR
- The boundary located after the border but before the padding. It represents the edge of the component's interior. Using this boundary will cause the noise gradient to be positioned somewhere at the outer most edge of the component's interior, which is between the border and the padding area.UI.ComponentBoundary.INTERIOR_TO_CONTENT
- The boundary located after the padding. It represents the innermost boundary of the component, where the actual content of the component begins, like for example the contents of aJPanel
orJScrollPane
. Using this boundary will cause the noise gradient to be positioned somewhere after the padding area and before the content area, which is where all of the child components are located.
You can think of this property as a convenient way to define the base position of the noise gradient. So if you want to do the positioning yourself, then you may configure this property to
UI.ComponentBoundary.OUTER_TO_EXTERIOR
, which will cause the noise gradient to be positioned at the outermost edge of the component, and then use theoffset(double, double)
method to define the exact position of the noise gradient.- Parameters:
boundary
- The boundary at which the noise gradient should start in terms of its offset.- Returns:
- A new noise gradient style with the specified boundary.
-
rotation
Define the rotation of the noise gradient in degrees. This will rotate the input space of the noise function.- Parameters:
rotation
- The rotation of the noise gradient in degrees.
-
fractions
Define the fractions of the noise gradient which is an array of values between 0 and 1 that defines the relative position of each color in the noise gradient.Note that the number of fractions must match the number of colors in the noise gradient. If the number of fractions is less than the number of colors, then the remaining colors will be evenly distributed between the last two fractions.
- Parameters:
fractions
- The fractions of the noise gradient.
-
toString
-
equals
-
hashCode
public int hashCode() -
simplified
-