Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ You can find its changes [documented below](#032-2025-09-10).

This release has an [MSRV][] of 1.82.

### Added

* Add `lerp_rect_unpremultiplied` to interpolate `AlphaColor` without premultiplying alpha (in unpremultiplied "straight" alpha space). ([#199][] by [@tomcur][])

## [0.3.2][] (2025-09-10)

This release has an [MSRV][] of 1.82.
Expand Down Expand Up @@ -209,6 +213,7 @@ This is the initial release.
[#175]: https://github.com/linebender/color/pull/175
[#185]: https://github.com/linebender/color/pull/185
[#190]: https://github.com/linebender/color/pull/190
[#199]: https://github.com/linebender/color/pull/199

[Unreleased]: https://github.com/linebender/color/compare/v0.3.2...HEAD
[0.3.2]: https://github.com/linebender/color/releases/tag/v0.3.2
Expand Down
10 changes: 10 additions & 0 deletions color/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,16 @@ impl<CS: ColorSpace> AlphaColor<CS> {
.un_premultiply()
}

/// Interpolate colors without premultiplying alpha (in unpremultiplied "straight" alpha space).
///
/// Note: this function doesn't fix up hue in cylindrical spaces. It is
/// still useful if the hue angles are compatible, particularly if the
/// fixup has been applied.
#[must_use]
pub fn lerp_rect_unpremultiplied(self, other: Self, t: f32) -> Self {
self + t * (other - self)
}

/// Linearly interpolate colors, with hue fixup if needed.
#[must_use]
pub fn lerp(self, other: Self, t: f32, direction: HueDirection) -> Self {
Expand Down