CmykColor.extrapolate constructor

CmykColor.extrapolate(
  1. List<double> values
)

Constructs a CmykColor from a list of cmyk values on a 0 to 1 scale.

cmyk must not be null and must have exactly 4 or 5 values.

Each of the values must be >= 0 and <= 1.

Implementation

factory CmykColor.extrapolate(List<double> values) {
  assert(values.length == 4 || values.length == 5);
  assert(values[0] >= 0 && values[0] <= 1);
  assert(values[1] >= 0 && values[1] <= 1);
  assert(values[2] >= 0 && values[2] <= 1);
  assert(values[3] >= 0 && values[3] <= 1);
  if (values.length == 5) assert(values[4] >= 0 && values[4] <= 1);
  final alpha = values.length == 5 ? (values[4] * 255).round() : 255;
  return CmykColor(values[0] * 100, values[1] * 100, values[2] * 100,
      values[3] * 100, alpha);
}