pub enum Gradient {
Linear {
stops: Vec<Stop>,
angle: Angle,
space: ColorSpace,
},
Radial {
stops: Vec<Stop>,
center: Center,
radius: Ratio,
focal_center: Center,
focal_radius: Ratio,
space: ColorSpace,
},
Conic {
stops: Vec<Stop>,
angle: Angle,
center: Center,
space: ColorSpace,
},
}Expand description
Represents different types of gradients with specific parameters for each type.
§Examples
use typwire::{Angle, Center, ColorSpace, Gradient, Ratio, Stop};
let linear_gradient = Gradient::linear(vec![], Angle::new(45.0), ColorSpace::Oklab);Variants§
Implementations§
Source§impl Gradient
impl Gradient
Sourcepub const fn linear(stops: Vec<Stop>, angle: Angle, space: ColorSpace) -> Self
pub const fn linear(stops: Vec<Stop>, angle: Angle, space: ColorSpace) -> Self
Creates a new linear gradient with the specified stops, angle, and color space.
§Examples
use typwire::{Angle, ColorSpace, Gradient, Stop};
let gradient = Gradient::linear(vec![], Angle::new(45.0), ColorSpace::Oklab);Sourcepub fn linear_builder() -> LinearGradientBuilder
pub fn linear_builder() -> LinearGradientBuilder
Returns a builder for creating a linear gradient.
§Examples
use typwire::Gradient;
let builder = Gradient::linear_builder();Sourcepub const fn radial(
stops: Vec<Stop>,
center: Center,
radius: Ratio,
focal_center: Center,
focal_radius: Ratio,
space: ColorSpace,
) -> Self
pub const fn radial( stops: Vec<Stop>, center: Center, radius: Ratio, focal_center: Center, focal_radius: Ratio, space: ColorSpace, ) -> Self
Creates a new radial gradient using specified stops, centers, radii, and color space.
§Examples
use typwire::{Center, ColorSpace, Gradient, Ratio, Stop};
let gradient = Gradient::radial(
vec![],
Center::new(Ratio::new(0.5), Ratio::new(0.5)),
Ratio::new(1.0),
Center::new(Ratio::new(0.5), Ratio::new(0.5)),
Ratio::new(0.5),
ColorSpace::Oklab,
);Sourcepub fn radial_builder() -> RadialGradientBuilder
pub fn radial_builder() -> RadialGradientBuilder
Returns a builder for creating a radial gradient.
§Examples
use typwire::Gradient;
let builder = Gradient::radial_builder();Sourcepub const fn conic(
stops: Vec<Stop>,
angle: Angle,
center: Center,
space: ColorSpace,
) -> Self
pub const fn conic( stops: Vec<Stop>, angle: Angle, center: Center, space: ColorSpace, ) -> Self
Creates a new conic gradient using specified stops, an angle, a center, and a color space.
§Examples
use typwire::{Angle, Center, ColorSpace, Gradient, Ratio, Stop};
let gradient = Gradient::conic(
vec![],
Angle::new(45.0),
Center::new(Ratio::new(0.5), Ratio::new(0.5)),
ColorSpace::Oklab,
);Sourcepub fn conic_builder() -> ConicGradientBuilder
pub fn conic_builder() -> ConicGradientBuilder
Returns a builder for creating a conic gradient.
§Examples
use typwire::{Center, Gradient, Ratio};
let builder = Gradient::conic_builder();Trait Implementations§
Source§impl<'de> Deserialize<'de> for Gradient
impl<'de> Deserialize<'de> for Gradient
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Gradient
impl RefUnwindSafe for Gradient
impl Send for Gradient
impl Sync for Gradient
impl Unpin for Gradient
impl UnwindSafe for Gradient
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)