Closed Ogeon closed 2 years ago
This is what I have been up to for the past few weeks. At least to and from. There is still room for improvement but it should at least be more useful and less confusing than before. And the examples helps with verifying the implementation. Note, when looking at them, that they use linear colors. Many applications will not do that, so they may differ a bit. I'm considering allowing any RGB encoding for that reason.
bors r+
The
Blend
trait has been split intoCompose
,Blend
andBlendWith
, to allow more color spaces to be composed. The trait implementations were also changed from a default implementation to blanket implementations. Having blanket implementations allows users to only require the trait to be implemented without having to specify the trait's requirements. For example, it's only required to specifywhere C: Blend
instead of listing all the mathematical requirements.The
PreAlpha
type has also been changed a lot to get rid of the alpha type parameter and to leave premultiplication to the color types. A lot of it was developed in tandem with changing how the blending was implemented to make those implementations make more sense.Closed Issues
Breaking Change
The
Blend
trait, thePreAlpha
type and a lot of associated API has been changed. Most users should not notice too much, except for needing a different trait or getting it from theblend
module. TheComponentWise
trait is also gone, since all colors can be cast to arrays for iterationMSRV is changed to 1.55.0 to be able to use
[T; N]::map
.