Package jme3utilities.math
Class MyColor
java.lang.Object
jme3utilities.math.MyColor
Utility methods for RGBA colors.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdescribe(com.jme3.math.ColorRGBA color) Generate a textual description of a ColorRGBA value.static com.jme3.math.ColorRGBAinterpolateLinear(float fraction, com.jme3.math.ColorRGBA start, com.jme3.math.ColorRGBA end) Interpolate linearly between 2 colors (with no side effect).static com.jme3.math.ColorRGBAlerp(float t, com.jme3.math.ColorRGBA c0, com.jme3.math.ColorRGBA c1, com.jme3.math.ColorRGBA storeResult) Interpolate linearly between (or extrapolate linearly from) 2 colors.static com.jme3.math.ColorRGBAParse a color from the specified text string.static com.jme3.math.ColorRGBArenderColor(com.jme3.texture.image.ColorSpace colorSpace, com.jme3.math.ColorRGBA encodedColor) Convert a gamma-encoded color to the specified ColorSpace.static com.jme3.math.ColorRGBAsaturate(com.jme3.math.ColorRGBA baseColor) Generate a brightened and saturated version of a specified color (with no side effect).
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
describe
Generate a textual description of a ColorRGBA value.- Parameters:
color- the value to describe (may be null, unaffected)- Returns:
- a description (not null, not empty)
-
interpolateLinear
public static com.jme3.math.ColorRGBA interpolateLinear(float fraction, com.jme3.math.ColorRGBA start, com.jme3.math.ColorRGBA end) Interpolate linearly between 2 colors (with no side effect).Use instead of ColorRGBA.interpolate(), which got renamed in JME 3.1.
- Parameters:
fraction- (≤1, ≥0)start- the first input color (not null, unaffected)end- the 2nd input color (not null, unaffected)- Returns:
- new color, start*(1-fraction) + end*fraction
-
lerp
public static com.jme3.math.ColorRGBA lerp(float t, com.jme3.math.ColorRGBA c0, com.jme3.math.ColorRGBA c1, com.jme3.math.ColorRGBA storeResult) Interpolate linearly between (or extrapolate linearly from) 2 colors.- Parameters:
t- the weight given toc1c0- the function value at t=0 (not null, unaffected unless it'sstoreResult)c1- the function value at t=1 (not null, unaffected unless it'sstoreResult)storeResult- storage for the result (modified if not null, may bec0orc1)- Returns:
- the interpolated color (either
storeResultor a new instance)
-
parse
Parse a color from the specified text string.- Parameters:
textString- input text (not null, not empty)- Returns:
- a new color instance, or null if text is invalid
-
renderColor
public static com.jme3.math.ColorRGBA renderColor(com.jme3.texture.image.ColorSpace colorSpace, com.jme3.math.ColorRGBA encodedColor) Convert a gamma-encoded color to the specified ColorSpace.- Parameters:
colorSpace- the target ColorSpace (not null)encodedColor- the input color (not null, unaffected, gamma-encoded)- Returns:
- a new instance, suitable for use as the color of a viewport background or an unshaded material
-
saturate
public static com.jme3.math.ColorRGBA saturate(com.jme3.math.ColorRGBA baseColor) Generate a brightened and saturated version of a specified color (with no side effect).- Parameters:
baseColor- input color (not null, unaffected)- Returns:
- new color with the same hue, but full brightness and full saturation
-