pub struct ConicGradient {
pub center: UnitPoint,
pub start: Angle,
pub stops: Vec<(f64, Ink)>,
}Expand description
A conic (sweep) gradient: color stops around center, the way a color wheel or a gauge’s
ring is painted. The center is in the unit space of the filled shape’s bounding box; the
angle is in canvas space, 0 = the +x axis and positive sweeping clockwise, the
convention Shape::Arc uses. Stops are (offset 0..=1, ink), ascending, where the
offset is the fraction of a full turn from start.
The colors meet at start: for a seamless wheel make the first and last stops the same
color. Native on Core Graphics (where the OS has it), Android, Qt, OH_Drawing and the HTML
canvas; drawn as a fan of thin wedges on the backends with no such gradient, which reads the
same at any size a UI draws.
Fields§
§center: UnitPoint§start: Angle§stops: Vec<(f64, Ink)>Implementations§
Source§impl ConicGradient
impl ConicGradient
pub fn new<C>( center: UnitPoint, start: Angle, stops: impl IntoIterator<Item = (f64, C)>, ) -> ConicGradient
Sourcepub fn centered<C>(
start: Angle,
stops: impl IntoIterator<Item = (f64, C)>,
) -> ConicGradient
pub fn centered<C>( start: Angle, stops: impl IntoIterator<Item = (f64, C)>, ) -> ConicGradient
Around the middle of the shape, starting at start.
Sourcepub fn color_at(&self, angle: Angle) -> Color
pub fn color_at(&self, angle: Angle) -> Color
The color at angle (canvas space, any value) in the current appearance: what a
backend that draws the gradient as wedges fills each wedge with. Colors interpolate
linearly between stops, channel by channel, and hold flat before the first stop and
after the last.
Trait Implementations§
Source§impl Clone for ConicGradient
impl Clone for ConicGradient
Source§fn clone(&self) -> ConicGradient
fn clone(&self) -> ConicGradient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConicGradient
impl Debug for ConicGradient
Source§impl From<ConicGradient> for Paint
impl From<ConicGradient> for Paint
Source§fn from(g: ConicGradient) -> Paint
fn from(g: ConicGradient) -> Paint
Source§impl IntoReactive<Paint, IntoMark<ConicGradient>> for ConicGradient
impl IntoReactive<Paint, IntoMark<ConicGradient>> for ConicGradient
fn into_reactive(self) -> Reactive<Paint>
Source§impl PartialEq for ConicGradient
impl PartialEq for ConicGradient
impl StructuralPartialEq for ConicGradient
Auto Trait Implementations§
impl Forget for ConicGradient
impl Freeze for ConicGradient
impl Move for ConicGradient
impl RefUnwindSafe for ConicGradient
impl Send for ConicGradient
impl Sync for ConicGradient
impl Unpin for ConicGradient
impl UnsafeUnpin for ConicGradient
impl UnwindSafe for ConicGradient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more