Ogeon / palette

A Rust library for linear color calculations and conversion
Apache License 2.0
752 stars 60 forks source link

Add conversion matrix and `Convert{Once}` traits #406

Closed Ogeon closed 3 months ago

Ogeon commented 3 months ago

Adds a few basic tools for reusable converters, similar to what's discussed in #396:

Some old matrix code has also been cleaned up or replaced. The matrix module is not considered public, so its content should not be relied upon.

codspeed-hq[bot] commented 3 months ago

CodSpeed Performance Report

Merging #406 will degrade performances by 11.73%

Comparing conversion_matrix (b907852) with master (7971660)

Summary

❌ 1 regressions βœ… 42 untouched benchmarks

πŸ†• 4 new benchmarks ⁉️ 3 (πŸ‘ 3) dropped benchmarks

:warning: _Please fix the performance issues or acknowledge them on CodSpeed._

Benchmarks breakdown

Benchmark master conversion_matrix Change
πŸ†• linsrgb to xyz - Matrix3 N/A 5.9 Β΅s N/A
❌ matrix_inverse 438.9 ns 497.2 ns -11.73%
πŸ‘ multiply_rgb_to_xyz 0 s N/A N/A
πŸ‘ multiply_xyz 0 s N/A N/A
πŸ‘ multiply_xyz_to_rgb 0 s N/A N/A
πŸ†• lms to linsrgb N/A 3.2 Β΅s N/A
πŸ†• lms to linsrgb - Matrix3 N/A 2.2 Β΅s N/A
πŸ†• xyz to linsrgb - Matrix3 N/A 5.9 Β΅s N/A
codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 87.87879% with 36 lines in your changes missing coverage. Please review.

Project coverage is 82.62%. Comparing base (7971660) to head (b907852).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #406 +/- ## ========================================== - Coverage 82.66% 82.62% -0.04% ========================================== Files 127 128 +1 Lines 19539 19688 +149 Branches 19539 19688 +149 ========================================== + Hits 16151 16267 +116 - Misses 3285 3315 +30 - Partials 103 106 +3 ``` | [Components](https://app.codecov.io/gh/Ogeon/palette/pull/406/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | Coverage Ξ” | | |---|---|---| | [palette](https://app.codecov.io/gh/Ogeon/palette/pull/406/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | `82.67% <87.87%> (-0.04%)` | :arrow_down: | | [palette_derive](https://app.codecov.io/gh/Ogeon/palette/pull/406/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Hedvall) | `81.98% <ΓΈ> (ΓΈ)` | |