pub struct VisualStyle {
pub bg: Color,
pub border_color: Color,
pub border_w: f32,
pub radius: [f32; 4],
pub opacity: f32,
pub shadow: Shadow,
pub pixel_snap: bool,
}Expand description
The paint half of a NodeSpec: background, border, corner radii,
opacity, shadow and pixel snapping.
Fields§
§bg: Color§border_color: Color§border_w: f32§radius: [f32; 4]Corner radii (logical px), clockwise from the top-left:
[tl, tr, br, bl]. NodeSpec::radius sets all four; the per-corner
builders (radius_tl, …) override one — later calls win, like CSS
border-radius followed by border-top-left-radius.
opacity: f32Group opacity, 0..=1 and 1 by default: multiplied into the alpha of
every quad this node and its subtree emit, and into every
descendant’s own opacity. This is the cheap group opacity — a
per-quad alpha multiply, not an offscreen composite — so a subtree
whose own pieces overlap shows its seams through the fade where a
compositing implementation would not. Nothing else changes: an
invisible subtree still lays out, still takes clicks and is still
read by assistive technology, exactly like CSS opacity: 0.
shadow: ShadowThe drop shadow cast behind this node (see Shadow).
pixel_snap: boolPaint the background, border, shadow and fragment with each edge on
a whole physical pixel (pixelSnap). Off by default: a box is drawn where
layout put it, so a gap between two boxes is there at any scale.
On, its edges land where a text’s backgrounds’ do and where every
other snapped box’s do, so snapped boxes that share an edge in
layout, and a snapped box beside a text’s background, meet without
a seam. Layout, hit-testing and the children are untouched.
Trait Implementations§
Source§impl Clone for VisualStyle
impl Clone for VisualStyle
Source§fn clone(&self) -> VisualStyle
fn clone(&self) -> VisualStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VisualStyle
Source§impl Debug for VisualStyle
impl Debug for VisualStyle
Source§impl Default for VisualStyle
impl Default for VisualStyle
Source§fn default() -> VisualStyle
fn default() -> VisualStyle
Source§impl PartialEq for VisualStyle
impl PartialEq for VisualStyle
impl StructuralPartialEq for VisualStyle
Auto Trait Implementations§
impl Freeze for VisualStyle
impl RefUnwindSafe for VisualStyle
impl Send for VisualStyle
impl Sync for VisualStyle
impl Unpin for VisualStyle
impl UnsafeUnpin for VisualStyle
impl UnwindSafe for VisualStyle
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§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.Source§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.Source§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.