-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Added StableInterpolate
implementations for linear colors.
#18601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could consider reusing impl_componentwise_vector_space
? b8d7c35
#[test] | ||
pub fn test_color_stable_interpolate() { | ||
let b = Srgba::BLACK; | ||
let w = Srgba::WHITE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Is Srgba actually a linear space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong but I think the point of color spaces is to use them in a linear space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, although I'm not personally certain about the impls other than LinearRgba
.
This isn't the place to get into it I guess, but I'm increasingly of the feeling that the color types shouldn't implement That said, all of the colors can still actually implement |
Objective
Colors currently do not implement
StableInterpolate
, which makes them ineligible for functions likesmooth_nudge
and make some generic APIs awkward.Solution
Implemented
StableInterpolate
for linear color types that should be uncontroversial. Non-linear types likeHsl
are not implemented in this PR.Testing
Added a test that checks implementations are correct.