Trait for calculating mixing two colors together. This trait provides a static method which will receive two colours, and can output a Self which should be the result of both colours mixed by the given percentage (the percentage pertains to how much the second colour should apply to the first). Per CSS Color (4 12.3 & 5 3.5), interpolation uses premultiplied alpha: 1. Premultiply each component
| 24 | /// 2. Linearly interpolate premultiplied values and alpha independently |
| 25 | /// 3. Un-premultiply by dividing by the interpolated alpha |
| 26 | pub trait ColorMix<T, U>: Sized |
| 27 | where |
| 28 | T: Into<Self>, |
| 29 | U: Into<Self>, |
| 30 | { |
| 31 | fn mix(first: T, second: U, percentage: f64) -> Self; |
| 32 | } |
| 33 | |
| 34 | /// Trait for calculating mixing two colors together, with a hue direction for Polar colour spaces. |
| 35 | /// |