Enum slint_interpreter::Brush
#[non_exhaustive]#[repr(C)]pub enum Brush {
SolidColor(Color),
LinearGradient(LinearGradientBrush),
RadialGradient(RadialGradientBrush),
}
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.
RadialGradient(RadialGradientBrush)
The radial gradient variant of a brush describes a circle variant centered in the middle
Implementationsยง
ยงimpl Brush
impl Brush
pub 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.
pub 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());
pub fn is_opaque(&self) -> bool
pub fn is_opaque(&self) -> bool
Returns true if this brush is fully opaque
assert!(!Brush::default().is_opaque());
assert!(!Brush::SolidColor(Color::from_argb_u8(25, 255, 128, 140)).is_opaque());
assert!(Brush::SolidColor(Color::from_rgb_u8(128, 140, 210)).is_opaque());
pub fn brighter(&self, factor: f32) -> Brush
pub fn brighter(&self, factor: f32) -> Brush
Returns a new version of this brush that has the brightness increased
by the specified factor. This is done by calling Color::brighter
on
all the colors of this brush.
pub fn darker(&self, factor: f32) -> Brush
pub fn darker(&self, factor: f32) -> Brush
Returns a new version of this brush that has the brightness decreased
by the specified factor. This is done by calling Color::darker
on
all the color of this brush.
pub fn transparentize(&self, amount: f32) -> Brush
pub fn transparentize(&self, amount: f32) -> Brush
Returns a new version of this brush with the opacity decreased by factor
.
The transparency is obtained by multiplying the alpha channel by (1 - factor)
.
See also Color::transparentize
pub fn with_alpha(&self, alpha: f32) -> Brush
pub fn with_alpha(&self, alpha: f32) -> Brush
Returns a new version of this brush with the related colorโs opacities
set to alpha
.
Trait Implementationsยง
ยงimpl InterpolatedPropertyValue for Brush
impl InterpolatedPropertyValue for Brush
ยงfn interpolate(&self, target_value: &Brush, t: f32) -> Brush
fn interpolate(&self, target_value: &Brush, t: f32) -> 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ยง
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
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
ยงfn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
โs vtable from &Trait
โs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
โs vtable from &mut Trait
โs.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>
ยงimpl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere T: Default,
type NoneType = T
ยงfn null_value() -> T
fn null_value() -> T
ยงimpl<T> Pointable for T
impl<T> Pointable for T
sourceยงimpl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
sourceยงfn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.