(from: Color, to: Color, alpha: f32)
| 166 | } |
| 167 | |
| 168 | fn blend_colors(from: Color, to: Color, alpha: f32) -> Color { |
| 169 | let alpha = alpha.clamp(0.0, 1.0); |
| 170 | let (fr, fg, fb) = color_to_rgb(from); |
| 171 | let (tr, tg, tb) = color_to_rgb(to); |
| 172 | Color::Rgb( |
| 173 | mix_u8(fr, tr, alpha), |
| 174 | mix_u8(fg, tg, alpha), |
| 175 | mix_u8(fb, tb, alpha), |
| 176 | ) |
| 177 | } |
| 178 | |
| 179 | fn mix_u8(from: u8, to: u8, alpha: f32) -> u8 { |
| 180 | let from = from as f32; |
no test coverage detected