pub enum Brush {
Linear {
start: (f32, f32),
end: (f32, f32),
stops: Vec<Stop>,
tile: TileMode,
},
Radial {
center: (f32, f32),
radius: f32,
stops: Vec<Stop>,
tile: TileMode,
},
Image {
asset: u32,
tile: TileMode,
},
}Expand description
What a surface can be filled with beyond a flat colour.
The coordinates are fractions of the area being filled, never pixels. A gradient described in pixels would be a gradient that only looks right at one size, and nothing on this side of the boundary knows how large anything ended up.
Variants§
Implementations§
Source§impl Brush
impl Brush
Sourcepub fn vertical(stops: Vec<Stop>) -> Self
pub fn vertical(stops: Vec<Stop>) -> Self
Top to bottom, which is the gradient almost every screen wants.
Sourcepub fn horizontal(stops: Vec<Stop>) -> Self
pub fn horizontal(stops: Vec<Stop>) -> Self
Left to right.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
The bytes the Renderer reads, in this module’s own layout.
Fixed fields throughout: a kind, a stop count, four coordinates, and then eight bytes per stop. Nothing is skipped for a brush that does not use a coordinate, because a reader that has to know the kind before it knows where the stops start is a reader that can be walked off the end of a short buffer.
Trait Implementations§
impl StructuralPartialEq for Brush
Auto Trait Implementations§
impl Freeze for Brush
impl RefUnwindSafe for Brush
impl Send for Brush
impl Sync for Brush
impl Unpin for Brush
impl UnsafeUnpin for Brush
impl UnwindSafe for Brush
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