mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-23 03:04:07 -04:00
序列化不透明的 Color 时省略 Alpha 通道的值 (#4415)
This commit is contained in:
parent
480f8b6890
commit
37ad445620
@ -40,7 +40,10 @@ public final class PaintAdapter extends TypeAdapter<Paint> {
|
||||
int green = (int) Math.round(color.getGreen() * 255.);
|
||||
int blue = (int) Math.round(color.getBlue() * 255.);
|
||||
int opacity = (int) Math.round(color.getOpacity() * 255.);
|
||||
out.value(String.format("#%02x%02x%02x%02x", red, green, blue, opacity));
|
||||
if (opacity < 255)
|
||||
out.value(String.format("#%02x%02x%02x%02x", red, green, blue, opacity));
|
||||
else
|
||||
out.value(String.format("#%02x%02x%02x", red, green, blue));
|
||||
} else if (value instanceof LinearGradient
|
||||
|| value instanceof RadialGradient) {
|
||||
out.value(value.toString());
|
||||
|
Loading…
x
Reference in New Issue
Block a user