From 9c30c1098c18593fdd5a150f5d8d312a3cfc142b Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Mon, 29 Nov 2021 17:39:44 -0700 Subject: [PATCH] Remove TODO & add explanation --- src/graphics_api_impl.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/graphics_api_impl.rs b/src/graphics_api_impl.rs index 8ce7196..c72b380 100644 --- a/src/graphics_api_impl.rs +++ b/src/graphics_api_impl.rs @@ -133,10 +133,11 @@ impl AglApi for GraphicsRenderer { } } -/// Interpolate between two colors according to a factor. +/// Linearly interpolate between two colors according to a factor. +/// This method is cheap, perfectly accurate for shades of gray, and +/// reasonably accurate for other colors; if better results are +/// needed, LCH interpolation should be used instead. fn lerp_rgba(a: RGBA, b: RGBA, fac: f32) -> RGBA { - // TODO: This is probably the wrong way to mix colors, but it's - // simple and works for now. RGBA { r: ((b.r as f32 - a.r as f32) * fac + a.r as f32) as _, g: ((b.g as f32 - a.g as f32) * fac + a.g as f32) as _,