pub enum Paint {
Solid {
color: Rgba,
},
LinearGradient {
start: Vec2,
end: Vec2,
stops: Vec<GradientStop>,
spread: Spread,
},
RadialGradient {
center: Vec2,
radius: f32,
stops: Vec<GradientStop>,
spread: Spread,
},
ConicGradient {
center: Vec2,
angle_degrees: f32,
stops: Vec<GradientStop>,
},
}Expand description
A color or gradient.
Gradients interpolate premultiplied stops in linear light, so a gradient between two colors passes through their physical mix and a stop fading to transparent does not darken its neighbour. A bare color is read as a solid paint; paints are written back tagged.
Variants§
Solid
One color.
LinearGradient
Colors along the line from start to end, constant across it.
Fields
§
stops: Vec<GradientStop>Two to MAX_GRADIENT_STOPS stops.
RadialGradient
Colors along the radius of a circle.
Fields
§
radius: f32The distance of offset 1 from the centre, as a fraction of the picture’s shorter side. Positive.
§
stops: Vec<GradientStop>Two to MAX_GRADIENT_STOPS stops.
ConicGradient
Colors around a point: offsets 0 to 1 are one clockwise turn.
Fields
§
stops: Vec<GradientStop>Two to MAX_GRADIENT_STOPS stops.
Implementations§
Source§impl<'de> Paint
impl<'de> Paint
pub fn deserialize<__D>(__deserializer: __D) -> Result<Paint, __D::Error>where
__D: Deserializer<'de>,
Trait Implementations§
Source§impl AnimatedValue for Paint
impl AnimatedValue for Paint
Source§const ACCEPTS_DATA: bool = false
const ACCEPTS_DATA: bool = false
Whether the type takes the
data value mode.Source§const INTERPOLATES: bool = true
const INTERPOLATES: bool = true
Whether keyframes of the type can interpolate; those of the others only hold.
Source§const OFFSETS: bool = false
const OFFSETS: bool = false
Whether two values of the type have a difference to add: what
repeat_offset needs.Source§const VALUE_CURVES: bool = false
const VALUE_CURVES: bool = false
Whether a keyframe of the type can start a value curve (
ValueBezier).Source§const SPLIT: Option<(usize, usize)> = None
const SPLIT: Option<(usize, usize)> = None
The fewest and the most channels the type’s
split mode takes, or None for a type
without the mode.Source§fn takes_value_curve(&self) -> bool
fn takes_value_curve(&self) -> bool
Whether a keyframe holding this value may start or end a value curve.
Source§fn extrapolates(&self, extrapolation: Extrapolation) -> bool
fn extrapolates(&self, extrapolation: Extrapolation) -> bool
Whether keyframes holding this value may extrapolate by
extrapolation.Source§impl<'de> Deserialize<'de> for Paint
impl<'de> Deserialize<'de> for Paint
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Paint
Auto Trait Implementations§
impl Forget for Paint
impl Freeze for Paint
impl Move for Paint
impl RefUnwindSafe for Paint
impl Send for Paintwhere
RawVecInner: Send,
impl Sync for Paintwhere
RawVecInner: Sync,
impl Unpin for Paint
impl UnsafeUnpin for Paint
impl UnwindSafe for Paintwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more