public class MilightColor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_BRIGHTNESS
The maximum brightness value to send to the WiFi box.
|
static int |
MAX_COLOR
The maximum color value to send to the WiFi box.
|
static int |
MIN_BRIGHTNESS
The minimum brightness value to send to the WiFi box.
|
static int |
MIN_COLOR
The minimum color value to send to the WiFi box.
|
static float |
SATURATION_THRESHOLD
This threshold defines where the lights should change between white and
colored mode.
|
Constructor and Description |
---|
MilightColor(java.awt.Color color)
Use this constructor to generate a new MilightColor representing a
specified color.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(MilightColor color)
This function checks whether two MilightColors represent the same color
by comparing their hsb values.
|
float |
getBrightness()
Extract the brightness value from the color the instance is representing.
|
java.awt.Color |
getColor()
This function returns the color the instance is representing.
|
float[] |
getHSB()
This function extracts hue, saturation and brightness of the color the
instance is representing.
|
float |
getHue()
Extract the hue value from the color the instance is representing.
|
int |
getMilightBrightness()
This function extracts the brightness value from the color the instance
is representing and transforms it to a value that can be sent to the WiFi
box.
|
int |
getMilightHue()
This function extracts the hue value from the color the instance is
representing and transforms it to a value that can be sent to the WiFi
box.
|
float |
getSaturation()
Extract the saturation value from the color the instance is representing.
|
MilightColor |
getTransition(MilightColor target,
float x)
This function finds colors between two MilightColors.
|
boolean |
isColoredMode()
This function computes whether a color should be displayed in white or
colored mode.
|
boolean |
isWhiteMode()
This function computes whether a color should be displayed in white or
colored mode.
|
void |
setBrightness(float brightness)
Set a new brightness value and let the hue and saturation values
untouched.
|
void |
setColor(java.awt.Color color)
Use this function to set the color the instance is representing.
|
void |
setHue(float hue)
Set a new hue value and let the brightness and saturation values
untouched.
|
void |
setMilightBrightness(int milightBrightness)
This function sets a new brightness value for the color the instance is
representingThe value is given as it could be sent to the WiFiBox and
internally transferred to a float.
|
void |
setMilightHue(int milightHue)
This function sets a new hue value given as it would be sent to the
WiFiBox.
|
void |
setSaturation(float saturation)
Set a new saturation value and let the brightness and hue values
untouched.
|
java.lang.String |
toString()
This function describes the objet as a string.
|
public static final int MIN_COLOR
public static final int MAX_COLOR
public static final int MIN_BRIGHTNESS
public static final int MAX_BRIGHTNESS
public static final float SATURATION_THRESHOLD
public MilightColor(java.awt.Color color)
color
- is the colorthe new instance should representpublic java.awt.Color getColor()
public void setColor(java.awt.Color color)
color
- is the color the instance should be representingpublic float[] getHSB()
Color.RGBtoHSB(int, int, int, float[])
public float getHue()
Color.RGBtoHSB(int, int, int, float[])
public void setHue(float hue)
hue
- is the new hue value from 0 to 1public float getSaturation()
Color.RGBtoHSB(int, int, int, float[])
public void setSaturation(float saturation)
saturation
- is the new saturation value from 0 to 1public float getBrightness()
Color.RGBtoHSB(int, int, int, float[])
public void setBrightness(float brightness)
brightness
- is the new brightness value from 0 to 1public int getMilightHue()
public void setMilightHue(int milightHue)
getMilightHue()
.milightHue
- is the hue value to set, given as it would be sent to the
WiFiBoxpublic int getMilightBrightness()
public void setMilightBrightness(int milightBrightness)
getMilightBrightness()
.milightBrightness
- is the brightness value to set, given as it would be sent to
the WiFiBoxpublic boolean isWhiteMode()
SATURATION_THRESHOLD
.public boolean isColoredMode()
SATURATION_THRESHOLD
.public boolean equals(MilightColor color)
color
- the color to compare topublic MilightColor getTransition(MilightColor target, float x)
target
- is the color to reach at x=1x
- is the influence of the colors (x=0 returns this MilightColor,
x=1 returns target)public java.lang.String toString()
toString
in class java.lang.Object