Skip to content

Commit

Permalink
Allow constructing ColorStops from slice (#86)
Browse files Browse the repository at this point in the history
This improves some code within Vello's encoding and ramp cache.
  • Loading branch information
waywardmonkeys authored Dec 18, 2024
1 parent e323fef commit aa175ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ impl BitHash for ColorStops {
}
}

impl From<&[ColorStop]> for ColorStops {
fn from(slice: &[ColorStop]) -> Self {
Self(slice.into())
}
}

/// Properties for the supported [gradient](Gradient) types.
#[derive(Copy, Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
Expand Down

0 comments on commit aa175ed

Please sign in to comment.