pub struct LinearGradient {
pub start: Vector2D,
pub end: Vector2D,
pub stops: Vec<(f64, String)>,
}Expand description
A linear gradient defined by two endpoints and a list of color stops.
Used to create smooth color transitions along a straight line for fill or stroke operations on the canvas.
Fields§
§start: Vector2DThe starting point of the gradient in world space.
end: Vector2DThe ending point of the gradient in world space.
stops: Vec<(f64, String)>The ordered list of color stops, each containing a position (0.0 to 1.0) and a CSS color string.
Implementations§
Source§impl LinearGradient
Implements construction and canvas gradient creation for LinearGradient.
impl LinearGradient
Implements construction and canvas gradient creation for LinearGradient.
Sourcepub fn to_gradient(
&self,
context: &CanvasRenderingContext2d,
) -> Option<CanvasGradient>
pub fn to_gradient( &self, context: &CanvasRenderingContext2d, ) -> Option<CanvasGradient>
Trait Implementations§
Source§impl Clone for LinearGradient
impl Clone for LinearGradient
Source§impl Debug for LinearGradient
impl Debug for LinearGradient
Source§impl PartialEq for LinearGradient
impl PartialEq for LinearGradient
impl StructuralPartialEq for LinearGradient
Auto Trait Implementations§
impl Freeze for LinearGradient
impl RefUnwindSafe for LinearGradient
impl Send for LinearGradient
impl Sync for LinearGradient
impl Unpin for LinearGradient
impl UnsafeUnpin for LinearGradient
impl UnwindSafe for LinearGradient
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