public void ApplyChild(ColourInfo childColour) { if (!HasSingleColour) { ApplyChild(childColour, new Quad(0, 0, 1, 1)); return; } if (childColour.HasSingleColour) { singleColour *= childColour.singleColour; } else { HasSingleColour = false; BottomLeft = childColour.BottomLeft * TopLeft; TopRight = childColour.TopRight * TopLeft; BottomRight = childColour.BottomRight * TopLeft; // Need to assign TopLeft last to keep correctness. TopLeft = childColour.TopLeft * TopLeft; } }
public SRGBColour Interpolate(Vector2 interp) => SRGBColour.FromVector( (1 - interp.Y) * ((1 - interp.X) * TopLeft.ToVector() + interp.X * TopRight.ToVector()) + interp.Y * ((1 - interp.X) * BottomLeft.ToVector() + interp.X * BottomRight.ToVector()));
public bool Equals(SRGBColour other) => HasSingleColour && TopLeft.Equals(other);