Package com.rvandoosselaer.jmeutils.util
Class ColorUtils
- java.lang.Object
-
- com.rvandoosselaer.jmeutils.util.ColorUtils
-
public class ColorUtils extends java.lang.ObjectA helper class with utility methods for color related operations.
-
-
Constructor Summary
Constructors Constructor Description ColorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.jme3.math.ColorRGBAfromHex(java.lang.String hex)static com.jme3.math.ColorRGBAfromHex(java.lang.String hex, boolean linearSpace)Returns a ColorRGBA object from the passed hex string.static com.jme3.math.ColorRGBAfromRGBA(int red, int green, int blue, int alpha)Returns a ColorRGBA object from the passed red, green, blue, alpha values.static com.jme3.math.ColorRGBAfromRGBA(int red, int green, int blue, int alpha, boolean linearSpace)Returns a ColorRGBA object from the passed red, green, blue, alpha values.static java.lang.StringtoHex(com.jme3.math.ColorRGBA color)Returns the hexadecimal representation of the supplied color objectstatic java.lang.StringtoHex(com.jme3.math.ColorRGBA color, boolean includeAlphaChannel)Returns the hexadecimal representation of the supplied color
-
-
-
Method Detail
-
fromHex
public static com.jme3.math.ColorRGBA fromHex(java.lang.String hex)
-
toHex
public static java.lang.String toHex(com.jme3.math.ColorRGBA color)
Returns the hexadecimal representation of the supplied color object- Parameters:
color- the color- Returns:
- hexadecimal string representation of the color
-
toHex
public static java.lang.String toHex(com.jme3.math.ColorRGBA color, boolean includeAlphaChannel)Returns the hexadecimal representation of the supplied color- Parameters:
color- the colorincludeAlphaChannel- whether or not the alpha channel should be returned- Returns:
- hexadecimal string
-
fromHex
public static com.jme3.math.ColorRGBA fromHex(java.lang.String hex, boolean linearSpace)Returns a ColorRGBA object from the passed hex string. When the color is not in linear space, the values will be gamma corrected to be stored in linear space. GAMMA value is 2.2 When the color is picked from a color picker or GUI, the linearSpace boolean should probably be set to false.- Parameters:
hex- the hex stringlinearSpace- if the color is in linear space- Returns:
- the color derived from the hex, or null when the parsing did not succeed
-
fromRGBA
public static com.jme3.math.ColorRGBA fromRGBA(int red, int green, int blue, int alpha)Returns a ColorRGBA object from the passed red, green, blue, alpha values.- Parameters:
red- red valuegreen- green valueblue- blue valuealpha- alpha value- Returns:
- the color from the given input or null
-
fromRGBA
public static com.jme3.math.ColorRGBA fromRGBA(int red, int green, int blue, int alpha, boolean linearSpace)Returns a ColorRGBA object from the passed red, green, blue, alpha values. When the color is not in linear space, the values will be gamma corrected to be stored in linear space. GAMMA value is 2.2 When the color is picked from a color picker or GUI, the linearSpace boolean should probably be set to false.- Parameters:
red- red valuegreen- green valueblue- blue valuealpha- alpha valuelinearSpace- is the color in linear space- Returns:
- the color from the given input or null
-
-