gemischt method

Farbe gemischt(
  1. Farbe andere,
  2. double anteil
)

Mischt zu andere hin; anteil 0 = diese Farbe, 1 = die andere.

Implementation

Farbe gemischt(Farbe andere, double anteil) {
  final t = anteil < 0 ? 0.0 : (anteil > 1 ? 1.0 : anteil);
  int misch(int a, int b) => (a + (b - a) * t).round();
  return Farbe(misch(r, andere.r), misch(g, andere.g), misch(b, andere.b));
}