Enum slint_interpreter::Brush
source · [−]#[repr(C)]
#[non_exhaustive]
pub enum Brush {
SolidColor(Color),
LinearGradient(LinearGradientBrush),
}
Expand description
(Re-export from corelib.) A brush is a data structure that is used to describe how a shape, such as a rectangle, path or even text, shall be filled. A brush can also be applied to the outline of a shape, that means the fill of the outline itself.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
SolidColor(Color)
The color variant of brush is a plain color that is to be used for the fill.
LinearGradient(LinearGradientBrush)
The linear gradient variant of a brush describes the gradient stops for a fill where all color stops are along a line that’s rotated by the specified angle.
Implementations
sourceimpl Brush
impl Brush
(Re-export from corelib.)
sourcepub fn color(&self) -> Color
pub fn color(&self) -> Color
If the brush is SolidColor, the contained color is returned. If the brush is a LinearGradient, the color of the first stop is returned.
sourcepub fn is_transparent(&self) -> bool
pub fn is_transparent(&self) -> bool
Returns true if this brush contains a fully transparent color (alpha value is zero)
assert!(Brush::default().is_transparent());
assert!(Brush::SolidColor(Color::from_argb_u8(0, 255, 128, 140)).is_transparent());
assert!(!Brush::SolidColor(Color::from_argb_u8(25, 128, 140, 210)).is_transparent());
Trait Implementations
sourceimpl From<LinearGradientBrush> for Brush
impl From<LinearGradientBrush> for Brush
sourcepub fn from(original: LinearGradientBrush) -> Brush
pub fn from(original: LinearGradientBrush) -> Brush
Performs the conversion.
sourceimpl InterpolatedPropertyValue for Brush
impl InterpolatedPropertyValue for Brush
impl StructuralPartialEq for Brush
Auto Trait Implementations
impl RefUnwindSafe for Brush
impl Send for Brush
impl !Sync for Brush
impl Unpin for Brush
impl UnwindSafe for Brush
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more