}
} else if (reader.isArray()) {
int size = reader.size();
if (size == 4) {
// CMYK
return new CMYKColor(
reader.readFloat(0),
reader.readFloat(0),
reader.readFloat(0),
reader.readFloat(0)
);
} else if (size == 3) {
// RGB
return new RGBColor(
reader.readFloat(0),
reader.readFloat(0),
reader.readFloat(0)
);
} else if (size == 1) {
// Gray
return new GrayColor(
reader.readFloat(0)
);
}
} else if (reader.isMap()) {
if (reader.has("red")) {
return new RGBColor(
reader.readFloat("red", 0),
reader.readFloat("green", 0),
reader.readFloat("blue", 0),
reader.readFloat("alpha", 1)
);
} else if (reader.has("cyan")) {
return new CMYKColor(
reader.readFloat("cyan", 0),
reader.readFloat("magenta", 0),
reader.readFloat("yellow", 0),
reader.readFloat("black", 0),
reader.readFloat("alpha", 1)