Ogeon / palette

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

Add `From` implementations for changing `Rgb` component types between `u8`, `f32` and `f64` #390

Closed Ogeon closed 4 months ago

Ogeon commented 4 months ago

This adds From implementations for Rgb and Rgba for changing the component type between u8, f32 and f64. This should hopefully be easier to discover and remember than from_format and into_format.

codspeed-hq[bot] commented 4 months ago

CodSpeed Performance Report

Merging #390 will degrade performances by 10.25%

Comparing rgb_component_type_from_impls (04dbb1a) with master (a22067b)

Summary

⚡ 1 improvements ❌ 1 (👁 1) regressions ✅ 44 untouched benchmarks

Benchmarks breakdown

Benchmark master rgb_component_type_from_impls Change
👁 matrix_inverse 243.3 ns 271.1 ns -10.25%
multiply_3x3 455.6 ns 400 ns +13.89%
codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 19.51220% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 83.35%. Comparing base (a22067b) to head (04dbb1a).

Files Patch % Lines
palette/src/rgb/rgb.rs 19.51% 33 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #390 +/- ## ========================================== - Coverage 83.48% 83.35% -0.14% ========================================== Files 125 125 Lines 20145 20184 +39 Branches 20145 20184 +39 ========================================== + Hits 16818 16824 +6 - Misses 3170 3203 +33 Partials 157 157 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.