Skip to content

Commit

Permalink
Fix compilation errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrandelshofer committed Aug 9, 2024
1 parent fcf3c07 commit 4499a66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
exports org.jhotdraw8.base.converter;
exports org.jhotdraw8.base.io;
exports org.jhotdraw8.base.function;
exports org.jhotdraw8.base.util;
exports org.jhotdraw8.base.event;
exports org.jhotdraw8.base.text;
exports org.jhotdraw8.base.concurrent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ public ShsbaCssColor(Color color) {
}

public ShsbaCssColor(CssSize hue, CssSize saturation, CssSize brightness, CssSize opacity) {
double value = UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue();
double value1 = UnitConverter.PERCENTAGE.equals(brightness.getUnits()) ? brightness.getValue() / 100 : brightness.getValue();
double value2 = UnitConverter.PERCENTAGE.equals(saturation.getUnits()) ? saturation.getValue() / 100 : saturation.getValue();
super(toName(hue, saturation, brightness, opacity),
Color.hsb(
UnitConverter.PERCENTAGE.equals(hue.getUnits()) ? hue.getValue() / 360 : hue.getValue(),
Math.clamp(value2, 0, 1),
Math.clamp(value1, 0, 1),
Math.clamp(value, 0, 1)
Math.clamp(UnitConverter.PERCENTAGE.equals(saturation.getUnits()) ? saturation.getValue() / 100 : saturation.getValue(), 0, 1),
Math.clamp(UnitConverter.PERCENTAGE.equals(brightness.getUnits()) ? brightness.getValue() / 100 : brightness.getValue(), 0, 1),
Math.clamp(UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue(), 0, 1)
)
);
this.hue = hue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,22 @@ public SrgbaCssColor(Color color) {
}

public SrgbaCssColor(CssSize red, CssSize green, CssSize blue, CssSize opacity) {
double value = UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue();
double value1 = UnitConverter.PERCENTAGE.equals(blue.getUnits()) ? blue.getValue() * 2.55 : blue.getValue();
double value2 = UnitConverter.PERCENTAGE.equals(green.getUnits()) ? green.getValue() * 2.55 : green.getValue();
double value3 = UnitConverter.PERCENTAGE.equals(red.getUnits()) ? red.getValue() * 2.55 : red.getValue();
double value4 = UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue();
double value5 = UnitConverter.PERCENTAGE.equals(blue.getUnits()) ? blue.getValue() / 100 : blue.getValue() / 255;
double value6 = UnitConverter.PERCENTAGE.equals(green.getUnits()) ? green.getValue() / 100 : green.getValue() / 255;
double value7 = UnitConverter.PERCENTAGE.equals(red.getUnits()) ? red.getValue() / 100 : red.getValue() / 255;
super(toName(red, green, blue, opacity),

(UnitConverter.PERCENTAGE.equals(red.getUnits())
|| UnitConverter.PERCENTAGE.equals(green.getUnits())
|| UnitConverter.PERCENTAGE.equals(blue.getUnits()))
? Color.color(
Math.clamp(value7, 0, 1),
Math.clamp(value6, 0, 1),
Math.clamp(value5, 0, 1),
Math.clamp(value4, 0, 1)
Math.clamp(UnitConverter.PERCENTAGE.equals(red.getUnits()) ? red.getValue() / 100 : red.getValue() / 255, 0, 1),
Math.clamp(UnitConverter.PERCENTAGE.equals(green.getUnits()) ? green.getValue() / 100 : green.getValue() / 255, 0, 1),
Math.clamp(UnitConverter.PERCENTAGE.equals(blue.getUnits()) ? blue.getValue() / 100 : blue.getValue() / 255, 0, 1),
Math.clamp(UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue(), 0, 1)
)
: Color.rgb(
(int) Math.round(Math.clamp(value3, 0, 255)),
(int) Math.round(Math.clamp(value2, 0, 255)),
(int) Math.round(Math.clamp(value1, 0, 255)),
Math.clamp(value, 0, 1)
(int) Math.round(Math.clamp(UnitConverter.PERCENTAGE.equals(red.getUnits()) ? red.getValue() * 2.55 : red.getValue(), 0, 255)),
(int) Math.round(Math.clamp(UnitConverter.PERCENTAGE.equals(green.getUnits()) ? green.getValue() * 2.55 : green.getValue(), 0, 255)),
(int) Math.round(Math.clamp(UnitConverter.PERCENTAGE.equals(blue.getUnits()) ? blue.getValue() * 2.55 : blue.getValue(), 0, 255)),
Math.clamp(UnitConverter.PERCENTAGE.equals(opacity.getUnits()) ? opacity.getValue() / 100 : opacity.getValue(), 0, 1)
)
);
this.red = red;
Expand Down

0 comments on commit 4499a66

Please sign in to comment.