pub struct RadialGradient {
pub spread: Spread,
/* private fields */
}Expand description
A data structure to represent a radial gradient.
Fields§
§spread: SpreadThe gradient Spread
Implementations§
Source§impl RadialGradient
impl RadialGradient
Sourcepub fn new(
colors: ColorGradient,
center: LayerOffset,
radius: f32,
focal_point: Option<LayerOffset>,
focal_radius: Option<f32>,
spread: Option<Spread>,
) -> RadialGradient
pub fn new( colors: ColorGradient, center: LayerOffset, radius: f32, focal_point: Option<LayerOffset>, focal_radius: Option<f32>, spread: Option<Spread>, ) -> RadialGradient
Creates a radial gradient from colors, center, radius, and
optional focal settings.
Focal values are clamped to remain within the outer gradient circle.
Sourcepub fn get_center(&self) -> LayerOffset
pub fn get_center(&self) -> LayerOffset
The center (Offset) of the gradient (relative to the Layer.offset).
Sourcepub fn set_center(&mut self, val: LayerOffset)
pub fn set_center(&mut self, val: LayerOffset)
Sets the gradient center.
Updating the center resets the focal point and focal radius to the new origin.
Sourcepub fn get_radius(&self) -> f32
pub fn get_radius(&self) -> f32
The radius of the gradient.
Sourcepub fn set_radius(&mut self, val: f32)
pub fn set_radius(&mut self, val: f32)
Sets the gradient radius.
Sourcepub fn get_focal_point(&self) -> LayerOffset
pub fn get_focal_point(&self) -> LayerOffset
The focal point (Offset) of the gradient (relative to the Layer.offset).
Sourcepub fn set_focal_point(&mut self, val: LayerOffset)
pub fn set_focal_point(&mut self, val: LayerOffset)
Sets the focal point used to bias the radial gradient.
Sourcepub fn get_focal_radius(&self) -> f32
pub fn get_focal_radius(&self) -> f32
Returns the focal radius.
Sourcepub fn set_focal_radius(&mut self, val: f32)
pub fn set_focal_radius(&mut self, val: f32)
Sets the focal radius.
The value is clamped to remain within the outer gradient circle.
Sourcepub fn get_color_at(&self, x: u32, y: u32) -> SolidColor
pub fn get_color_at(&self, x: u32, y: u32) -> SolidColor
A helper function for renderers to get the color at a certain point.
The given x and y values are the coordinate of the pixel in the Layer
(relative to Layer::offset).
Trait Implementations§
Source§impl Clone for RadialGradient
impl Clone for RadialGradient
Source§fn clone(&self) -> RadialGradient
fn clone(&self) -> RadialGradient
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 RadialGradient
impl Debug for RadialGradient
Source§impl<'de> Deserialize<'de> for RadialGradient
impl<'de> Deserialize<'de> for RadialGradient
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RadialGradient, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RadialGradient, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<RadialGradient> for ColorKind
impl From<RadialGradient> for ColorKind
Source§fn from(val: RadialGradient) -> ColorKind
fn from(val: RadialGradient) -> ColorKind
Source§impl Serialize for RadialGradient
impl Serialize for RadialGradient
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for RadialGradient
impl RefUnwindSafe for RadialGradient
impl Send for RadialGradient
impl Sync for RadialGradient
impl Unpin for RadialGradient
impl UnsafeUnpin for RadialGradient
impl UnwindSafe for RadialGradient
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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