[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:
Holger Friedrich 2024-11-17 10:33:19 +01:00 committed by GitHub
parent be003029b0
commit aededaecc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -70,4 +70,16 @@ public class CoreUtil {
Gamut gamut = new Gamut(gamutR, gamutG, gamutB);
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);
}
}

View File

@ -1651,9 +1651,9 @@ public class ColorUtil {
*
* @param xy an array with the CIE colour XY values to be converted
* @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) {
throw new IllegalArgumentException("xyToKelvin() requires 2 arguments");
}