Package net.nullved.pmweatherapi.util
Class ColorMap
java.lang.Object
net.nullved.pmweatherapi.util.ColorMap
A builder-based representation of
You can create a new
ColorTables.
Should hopefully be able to produce identical results.
You can create a new
ColorMap builder with ColorMap.Builder.of(Color).
Use ColorMap.Builder.addPoint(Color, float) to add a new point to lerp between.
Use ColorMap.Builder.override(Color, float) to add a new point to override the color at.- Since:
- 0.14.15.6
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Builder pattern for creating aColorMapstatic final recordRepresents a Lerp Segment -
Method Summary
Modifier and TypeMethodDescriptionget(float val) Retrieves the color value using the closest value from the lookup table.getAccurate(float val) Gets theColorfor the specific value.static ColorLerps between two colorsfloatmaxValue()Gets the largest value a color is defined forfloatminValue()Gets the smallest value a color is defined forvoidrecomputeLookups(float resolution) Recomputes the lookup table with the given resolution.
-
Method Details
-
minValue
public float minValue()Gets the smallest value a color is defined for- Returns:
- The minimum value
- Since:
- 0.14.15.6
-
maxValue
public float maxValue()Gets the largest value a color is defined for- Returns:
- The maximum value
- Since:
- 0.14.15.6
-
recomputeLookups
public void recomputeLookups(float resolution) Recomputes the lookup table with the given resolution.- Parameters:
resolution- The new resolution- Since:
- 0.14.16.1
-
get
Retrieves the color value using the closest value from the lookup table. If you need the accurate value, usegetAccurate(float)instead- Parameters:
val- The value to get a color for- Returns:
- The approximate color for this value
- Since:
- 0.14.16.1
- See Also:
-
getAccurate
Gets theColorfor the specific value.
This method is SLOWER and oftentimes the same asget(float). Use that instead if you only need the approximate value -
lerp
Lerps between two colors
-