mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
[DSL] Expose ColorUtil methods to DSL rules (#4410)
* [DSL] Expose ColorUtil methods to DSL rules * Expose xyToKelvin and kelvinToXY * Add missing throws declaration Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
be003029b0
commit
aededaecc2
@ -70,4 +70,16 @@ public class CoreUtil {
|
|||||||
Gamut gamut = new Gamut(gamutR, gamutG, gamutB);
|
Gamut gamut = new Gamut(gamutR, gamutG, gamutB);
|
||||||
return ColorUtil.xyToHsb(xy, gamut);
|
return ColorUtil.xyToHsb(xy, gamut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double xyToDuv(double[] xy) throws IllegalArgumentException {
|
||||||
|
return ColorUtil.xyToDuv(xy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double[] kelvinToXY(double kelvin) throws IndexOutOfBoundsException {
|
||||||
|
return ColorUtil.kelvinToXY(kelvin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double xyToKelvin(double[] xy) throws IllegalArgumentException {
|
||||||
|
return ColorUtil.xyToKelvin(xy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1651,9 +1651,9 @@ public class ColorUtil {
|
|||||||
*
|
*
|
||||||
* @param xy an array with the CIE colour XY values to be converted
|
* @param xy an array with the CIE colour XY values to be converted
|
||||||
* @return the colour temperature in K
|
* @return the colour temperature in K
|
||||||
* @throws IndexOutOfBoundsException if the wrong number of arguments is provided
|
* @throws IllegalArgumentException if the wrong number of arguments is provided
|
||||||
*/
|
*/
|
||||||
public static double xyToKelvin(double[] xy) {
|
public static double xyToKelvin(double[] xy) throws IllegalArgumentException {
|
||||||
if (xy.length != 2) {
|
if (xy.length != 2) {
|
||||||
throw new IllegalArgumentException("xyToKelvin() requires 2 arguments");
|
throw new IllegalArgumentException("xyToKelvin() requires 2 arguments");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user